堆垛机调度初始化
This commit is contained in:
@@ -10,10 +10,10 @@ 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.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -146,4 +146,18 @@ public interface IApiService
|
||||
* @return
|
||||
*/
|
||||
AjaxResult cancelMydoJob(JobParam jobParam);
|
||||
|
||||
/**
|
||||
* 放货有货,重新分配货位
|
||||
* @param jobParam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult reAssignMydoJob(JobParam jobParam);
|
||||
|
||||
/**
|
||||
* 取货无货,重新分配单据
|
||||
* @param jobParam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult reAssignMydoJob2(JobParam jobParam);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ 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.MydoJob;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.fluent.domain.BasFluentFrame;
|
||||
@@ -26,14 +25,14 @@ 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.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SendData;
|
||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -230,150 +229,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
* @param request
|
||||
*/
|
||||
private void agvCallbackInfo(AgvCallbackRequest request) {
|
||||
String taskCode = request.getTaskCode();
|
||||
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(taskCode);
|
||||
//通知wms agv搬运阶段完成
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
if (ObjUtil.isNotNull(agvQueue)) {
|
||||
switch (request.getMethod()) {
|
||||
case "start":
|
||||
//任务开始
|
||||
agvQueue.setStatus("2");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("【AGV任务开始】任务号:{}", taskCode);
|
||||
//通知wms
|
||||
param.put("taskNo", agvQueue.getWmsTaskNo());
|
||||
param.put("wmsType", agvQueue.getWmsTaskType());
|
||||
sendOutMydoJobStatus(param);
|
||||
break;
|
||||
case "outbin":
|
||||
//走出储位
|
||||
agvQueue.setStatus("3");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
log.info("【AGV走出储位】任务号:{}", taskCode);
|
||||
break;
|
||||
case "end":
|
||||
//任务结束
|
||||
agvQueue.setStatus("4");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
|
||||
|
||||
param.put("wmsType", agvQueue.getWmsTaskType());
|
||||
|
||||
if ("1".equals(agvQueue.getWmsTaskType())) {
|
||||
param.put("taskNo", agvQueue.getWmsTaskNo());
|
||||
param.put("trayCode", agvQueue.getWmsTraycode());
|
||||
//入库任务 暂无特殊逻辑
|
||||
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);
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
//删除队列
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueue.getReqCode());
|
||||
log.info("【AGV入库任务结束】任务号:{}", taskCode);
|
||||
|
||||
}
|
||||
} else if ("2".equals(agvQueue.getWmsTaskType())) {
|
||||
if (agvQueue.getPositionCode2().startsWith("fluent")){
|
||||
//流利架出库 同步电子标签
|
||||
Map<String, Object> fluentPickParam = new HashMap<>();
|
||||
fluentPickParam.put("taskNo", agvQueue.getWmsTaskNo());
|
||||
fluentPickParam.put("wmsType", "2");
|
||||
fluentPickParam.put("pickSsj", agvQueue.getPositionCode2());
|
||||
RequestLog requestLog = finishMydoJob(JOB_FINISH_URL, "流利架任务到达拣选口", fluentPickParam);
|
||||
agvQueue.setFinishTime(DateUtil.formatDateTime(new Date()));
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
//删除队列
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueue.getReqCode());
|
||||
log.info("【AGV出库任务结束】任务号:{}", taskCode);
|
||||
}else {
|
||||
//输送机出库 PLC写入任务号
|
||||
//通知wms 任务结束
|
||||
param.put("taskNo", agvQueue.getWmsTaskNo());
|
||||
param.put("trayCode", agvQueue.getWmsTraycode());
|
||||
//写入对应的plc 任务号
|
||||
DeviceSsj deviceSsj = PlcRead.deviceMap.get(agvQueue.getPositionCode2());
|
||||
if (ObjUtil.isNotNull(deviceSsj)) {
|
||||
SendData rwh = new SendData(Tools.DINT, agvQueue.getWmsTaskNo());
|
||||
byte[] bytes = Tools.sendData(rwh);
|
||||
//写入信息 取货完成
|
||||
int i = PlcRead.WriteToSSJ(deviceSsj.getPlcDbWriteAddress(), bytes);
|
||||
if (i == 1) {
|
||||
agvQueue.setFinishTime(DateUtil.formatDateTime(new Date()));
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
//删除队列
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueue.getReqCode());
|
||||
log.info("【AGV出库任务结束】任务号:{}", taskCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("3".equals(agvQueue.getWmsTaskType())) {
|
||||
param.put("positionCode1", agvQueue.getPositionCode1());
|
||||
param.put("positionCode2", agvQueue.getPositionCode2());
|
||||
param.put("containerCode", agvQueue.getWmsTraycode());
|
||||
|
||||
//绑定点位和料架
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
//删除队列
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueue.getReqCode());
|
||||
//修改点位状态
|
||||
WcsPort wcsPort = wcsPortService.selectWcsPortByPortCode(agvQueue.getPositionCode2());
|
||||
wcsPort.setStatus("1");
|
||||
wcsPortService.updateWcsPort(wcsPort);
|
||||
log.info("【AGV任务结束】任务号:{}", taskCode);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "cancel":
|
||||
//任务单取消
|
||||
agvQueue.setStatus("5");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
//删除队列
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueue.getReqCode());
|
||||
log.info("【AGV任务单取消】任务号:{}", taskCode);
|
||||
break;
|
||||
case "apply":
|
||||
//CTU料箱取放申请
|
||||
//请求放货
|
||||
if ("0".equals(agvQueue.getRequest())) {
|
||||
agvQueue.setRequest("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
log.info("【AGV料箱取放申请】任务号:{}", taskCode);
|
||||
break;
|
||||
case "takeCompleted":
|
||||
//ctu取货完成
|
||||
HashMap<String, Object> takeCompletedParam = new HashMap<>();
|
||||
takeCompletedParam.put("portCode",agvQueue.getPositionCode1());
|
||||
takeCompletedParam.put("wmsType",agvQueue.getWmsTaskType());
|
||||
takeCompleted(takeCompletedParam);
|
||||
if ("3".equals(agvQueue.getWmsTaskType())){
|
||||
//修改点位状态
|
||||
WcsPort wcsPort = wcsPortService.selectWcsPortByPortCode(agvQueue.getPositionCode1());
|
||||
wcsPort.setStatus("0");
|
||||
wcsPortService.updateWcsPort(wcsPort);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log.info("未知方法");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* @param receiveOutJob
|
||||
@@ -451,6 +312,16 @@ public class ApiServiceImpl implements IApiService {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult reAssignMydoJob(JobParam jobParam) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult reAssignMydoJob2(JobParam jobParam) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成agv队列
|
||||
|
||||
Reference in New Issue
Block a user