堆垛机调度初始化
This commit is contained in:
@@ -2,13 +2,9 @@ package com.ruoyi.api.controller;
|
||||
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackRequest;
|
||||
import com.ruoyi.api.domain.agv.agvCallback.AgvCallbackResponse;
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -39,17 +35,6 @@ public class AgvController extends BaseController {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
@PostMapping("/receiveAgvMoveJob")
|
||||
public AjaxResult receiveAgvMoveJob(@RequestBody GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
return apiService.receiveAgvMoveJob(genAgvSchedulingTaskRequest);
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
* @param param{
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.ruoyi.api.domain.wcs2wms;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 任务表对象 mydo_job
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class MydoJob extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务ID")
|
||||
private String jobId;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态",dictType = "mydo_job_status")
|
||||
private String status;
|
||||
|
||||
/** 上线类型 */
|
||||
@Excel(name = "上线类型",dictType = "on_line_type")
|
||||
private String onLineType;
|
||||
|
||||
/** 任务号 */
|
||||
@Excel(name = "任务号")
|
||||
private String taskNo;
|
||||
|
||||
/** 供应商ID */
|
||||
@Excel(name = "供应商ID")
|
||||
private String supplierId;
|
||||
@Excel(name = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
/** 客户ID */
|
||||
@Excel(name = "客户ID")
|
||||
private String customerId;
|
||||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门ID")
|
||||
private String departmentId;
|
||||
@Excel(name = "部门")
|
||||
private String departmentName;
|
||||
|
||||
/** 托盘码 */
|
||||
@Excel(name = "托盘码")
|
||||
private String trayCode;
|
||||
|
||||
/** 巷道ID */
|
||||
@Excel(name = "巷道ID")
|
||||
private String roadwayId;
|
||||
|
||||
/** 货位ID */
|
||||
@Excel(name = "货位ID")
|
||||
private String cargoSpaceId;
|
||||
@Excel(name = "货位名称")
|
||||
private String cargoSpaceName;
|
||||
|
||||
/** 目标巷道ID */
|
||||
@Excel(name = "目标巷道ID")
|
||||
private String targetRoadwayId;
|
||||
|
||||
/** 目标货位ID */
|
||||
@Excel(name = "目标货位ID")
|
||||
private String targetCargoSpaceId;
|
||||
@Excel(name = "目标货位名称")
|
||||
private String targetCargoSpaceName;
|
||||
|
||||
/** 产线ID */
|
||||
@Excel(name = "产线ID")
|
||||
private String lineId;
|
||||
|
||||
/** 车间ID */
|
||||
@Excel(name = "车间ID")
|
||||
private String workshopId;
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private Long priority;
|
||||
|
||||
/** 执行阶段 */
|
||||
@Excel(name = "执行阶段",dictType = "execution_phase_type")
|
||||
private String executionPhase;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型",dictType = "in_or_out_type")
|
||||
private String inOrOut;
|
||||
|
||||
|
||||
|
||||
/** 开始时间 */
|
||||
@Excel(name = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@Excel(name = "结束时间")
|
||||
private String finishTime;
|
||||
|
||||
/** 入口ID */
|
||||
@Excel(name = "入口ID")
|
||||
private String entranceId;
|
||||
|
||||
/** 出口ID */
|
||||
@Excel(name = "出口ID")
|
||||
private String exitId;
|
||||
|
||||
/** 班组ID */
|
||||
@Excel(name = "班组ID")
|
||||
private String classId;
|
||||
|
||||
/** 仓库ID */
|
||||
@Excel(name = "仓库ID")
|
||||
private String warehouseId;
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
/** 重分标记 */
|
||||
@Excel(name = "重分标记")
|
||||
private String faultFlag;
|
||||
|
||||
private String inOut;
|
||||
|
||||
|
||||
}
|
||||
@@ -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