From d92318d7632c0459188f3d49e7f51579cf739766 Mon Sep 17 00:00:00 2001 From: Comair <1464848666@qq.com> Date: Mon, 28 Apr 2025 14:27:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=B0=81=E8=A3=85=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/busin/WcsTaskController.java | 103 +++++++++++++++--- .../wcs/third/rcs/dto/RcsCreateTaskDto.java | 47 ++++++-- .../com/shkj/wcs/third/rcs/dto/RcsIdList.java | 22 +++- .../wcs/third/rcs/enums/RCSOperation.java | 19 ++++ .../wcs/third/rcs/enums/RCSTaskTypeEnum.java | 8 +- .../shkj/wcs/third/workbinWcs/WCSUtil.java | 2 +- .../dto/WCSQueryAreaStatusBody.java | 17 +++ .../workbinWcs/dto/WCSQueryAreaStatusDto.java | 20 ++++ .../dto/WCSQueryTaskStatusBody.java | 19 ++++ .../workbinWcs/dto/WcsQueryTaskStatusDto.java | 21 ++++ 10 files changed, 245 insertions(+), 33 deletions(-) create mode 100644 shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSOperation.java create mode 100644 shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusBody.java create mode 100644 shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusDto.java create mode 100644 shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryTaskStatusBody.java create mode 100644 shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsQueryTaskStatusDto.java diff --git a/shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java b/shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java index d866e68..6cc058d 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/controller/busin/WcsTaskController.java @@ -5,11 +5,17 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.shkj.common.annotation.Log; import com.shkj.common.annotation.RepeatSubmit; +import com.shkj.common.core.domain.Result; import com.shkj.common.enums.BusinessType; import com.shkj.common.utils.DateUtils; import com.shkj.wcs.service.IBusinDataTaskService; -import com.shkj.wcs.third.workbinWcs.dto.WcsCreateTaskBody; -import com.shkj.wcs.third.workbinWcs.dto.WcsCreateTaskDto; +import com.shkj.wcs.third.rcs.RCSUtil; +import com.shkj.wcs.third.rcs.dto.RcsCreateTaskDto; +import com.shkj.wcs.third.rcs.dto.RcsIdList; +import com.shkj.wcs.third.rcs.enums.RCSOperation; +import com.shkj.wcs.third.rcs.enums.RCSTaskTypeEnum; +import com.shkj.wcs.third.workbinWcs.WCSUtil; +import com.shkj.wcs.third.workbinWcs.dto.*; import com.shkj.wcs.vo.WcsResponseVo; import com.shkj.wcs.domain.BusinDataTask; import lombok.RequiredArgsConstructor; @@ -19,6 +25,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,6 +39,12 @@ public class WcsTaskController { @Autowired private IBusinDataTaskService iBusinDataTaskService; + @Autowired + private RCSUtil rcsUtil; + + @Autowired + private WCSUtil wcsUtil; + /** * wz-wcs任务下发 @@ -66,10 +79,34 @@ public class WcsTaskController { businDataTask.setFromSide(fromBinCode); businDataTask.setToSide(toBinCode); businDataTask.setCreateTime(DateUtils.getNowDate()); - businDataTask.setPriority(priority); + if (!priority.isEmpty()){ + businDataTask.setPriority(priority); + } boolean save = iBusinDataTaskService.save(businDataTask); if (save) { //调用下游接口下任务 + log.info("任务储存成功!"); + RcsCreateTaskDto rcsCreateTaskDto = new RcsCreateTaskDto(); + rcsCreateTaskDto.setTaskType(RCSTaskTypeEnum.PF_LMR_COMMON.getValue()); + rcsCreateTaskDto.setRobotTaskCode(businDataTask.getTaskCode()); + if(!businDataTask.getPriority().isEmpty()){ + rcsCreateTaskDto.setInitPriority(Integer.parseInt(businDataTask.getPriority())); + } + List rcsIdLists =new ArrayList<>(); + for (int i = 1;i<=2;i++){ + RcsIdList rcsIdList =new RcsIdList(); + if(i==1){ + rcsIdList.setType("ZONE"); + rcsIdList.setCode(businDataTask.getFromSide()); + rcsIdList.setOperation(RCSOperation.OT_COLLECT.getValue()); + } + rcsIdList.setType("ZONE"); + rcsIdList.setCode(businDataTask.getToSide()); + rcsIdList.setOperation(RCSOperation.OT_DELIVERY.getValue()); + rcsIdLists.add(rcsIdList); + } + + //Result result = rcsUtil.rcsCreateTask(rcsCreateTaskDto); } } else if (dataChange.equals("2")) { @@ -89,23 +126,59 @@ public class WcsTaskController { } - @Log(title = "查询库区状态", businessType = BusinessType.UPDATE) - @PostMapping("/toWzWcs/queryAreaStatus") + @Log(title = "查询是否存在出库任务测试接口", businessType = BusinessType.UPDATE) + @PostMapping("/toWzWcs/queryTaskStatus") @RepeatSubmit - public WcsResponseVo queryAreaStatus(WcsCreateTaskDto dto) { - if (dto != null) { - String businessType = dto.getHeader().getBusinessType(); - if(businessType.equals("queryAreaStatus")){ - - } - List body = dto.getBody(); - if (!body.isEmpty()) { + public WcsResponseVo queryTaskStatus(WCSQueryTaskStatusBody body) { + WcsResponseVo vo = wcsUtil.queryTaskStatus(body); + return vo; + } - } + @Log(title = "查询每个库区状态测试接口", businessType = BusinessType.UPDATE) + @PostMapping("/toKjWcs/queryAreaStatus") + @RepeatSubmit + public WcsResponseVo queryAreaStatus(WCSQueryAreaStatusDto dto) { + //调用plc接口 暂时不用 + WCSQueryAreaStatusDto wcsQueryAreaStatusDto = new WCSQueryAreaStatusDto(); + List areaStatusBodyList = new ArrayList<>(); + String[] areaCodes = {"SC-A2", "SC-B2", "SC-C2", "SC-D2"}; + + int[] statusValues = {0, 1, 1, 1}; + + for (int i = 0; i < 4; i++) { + WCSQueryAreaStatusBody queryAreaStatusBody = new WCSQueryAreaStatusBody(); + queryAreaStatusBody.setAreaInLocation(areaCodes[i]); + queryAreaStatusBody.setStatus(statusValues[i]); + areaStatusBodyList.add(queryAreaStatusBody); } - return WcsResponseVo.success(); + + wcsQueryAreaStatusDto.setBody(areaStatusBodyList); + return WcsResponseVo.success(wcsQueryAreaStatusDto); + } + + + @Log(title = "任务状态上报测试接口", businessType = BusinessType.UPDATE) + @PostMapping("/toWzWcs/uploadWCSTaskStatus") + @RepeatSubmit + public WcsResponseVo uploadWCSTaskStatus(UploadWCSTaskStatusDto dto) { + //调用plc接口 暂时不用 + WcsResponseVo vo = wcsUtil.uploadWCSTaskStatus(dto); + return vo; + } + + + @Log(title = "扫码处入库申请", businessType = BusinessType.UPDATE) + @PostMapping("/toWzWcs/wcsIncomingTaskRequest") + @RepeatSubmit + public WcsResponseVo wcsIncomingTaskRequest(WcsIncomingTaskRequestDto dto) { + //调用plc接口 暂时不用 + WcsResponseVo vo = wcsUtil.wcsIncomingTaskRequest(dto); + return vo; } + + + } diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsCreateTaskDto.java b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsCreateTaskDto.java index d5d18fa..7f1bd5c 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsCreateTaskDto.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsCreateTaskDto.java @@ -1,5 +1,6 @@ package com.shkj.wcs.third.rcs.dto; +import cn.hutool.core.date.DateTime; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; @@ -41,29 +42,55 @@ import java.util.List; public class RcsCreateTaskDto implements Serializable { - /** - * 地图 id - */ - private Integer mapId; /** * 任务类型:23 含义:从 A 点顶起托盘搬运至 B 点放下 * 任务类型:24 含义:从 A 点顶起托盘搬运至 B 点不放下 * 任务类型:25 含义:在负载情况下将 AGV 移动至目标点并放下 */ - private Integer taskType; + private String taskType; + + + /** + * 优先级 + */ + private Integer initPriority; + + /** + * 任务截止时间 + */ + private DateTime deadline; + + /** + * 指定机器人 + */ + private String robotType; + + /** + * + */ + private String[] robotCode; + /** - * 任务id 任务 id,唯一标识(不能重复) + * 能否打断 */ - private String taskId; + private Integer interrupt; + /** - * 不提供该字段或者为 0 时将由 RCS 自动分配 + * 任务编号 */ - private String robotId; + private String robotTaskCode; + + /** + * 任务组编号 + */ + private String groupCode; /** * 目标点集合,如从 A 点搬运到 B 点需要提供两个目标点 注意 只有2个 第一个是 起点信息 第二个是目标点 */ - private List targets; + private List targetRoute; + + } diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsIdList.java b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsIdList.java index 940c437..d653a4a 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsIdList.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/dto/RcsIdList.java @@ -18,12 +18,26 @@ import java.io.Serializable; public class RcsIdList implements Serializable { /** - * 库位编号(字符串,格式不限) + * 目标路径序列(从0开始) */ - private String id; + private Integer seq; /** - * 目标货架角度 暂时用不到 + * 目标类型 */ - private Integer angle; + private String type; + + /** + * 目标编号 + */ + + private String code; + + /** + * 到达后操作 (COLLECT 取货,DELIVERY 送货,ROTATE 旋转) + */ + private String operation; + + + private String robotType; } diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSOperation.java b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSOperation.java new file mode 100644 index 0000000..0508152 --- /dev/null +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSOperation.java @@ -0,0 +1,19 @@ +package com.shkj.wcs.third.rcs.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 到达后的操作 + */ +@Getter +@AllArgsConstructor +public enum RCSOperation { + + OT_COLLECT("COLLECT","取货"), + OT_DELIVERY("DELIVERY","送货"), + OT_ROTATE("ROTATE","旋转"); + + private String value; + private String desc; +} diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSTaskTypeEnum.java b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSTaskTypeEnum.java index 3491e45..1425250 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSTaskTypeEnum.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/rcs/enums/RCSTaskTypeEnum.java @@ -17,11 +17,13 @@ public enum RCSTaskTypeEnum { * 任务类型:24 含义:从 A 点顶起托盘搬运至 B 点不放下 * #任务类型:25 含义:在负载情况下将 AGV 移动至目标点并放下 */ - A_TO_B_AND_PUT(23, "从 A 点顶起托盘搬运至 B 点放下"), - A_TO_B_NO_PUT(24, "从 A 点顶起托盘搬运至 B 点不放下"), +/* A_TO_B_AND_PUT(23, "从 A 点顶起托盘搬运至 B 点放下"), + A_TO_B_NO_PUT(24, "从 A 点顶起托盘搬运至 B 点不放下"),*/ + + PF_LMR_COMMON("PF-LMR-COMMON","搬运,一至数个执行步骤"); // A_TO_B_GOODS_MOVE(25, "在负载情况下将 AGV 移动至目标点并放下"), ; - private Integer value; + private String value; private String desc; } diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java index 4c543a1..0e09e66 100644 --- a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/WCSUtil.java @@ -63,7 +63,7 @@ public class WCSUtil { * @param dto * @return */ - public WcsResponseVo queryTaskStatus(WcsIncomingTrayCheckBody dto) { + public WcsResponseVo queryTaskStatus(WCSQueryTaskStatusBody dto) { Map headerMap = new HashMap<>(1); headerMap.put("businessType", "trayCheck"); String json = JSONObject.toJSONString(dto); diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusBody.java b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusBody.java new file mode 100644 index 0000000..90dc270 --- /dev/null +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusBody.java @@ -0,0 +1,17 @@ +package com.shkj.wcs.third.workbinWcs.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WCSQueryAreaStatusBody implements Serializable { + + private String areaInLocation; + + private Integer status; +} diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusDto.java b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusDto.java new file mode 100644 index 0000000..7c0120e --- /dev/null +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryAreaStatusDto.java @@ -0,0 +1,20 @@ +package com.shkj.wcs.third.workbinWcs.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *查询库区状态实体 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WCSQueryAreaStatusDto implements Serializable { + + private WcsCreateTaskHeader header; + private List body; +} diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryTaskStatusBody.java b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryTaskStatusBody.java new file mode 100644 index 0000000..4fcbbf7 --- /dev/null +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WCSQueryTaskStatusBody.java @@ -0,0 +1,19 @@ +package com.shkj.wcs.third.workbinWcs.dto; + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WCSQueryTaskStatusBody implements Serializable { + + private String taskType; + + private String trayType; + + private String destination; +} diff --git a/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsQueryTaskStatusDto.java b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsQueryTaskStatusDto.java new file mode 100644 index 0000000..f7d98ca --- /dev/null +++ b/shkj-wms/src/main/java/com/shkj/wcs/third/workbinWcs/dto/WcsQueryTaskStatusDto.java @@ -0,0 +1,21 @@ +package com.shkj.wcs.third.workbinWcs.dto; + + +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *生产区入库校验实体 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WcsQueryTaskStatusDto implements Serializable { + + private WcsCreateTaskHeader header; + private List body; +}