整理代码
This commit is contained in:
@@ -36,7 +36,7 @@ public class AgvController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* 推送出库任务
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -31,17 +31,6 @@ public interface IApiService
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
public MydoJob requestEnter(MydoJob mydoJob);
|
||||
/**
|
||||
* 获取任务列表
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
public List<MydoJob> getMydoJobList(MydoJob mydoJob);
|
||||
/**
|
||||
* 更新任务
|
||||
* @param mydoJob
|
||||
*/
|
||||
boolean updateMydoJob(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* WMS出库任务推送
|
||||
@@ -81,12 +70,25 @@ public interface IApiService
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
*
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
AjaxResult receiveAgvMoveJob(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest);
|
||||
|
||||
/**
|
||||
* 任务到达拣选口
|
||||
* @param agvFinishUrl
|
||||
* @param point
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
RequestLog finishMydoJob(String agvFinishUrl, String point, Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 发送agv开始状态
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendOutMydoJobStatus(Map<String, Object> param) ;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,11 @@ public class ApiServiceImpl implements IApiService {
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
/**
|
||||
* 请求入库
|
||||
* @param mydoJob
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
@Override
|
||||
public MydoJob requestEnter(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(REQUEST_ENTER, "请求入库", JSONUtil.toJsonStr(mydoJob));
|
||||
@@ -66,19 +70,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getMydoJobList(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GET_MYDOJOB_URL, "获取任务", JSONUtil.toJsonStr(mydoJob));
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
return JSONUtil.toList(JSONUtil.toJsonStr(bean.getData()), MydoJob.class);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发agv编码
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public GenAgvSchedulingTaskResponse genAgvSchedulingTask(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GEN_AGV_SCHEDULING_TASK, "生成AGV任务", JSONUtil.toJsonStr(genAgvSchedulingTaskRequest));
|
||||
@@ -91,12 +88,15 @@ public class ApiServiceImpl implements IApiService {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AgvCallbackResponse agvCallback(AgvCallbackRequest request) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(request), "AGV任务执行通知");
|
||||
//requestLog.setRequestUrl("http://10.214.18.61:8089/external/log/outStockJob");
|
||||
AgvCallbackResponse response = new AgvCallbackResponse(0, "成功", "");
|
||||
try {
|
||||
agvCallbackInfo(request);
|
||||
@@ -114,6 +114,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
*
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult receiveAgvMoveJob(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
//todo 生成agvQueue队列
|
||||
@@ -126,11 +132,23 @@ public class ApiServiceImpl implements IApiService {
|
||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库到达拣选口
|
||||
* @param agvFinishUrl
|
||||
* @param endPoint
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RequestLog finishMydoJob(String agvFinishUrl, String endPoint, Map<String, Object> param) {
|
||||
return requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(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_OUT_MYDOJOB_STATUS, "发送出库任务状态", JSONUtil.toJsonStr(param));
|
||||
@@ -141,7 +159,10 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理agv状态返回
|
||||
* @param request
|
||||
*/
|
||||
private void agvCallbackInfo(AgvCallbackRequest request) {
|
||||
String taskCode = request.getTaskCode();
|
||||
|
||||
@@ -178,7 +199,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
param.put("taskNo", agvQueue.getWmsTaskNo());
|
||||
param.put("trayCode", agvQueue.getWmsTraycode());
|
||||
//入库任务 暂无特殊逻辑
|
||||
RequestLog requestLog = requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
agvQueue.setFinishTime(DateUtil.formatDateTime(new Date()));
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
@@ -217,7 +238,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
param.put("containerCode", agvQueue.getWmsTraycode());
|
||||
|
||||
//绑定点位和料架
|
||||
RequestLog requestLog = requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
@@ -254,6 +275,11 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult receiveOutMydoJob(MydoJob mydoJob) {
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
@@ -279,6 +305,11 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消AGV任务
|
||||
* @param cancelTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CancelTaskResponse cancelTask(CancelTaskRequest cancelTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CANCEL_TASK_URL, "取消任务", JSONUtil.toJsonStr(cancelTaskRequest));
|
||||
@@ -286,21 +317,15 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续agv任务
|
||||
* @param continueTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ContinueTaskResponse continueTask(ContinueTaskRequest continueTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CONTINUE_TASK_URL, "继续执行任务", JSONUtil.toJsonStr(continueTaskRequest));
|
||||
return BeanUtil.toBean(requestLog.getResponseBody(), ContinueTaskResponse.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateMydoJob(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GET_MYDOJOB_URL, "获取任务", JSONUtil.toJsonStr(mydoJob));
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
if (bean.getCode() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Constant {
|
||||
public static final String GET_MYDOJOB_URL = "http://localhost:8080/api2wms/getJob";
|
||||
public static final String REQUEST_ENTER = "http://localhost:8080/api2wms/requestEnter";
|
||||
public static final String UPDATE_MYDOJOB_URL = "http://127.0.0.1:8081/rcms-dps/rest/queryAgvStatus/";
|
||||
public static final String AGV_FINISH_URL = "http://localhost:8080/api2wms/jobFinish";
|
||||
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/";
|
||||
|
||||
@@ -132,9 +132,6 @@ public class BsInSsjThread implements Runnable {
|
||||
agvQueue.setStatus("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("向CTU下入库库作业");
|
||||
//修改mydoJob执行阶段
|
||||
mydoJob.setExecutionPhase("6");
|
||||
apiService.updateMydoJob(mydoJob);
|
||||
}
|
||||
} else {
|
||||
if (ObjUtil.isNull(mydoJob)) {
|
||||
|
||||
@@ -107,20 +107,9 @@ public class BsOutSsjThread implements Runnable {
|
||||
List<AgvQueue> agvQueueList = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
if (CollUtil.isNotEmpty(agvQueueList)){
|
||||
for (AgvQueue queue : agvQueueList) {
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTaskNo(queue.getWmsTaskNo());
|
||||
mydoJobParam.setTrayCode(queue.getWmsTraycode());
|
||||
List<MydoJob> mydoJobList = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobList)){
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
requestAgvQueue(mydoJob, queue);
|
||||
}else {
|
||||
log.info("队列 agvCode {},无对应出库作业", agvQueue.getReqCode());
|
||||
}
|
||||
requestAgvQueue(queue);
|
||||
}
|
||||
}/*else {
|
||||
log.info("ssjCode:{},没有待下发的出库任务", outSsjDevice.getDeviceCode());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,29 +124,19 @@ public class BsOutSsjThread implements Runnable {
|
||||
agvQueue.setStatus("0");
|
||||
List<AgvQueue> agvQueueList = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
for (AgvQueue queue : agvQueueList) {
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTaskNo(queue.getWmsTaskNo());
|
||||
mydoJobParam.setTrayCode(queue.getWmsTraycode());
|
||||
List<MydoJob> mydoJobList = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobList)){
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
//修改实际流利架货位
|
||||
BasFluentFrame basFluentFrame = basFluentFrameService.selectBasFluentFrameOrderByAllotNum(mydoJob.getExitId());
|
||||
queue.setPositionCode2(basFluentFrame.getLocationName());
|
||||
agvQueueService.updateAgvQueue(queue);
|
||||
requestAgvQueue(mydoJob, queue);
|
||||
}else {
|
||||
log.info("队列 agvCode {},无对应出库作业", agvQueue.getReqCode());
|
||||
}
|
||||
//修改实际流利架货位
|
||||
BasFluentFrame basFluentFrame = basFluentFrameService.selectBasFluentFrameOrderByAllotNum(queue.getPositionCode2());
|
||||
queue.setPositionCode2(basFluentFrame.getLocationName());
|
||||
agvQueueService.updateAgvQueue(queue);
|
||||
requestAgvQueue(queue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求海康生成agv任务,并修改wms任务状态
|
||||
* @param mydoJob
|
||||
* @param agvQueue
|
||||
*/
|
||||
private void requestAgvQueue(MydoJob mydoJob, AgvQueue agvQueue) {
|
||||
private void requestAgvQueue(AgvQueue agvQueue) {
|
||||
//请求ctu
|
||||
GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest = new GenAgvSchedulingTaskRequest();
|
||||
genAgvSchedulingTaskRequest.setReqCode(agvQueue.getReqCode());
|
||||
@@ -168,7 +147,7 @@ public class BsOutSsjThread implements Runnable {
|
||||
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||
genAgvSchedulingTaskRequest.setGroupId(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setGroupId(agvQueue.getWmsTaskNo());
|
||||
genAgvSchedulingTaskRequest.setAgvTyp("CTU");
|
||||
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||
|
||||
@@ -1,29 +1,22 @@
|
||||
package com.ruoyi.schedule.scheduleTask.ssj.bs;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.port.domain.WcsPort;
|
||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.Constant.AGV_FINISH_URL;
|
||||
import static com.ruoyi.common.Constant.JOB_FINISH_URL;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -93,7 +86,7 @@ public class BsPickSsjTread implements Runnable{
|
||||
param.put("taskNo", pickSsjDevice.getTaskNo());
|
||||
param.put("wmsType", "2");
|
||||
param.put("pickSsj", pickSsjDevice.getDeviceCode());
|
||||
RequestLog requestLog = apiService.finishMydoJob(AGV_FINISH_URL, "出库任务到达拣选口", param);
|
||||
RequestLog requestLog = apiService.finishMydoJob(JOB_FINISH_URL, "出库任务到达拣选口", param);
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
wcsPort.setStatus("1");
|
||||
wcsPortService.updateWcsPort(wcsPort);
|
||||
|
||||
@@ -99,16 +99,7 @@ public class JsOutSsjThread implements Runnable{
|
||||
List<AgvQueue> agvQueueList = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
if (CollUtil.isNotEmpty(agvQueueList)){
|
||||
for (AgvQueue queue : agvQueueList) {
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setTaskNo(queue.getWmsTaskNo());
|
||||
mydoJobParam.setTrayCode(queue.getWmsTraycode());
|
||||
List<MydoJob> mydoJobList = apiService.getMydoJobList(mydoJobParam);
|
||||
if (CollUtil.isNotEmpty(mydoJobList)){
|
||||
MydoJob mydoJob = mydoJobList.get(0);
|
||||
requestAgvQueue(mydoJob, queue);
|
||||
}else {
|
||||
log.info("队列 agvCode {},无对应出库作业", agvQueue.getReqCode());
|
||||
}
|
||||
requestAgvQueue( queue);
|
||||
}
|
||||
}else {
|
||||
log.info("ssjCode:{},没有待下发的出库任务", outSsjDevice.getDeviceCode());
|
||||
@@ -118,10 +109,9 @@ public class JsOutSsjThread implements Runnable{
|
||||
|
||||
/**
|
||||
* 请求海康生成agv任务,并修改wms任务状态
|
||||
* @param mydoJob
|
||||
* @param agvQueue
|
||||
*/
|
||||
private void requestAgvQueue(MydoJob mydoJob, AgvQueue agvQueue) {
|
||||
private void requestAgvQueue(AgvQueue agvQueue) {
|
||||
//请求ctu
|
||||
GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest = new GenAgvSchedulingTaskRequest();
|
||||
genAgvSchedulingTaskRequest.setReqCode(agvQueue.getReqCode());
|
||||
@@ -131,8 +121,7 @@ public class JsOutSsjThread implements Runnable{
|
||||
genAgvSchedulingTaskRequest.setCtnrCode("0");
|
||||
genAgvSchedulingTaskRequest.setCtnrNum("0");
|
||||
genAgvSchedulingTaskRequest.setTaskMode("0");
|
||||
genAgvSchedulingTaskRequest.setTaskCode(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setGroupId(mydoJob.getTaskNo());
|
||||
genAgvSchedulingTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||
genAgvSchedulingTaskRequest.setAgvTyp("CTU");
|
||||
genAgvSchedulingTaskRequest.setPositionSelStrategy("0");
|
||||
GenAgvSchedulingTaskResponse genAgvSchedulingTaskResponse = apiService.genAgvSchedulingTask(genAgvSchedulingTaskRequest);
|
||||
|
||||
@@ -2,27 +2,21 @@ package com.ruoyi.schedule.scheduleTask.ssj.js;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.port.domain.WcsPort;
|
||||
import com.ruoyi.bas.port.service.IWcsPortService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.ruoyi.common.Constant.AGV_FINISH_URL;
|
||||
import static com.ruoyi.common.Constant.JOB_FINISH_URL;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -104,7 +98,7 @@ public class JsPickSsjTread implements Runnable {
|
||||
param.put("taskNo", pickSsjDevice.getTaskNo());
|
||||
param.put("wmsType", "2");
|
||||
param.put("pickSsj", pickSsjDevice.getDeviceCode());
|
||||
RequestLog requestLog = apiService.finishMydoJob(AGV_FINISH_URL, "出库任务到达拣选口", param);
|
||||
RequestLog requestLog = apiService.finishMydoJob(JOB_FINISH_URL, "出库任务到达拣选口", param);
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
wcsPort.setStatus("1");
|
||||
wcsPortService.updateWcsPort(wcsPort);
|
||||
|
||||
Reference in New Issue
Block a user