取货无货,放货有货接口
This commit is contained in:
@@ -27,25 +27,6 @@ import java.util.Map;
|
||||
public interface IApiService
|
||||
{
|
||||
|
||||
/**
|
||||
* 根据条码请求入库
|
||||
* @param mydoJob
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
public MydoJob requestEnterByTrayCode(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 根据入口请求入库
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
public List<MydoJob> requestEnterByEnterId(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* WMS出库任务推送
|
||||
* @param receiveOutJob
|
||||
*/
|
||||
// public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob);
|
||||
|
||||
/**
|
||||
* 生成agv队列
|
||||
@@ -103,34 +84,12 @@ public interface IApiService
|
||||
*/
|
||||
RequestLog finishMydoJob(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 发送agv开始状态
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendOutMydoJobStatus(Map<String, Object> param) ;
|
||||
|
||||
|
||||
/**
|
||||
* 发送ctu 取货完成信号
|
||||
* @param param{
|
||||
* "lljCode":""流利架位置
|
||||
* }
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult takeCompleted(Map<String, Object> param) ;
|
||||
|
||||
/**
|
||||
* 下发agv任务
|
||||
* @param agvQueue
|
||||
* @return
|
||||
*/
|
||||
public GenAgvSchedulingTaskResponse requestAgvQueue(AgvQueue agvQueue);
|
||||
/**
|
||||
* WMS流利架入库任务推送
|
||||
* @param receiveInJob
|
||||
*/
|
||||
// AjaxResult receiveInMydoJob(ReceiveJob receiveInJob);
|
||||
|
||||
|
||||
/**
|
||||
@@ -145,14 +104,14 @@ public interface IApiService
|
||||
* @param jobParam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult reAssignMydoJob(JobParam jobParam);
|
||||
AjaxResult reAssign(JobParam jobParam);
|
||||
|
||||
/**
|
||||
* 取货无货,重新分配单据
|
||||
* @param jobParam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult reAssignMydoJob2(JobParam jobParam);
|
||||
AjaxResult reMaterial(JobParam jobParam);
|
||||
|
||||
/**
|
||||
* 入库请求生成作业
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.InterfaceReceive;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
@@ -13,19 +11,15 @@ import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.domain.agv.cancelTask.CancelTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.cancelTask.CancelTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.continueTask.ContinueTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.fluent.domain.BasFluentFrame;
|
||||
import com.ruoyi.bas.fluent.service.IBasFluentFrameService;
|
||||
import com.ruoyi.bas.port.domain.WcsPort;
|
||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -33,7 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.Constant.*;
|
||||
|
||||
@@ -51,45 +47,8 @@ public class ApiServiceImpl implements IApiService {
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
@Autowired
|
||||
private IBasFluentFrameService fluentFrameService;
|
||||
@Autowired
|
||||
private IWcsPortService wcsPortService;
|
||||
private IMydoJobService mydoJobService;
|
||||
|
||||
/**
|
||||
* 请求入库
|
||||
* @param mydoJob
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
@Override
|
||||
public MydoJob requestEnterByTrayCode(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(REQUEST_ENTER_BY_TRAYCODE, "根据条码请求入库", JSONUtil.toJsonStr(mydoJob));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
return JSONUtil.toBean(JSONUtil.toJsonStr(bean.getData()), MydoJob.class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求入库
|
||||
* @param mydoJob
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
@Override
|
||||
public List<MydoJob> requestEnterByEnterId(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(REQUEST_ENTER_BY_ENTER_ID, "根据入口请求入库", JSONUtil.toJsonStr(mydoJob));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
return JSONUtil.toList(JSONUtil.toJsonStr(bean.getData()), MydoJob.class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -114,8 +73,10 @@ public class ApiServiceImpl implements IApiService {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -153,64 +114,35 @@ public class ApiServiceImpl implements IApiService {
|
||||
String traySize = param.get("traySize");
|
||||
String wmsTaskNo = param.get("wmstaskNo");
|
||||
|
||||
AgvQueue agvQueue = createAgvQueue(startPoint,endPoint, param.get("trayCode"), param.get("taskNo"), "1",traySize,wmsTaskNo);
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(agvQueue);
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||
AgvQueue agvQueue = createAgvQueue(startPoint, endPoint, param.get("trayCode"), param.get("taskNo"), "1", traySize, wmsTaskNo);
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = requestAgvQueue(agvQueue);
|
||||
if (genAgvSchedulingTaskResponse.getCode() == 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库到达拣选口
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RequestLog finishMydoJob( Map<String, Object> param) {
|
||||
public RequestLog finishMydoJob(Map<String, Object> param) {
|
||||
return requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送出库任务状态
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult sendOutMydoJobStatus(Map<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(SEND_TASK_STARTED, "发送任务开始信号", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 料箱取货完成
|
||||
* @param param{
|
||||
* "lljCode":""流利架位置
|
||||
* }
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult takeCompleted(Map<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(TAKE_COMPLETED, "ctu取货完成信号", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理agv状态返回
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
private void agvCallbackInfo(AgvCallbackRequest request) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(request.getTaskCode());
|
||||
if (agvQueue != null ) {
|
||||
if (agvQueue != null) {
|
||||
String method = request.getMethod();
|
||||
switch (method) {
|
||||
case "applyin":
|
||||
@@ -247,38 +179,6 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* @param receiveOutJob
|
||||
* @return
|
||||
*/
|
||||
// @Override
|
||||
// public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
||||
// AgvQueue agvQueue = createAgvQueue(receiveOutJob.getCargoSpaceId(),receiveOutJob.getExitId(),receiveOutJob.getTrayCode(),receiveOutJob.getTaskNo(),"2");
|
||||
// if (agvQueue != null){
|
||||
// return AjaxResult.success();
|
||||
// }else {
|
||||
// return AjaxResult.error("生成agv任务失败");
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 接收流利架空料箱入库任务
|
||||
*
|
||||
* @param receiveInJob
|
||||
* @return
|
||||
*/
|
||||
// @Override
|
||||
// public AjaxResult receiveInMydoJob(ReceiveJob receiveInJob) {
|
||||
// AgvQueue agvQueue = createAgvQueue(receiveInJob.getEntranceId(),receiveInJob.getCargoSpaceId(),receiveInJob.getTrayCode(),receiveInJob.getTaskNo(),"1");
|
||||
// if (agvQueue != null){
|
||||
// return AjaxResult.success();
|
||||
// }else {
|
||||
// return AjaxResult.error("生成agv任务失败");
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 取消ctu任务
|
||||
*
|
||||
@@ -293,7 +193,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
CancelTaskRequest cancelTaskRequest = new CancelTaskRequest();
|
||||
cancelTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||
CancelTaskResponse cancelTaskResponse = cancelTask(cancelTaskRequest);
|
||||
if (cancelTaskResponse.getCode() == 0){
|
||||
if (cancelTaskResponse.getCode() == 0) {
|
||||
agvQueue.setStatus("5");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
//插入历史
|
||||
@@ -308,27 +208,41 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult reAssignMydoJob(JobParam jobParam) {
|
||||
return null;
|
||||
public AjaxResult reAssign(JobParam jobParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(RE_ASSIGN_URL, "重新分配货位", JSONUtil.toJsonStr(jobParam));
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
MydoJob wmsMydoJob = BeanUtil.toBean(bean.getData(), MydoJob.class);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsMydoJob.getJobId());
|
||||
mydoJob.setCargoSpaceId(wmsMydoJob.getCargoSpaceId());
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult reAssignMydoJob2(JobParam jobParam) {
|
||||
return null;
|
||||
public AjaxResult reMaterial(JobParam jobParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(RE_MATERIAL_URL, "重新分配物料", JSONUtil.toJsonStr(jobParam));
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成agv队列
|
||||
* @param code1 起点
|
||||
* @param code2 终点
|
||||
*
|
||||
* @param code1 起点
|
||||
* @param code2 终点
|
||||
* @param wmsTrayCode 容器码 托盘料箱码/容器码
|
||||
* @param wmsTaskNo mydojob 任务
|
||||
* @param wmsTaskNo mydojob 任务
|
||||
* @param wmsTaskType 1-入库 2-出库 3-agv搬运
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AgvQueue createAgvQueue(String code1,String code2,String wmsTrayCode,String taskCode,String wmsTaskType,String traySize,String wmsTaskNo) {
|
||||
public AgvQueue createAgvQueue(String code1, String code2, String wmsTrayCode, String taskCode, String wmsTaskType, String traySize, String wmsTaskNo) {
|
||||
//生成ctu执行队列
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
String reqCode = IdUtil.fastSimpleUUID();
|
||||
@@ -356,6 +270,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
/**
|
||||
* 取消AGV任务
|
||||
*
|
||||
* @param cancelTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@@ -368,6 +283,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
/**
|
||||
* 继续agv任务
|
||||
*
|
||||
* @param agvQueue
|
||||
* @return
|
||||
*/
|
||||
@@ -378,16 +294,15 @@ public class ApiServiceImpl implements IApiService {
|
||||
continueTaskRequest.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
continueTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CONTINUE_TASK_URL, "继续执行任务", JSONUtil.toJsonStr(continueTaskRequest));
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 请求海康生成agv任务,并修改wms任务状态
|
||||
*
|
||||
|
||||
@@ -3,32 +3,19 @@ package com.ruoyi.common;
|
||||
|
||||
public class Constant {
|
||||
|
||||
/**
|
||||
* REST协议接口基础地址
|
||||
*/
|
||||
public static final String BASEURL = "http://127.0.0.1:8081";
|
||||
|
||||
/**
|
||||
* REST协议接口基础地址
|
||||
*/
|
||||
public static final String BASEURL_REST = BASEURL + "/rcms/services/rest/hikRpcService/";
|
||||
|
||||
/**
|
||||
* AGV状态协议接口基础地址
|
||||
*/
|
||||
public static final String BASEURL_AGV = BASEURL + "/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String WMS_BASE_URL = "http://localhost:8080/api2wms/";
|
||||
public static final String RCS_BASE_URL = "http://127.0.0.1:8081/rcms-dps/rest/";
|
||||
|
||||
|
||||
public static final String REQUEST_ENTER_BY_TRAYCODE = "http://localhost:8080/api2wms/requestEnterByTrayCode";
|
||||
public static final String REQUEST_ENTER_BY_ENTER_ID = "http://localhost:8080/api2wms/requestEnterByEnterId";
|
||||
public static final String JOB_FINISH_URL = "http://localhost:8080/api2wms/jobFinish";
|
||||
public static final String CONTINUE_TASK_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String CANCEL_TASK_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String GEN_AGV_SCHEDULING_TASK = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String SEND_TASK_STARTED = "http://127.0.0.1:8080/api2wms/startSignal";
|
||||
public static final String TAKE_COMPLETED = "http://127.0.0.1:8080/api2wms/takeCompleted";
|
||||
public static final String CREATE_IN_MYDO_JOB_URL = "http://127.0.0.1:8080/api2wms/requestEnterByTrayCode";
|
||||
public static final String REQUEST_MYDO_JOB_URL = "http://127.0.0.1:8080/api2wms/requestByNoTrayCode";
|
||||
public static final String JOB_FINISH_URL = WMS_BASE_URL+"jobFinish";
|
||||
public static final String CONTINUE_TASK_URL = RCS_BASE_URL+"queryAgvStatus";
|
||||
public static final String CANCEL_TASK_URL = RCS_BASE_URL+"queryAgvStatus";;
|
||||
public static final String GEN_AGV_SCHEDULING_TASK = RCS_BASE_URL+"queryAgvStatus";;
|
||||
public static final String CREATE_IN_MYDO_JOB_URL = WMS_BASE_URL+"requestEnterByTrayCode";
|
||||
public static final String REQUEST_MYDO_JOB_URL = WMS_BASE_URL+"requestByNoTrayCode";
|
||||
|
||||
public static final String RE_ASSIGN_URL = WMS_BASE_URL+"reAssign";
|
||||
public static final String RE_MATERIAL_URL = WMS_BASE_URL+"reMaterial";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -125,9 +125,9 @@ public class Ddj1Thread implements Runnable {
|
||||
if ("0".equals(mydoJob.getFaultFlag())){
|
||||
mydoJob.setStatus("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
AjaxResult ajaxResult = apiService.reAssignMydoJob(new JobParam(rwh.toString(), null, null));
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(rwh.toString(), null, null));
|
||||
if (ajaxResult.isSuccess()){
|
||||
mydoJob.setStatus("2");
|
||||
mydoJob.setFaultFlag("2");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public class Ddj1Thread implements Runnable {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh);
|
||||
//找到对应任务 调用api接口 取货无货,重新分配单据
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||
AjaxResult ajaxResult = apiService.reAssignMydoJob2(new JobParam(rwh.toString(), null, null));
|
||||
AjaxResult ajaxResult = apiService.reMaterial(new JobParam(rwh.toString(), null, null));
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//作废作业
|
||||
InvalidMydoJob(rwh, ddj.getId());
|
||||
|
||||
Reference in New Issue
Block a user