From 64c076641c56b857fa78f6d9401f070591094569 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期五, 27 二月 2026 15:18:59 +0800
Subject: [PATCH] lsh#wcs2.0交互下发
---
rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionStepTypeEnum.java | 33 +++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WcsConstant.java | 9
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionTaskIssueParam.java | 119 ++++++++++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsWcsService.java | 6
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java | 21 +
rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/MissionTaskIssueParam.java | 148 +++++++++++++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionSystemCodeEnum.java | 24 ++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java | 2
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionWcsTaskIssueParam.java | 80 +++++++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/MissionTransferStationController.java | 48 +++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/TaskTypeEnum.java | 8
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsWcsServiceImpl.java | 120 ++++++++++
rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionActionTypeEnum.java | 21 +
13 files changed, 612 insertions(+), 27 deletions(-)
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/MissionTransferStationController.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/MissionTransferStationController.java
index 4e51c61..eff2d5f 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/MissionTransferStationController.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/MissionTransferStationController.java
@@ -1,9 +1,15 @@
package com.vincent.rsf.openApi.controller;
+import com.vincent.rsf.framework.common.Cools;
+import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
+import com.vincent.rsf.openApi.entity.params.MissionTaskIssueParam;
+import com.vincent.rsf.openApi.enums.MissionSystemCodeEnum;
+import com.vincent.rsf.openApi.service.WmsWcsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -15,13 +21,43 @@
@RequestMapping("/mission")
public class MissionTransferStationController {
+ @Autowired
+ private WmsWcsService wmsWcsService;
+
@ApiOperation("浠诲姟鎬绘帶")
@PostMapping("/task/master/control")
- public CommonResponse missionMasterControl(@RequestBody Object objParams) {
- System.out.println("111");
- //鍒ゆ柇闇�瑕佷笅鍙戠郴缁�
- //鍒ゆ柇涓嬪彂鏂瑰紡
- //杩斿洖缁撴灉
- return CommonResponse.ok();
+ public CommonResponse missionMasterControl(@RequestBody MissionTaskIssueParam param) {
+ try{
+ if (Cools.isEmpty(param)){
+ return CommonResponse.error("鍙傛暟涓虹┖锛侊紒锛�");
+ }
+ //鍒ゆ柇闇�瑕佷笅鍙戠郴缁�
+ if (param.getSystemCode().equals(MissionSystemCodeEnum.MISSION_SYSTEM_CODE_ENUM_HK_RCS_YZ_5.type)){
+ //杞捣搴蜂笅鍙戠▼搴�
+// R r = wmsWcsService.issueTaskWcs(param);
+// if (!r.get("code").equals(200)){
+// return CommonResponse.error(""+r.get("msg"));
+// }
+ } else if (param.getSystemCode().equals(MissionSystemCodeEnum.MISSION_SYSTEM_CODE_ENUM_ZY_WCS_TWO.type)){
+ //杞瑆cs涓嬪彂绋嬪簭
+ R r = wmsWcsService.issueTaskWcs(param);
+ if (!r.get("code").equals(200)){
+ return CommonResponse.error(""+r.get("msg"));
+ }
+ } else if (param.getSystemCode().equals(MissionSystemCodeEnum.MISSION_SYSTEM_CODE_ENUM_WEIGHING_YZ_5.type)){
+ //杞О閲�
+// R r = wmsWcsService.issueTaskWcs(param);
+// if (!r.get("code").equals(200)){
+// return CommonResponse.error(""+r.get("msg"));
+// }
+ } else {
+ return CommonResponse.error("鏈煡绯荤粺绫诲瀷");
+ }
+ //鍒ゆ柇涓嬪彂鏂瑰紡
+ //杩斿洖缁撴灉
+ return CommonResponse.ok();
+ } catch (Exception e){
+ return CommonResponse.error(e.getMessage());
+ }
}
}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WcsConstant.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WcsConstant.java
index 9dbeb5a..e1c8266 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WcsConstant.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WcsConstant.java
@@ -2,8 +2,13 @@
public class WcsConstant {
- public static String pubTask = "/openapi/createInTask";
+ public static String createInTask = "/wcs/openapi/createInTask";//鍏ュ簱浠诲姟鐢宠
- public static String syncLocs = "/api/open/loc/sync";
+ public static String createOutTask = "/wcs/openapi/createOutTask";//鍑哄簱浠诲姟涓嬪彂
+
+ public static String createLocMoveTask = "/wcs/openapi/createLocMoveTask";//绉诲簱浠诲姟涓嬪彂
+ public static String STA_TO_STA = "/wcs/openapi/createLocMoveTask";//绉诲簱浠诲姟涓嬪彂
+
+ public static String syncLocs = "/wcs/api/open/loc/sync";
}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionTaskIssueParam.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionTaskIssueParam.java
new file mode 100644
index 0000000..c102448
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionTaskIssueParam.java
@@ -0,0 +1,119 @@
+package com.vincent.rsf.openApi.entity.params;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class MissionTaskIssueParam {
+
+ /**
+ * WMS浠诲姟鍙�
+ */
+ private String taskNo;
+ private String barcode;//鏉$爜
+ private Integer taskPri;//浼樺厛绾�
+
+ /*
+ * 绫诲瀷锛氬嚭搴撱�佸叆搴撱�佺Щ搴撱�佺珯鍒扮珯
+ * */
+ private String type;
+
+ /**
+ * 璧风偣缂栫爜
+ */
+ private String sourceCode;
+
+ /**
+ * 缁堢偣缂栫爜
+ */
+ private String targetCode;
+
+ /**
+ * 瀛愮郴缁熺紪鐮�
+ */
+ private String systemCode;
+
+ /**
+ * 瀛愮郴缁熷悕绉�
+ */
+ private String systemName;
+
+ /**
+ * 姝ラ绫诲瀷锛歊EQUEST-璇锋眰, RESPONSE-鍝嶅簲, VALIDATE-鏍¢獙, TRANSFORM-杞崲
+ */
+ private String stepType;
+
+ /**
+ * 鍔ㄤ綔绫诲瀷锛欻TTP_CALL, RPC_CALL, MQ_SEND, DB_OPERATION
+ */
+ private String actionType;
+
+
+ /**
+ * 鍏宠仈flow_instance.id
+ */
+ private Long flowInstanceId;
+
+ /**
+ * 娴佺▼瀹炰緥缂栧彿
+ */
+ private String flowInstanceNo;
+
+ /**
+ * 姝ラ椤哄簭
+ */
+ private Integer stepOrder;
+
+ /**
+ * 姝ラ缂栫爜
+ */
+ private String stepCode;
+
+ /**
+ * 姝ラ鍚嶇О
+ */
+ private String stepName;
+
+ /**
+ * 姝ラ妯℃澘ID
+ */
+ private Long stepTemplateId;
+
+ /**
+ * 鐘舵�侊細0-鎺掗槦涓� 1-寰呮墽琛� 2-鎵ц涓� 3-鎵ц鎴愬姛 4-鎵ц澶辫触 5-宸茶烦杩� 6-宸插彇娑�
+ */
+ private Short status;
+
+ /**
+ * 鎵ц缁撴灉
+ */
+ private String executeResult;
+
+ /**
+ * 閿欒鐮�
+ */
+ private String errorCode;
+
+ /**
+ * 閿欒淇℃伅
+ */
+ private String errorMessage;
+
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ private Date startTime;
+
+ /**
+ * 鎵ц鑰楁椂(绉�)
+ */
+ private Integer durationSeconds;
+
+ /**
+ * 姝ラ閲嶈瘯娆℃暟
+ */
+ private Integer retryTimes;
+
+}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionWcsTaskIssueParam.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionWcsTaskIssueParam.java
new file mode 100644
index 0000000..f21e82b
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/MissionWcsTaskIssueParam.java
@@ -0,0 +1,80 @@
+package com.vincent.rsf.openApi.entity.params;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class MissionWcsTaskIssueParam {
+
+ //绉诲簱 **********************************************************************
+ /**
+ * WMS浠诲姟鍙� 宸ヤ綔鍙�
+ */
+ private String taskNo;
+ /*
+ * 婧愬簱浣�
+ * */
+ private String sourceLocNo;
+ /*
+ * 鐩爣搴撲綅
+ * */
+ private String locNo;
+
+ /*
+ * 浠诲姟浼樺厛绾�
+ * */
+ private Integer taskPri = 1;
+
+ //鍑哄簱 **********************************************************************
+// /**
+// * WMS浠诲姟鍙� 宸ヤ綔鍙�
+// */
+// private String taskNo;
+
+// /*
+// * 鍑哄簱搴撲綅
+// * */
+// private String locNo;
+
+// /*
+// * 浠诲姟浼樺厛绾�
+// * */
+// private String taskPri;
+ /*
+ * 鐩爣绔欙紙浼樺厛绾ч珮浜庡嚭搴撳尯鍩燂級
+ * */
+ private Integer staNo;
+ /*
+ * 鍑哄簱鍖哄煙
+ * */
+ private String outArea;
+ /*
+ * 鍑哄簱鎵规鍙�
+ * */
+ private String batch;
+ /*
+ * 鍑哄簱椤哄簭鍙�
+ * */
+ private Integer batchSeq;
+
+ //鍏ュ簱 **********************************************************************
+// /**
+// * WMS浠诲姟鍙� 宸ヤ綔鍙�
+// */
+// private String taskNo;
+// /*
+// * 搴撲綅鍙�
+// * */
+// private String locNo;
+
+ // /*
+// * 浠诲姟浼樺厛绾�
+// * */
+// private String taskPri;
+ /*
+ * 鏉$爜
+ * */
+ private String barcode;
+
+}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionActionTypeEnum.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionActionTypeEnum.java
new file mode 100644
index 0000000..8110d37
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionActionTypeEnum.java
@@ -0,0 +1,21 @@
+package com.vincent.rsf.openApi.enums;
+
+/**
+ * @author Ryan
+ * @version 1.0
+ * @title TaskType
+ * @description
+ * @create 2025/3/29 17:02
+ */
+public enum MissionActionTypeEnum {
+ MISSION_ACTION_TYPE_ENUM_HTTP_CALL("HTTP_CALL", "HTTP_CALL"),
+ MISSION_ACTION_TYPE_ENUM_NO_EXECUTE("NO_EXECUTE", "NO_EXECUTE"),
+ ;
+ public String type;
+ public String desc;
+
+ MissionActionTypeEnum(String type, String desc) {
+ this.type = type;
+ this.desc = desc;
+ }
+}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionStepTypeEnum.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionStepTypeEnum.java
new file mode 100644
index 0000000..8cc6732
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionStepTypeEnum.java
@@ -0,0 +1,33 @@
+package com.vincent.rsf.openApi.enums;
+
+/**
+ * @author Ryan
+ * @version 1.0
+ * @title TaskType
+ * @description
+ * @create 2025/3/29 17:02
+ */
+public enum MissionStepTypeEnum {
+ MISSION_STEP_TYPE_RESPONSE("RESPONSE", "鍝嶅簲"),
+ MISSION_STEP_TYPE_RECEIVE("RECEIVE", "鎺ユ敹"),
+
+ MISSION_STEP_TYPE_RECEIVE_BIN("RECEIVE_BIN", "鎺ユ敹-瑙g粦"),
+
+ MISSION_STEP_TYPE_REQUEST("REQUEST", "璇锋眰"),
+ MISSION_STEP_TYPE_UNBIND("UNBIND", "瑙g粦"),
+ MISSION_STEP_TYPE_BIND("BIND", "缁戝畾"),
+ MISSION_STEP_TYPE_OBTAIN("OBTAIN", "鑾峰彇"),
+ MISSION_STEP_TYPE_NO_EXECUTE("NO_EXECUTE", "瓒婅繃"),
+
+ MISSION_STEP_TYPE_VALIDATE("VALIDATE", "鏍¢獙"),
+ MISSION_STEP_TYPE_TRANSFORM("TRANSFORM", "杞崲"),
+ ;
+ public String type;
+ public String desc;
+
+ MissionStepTypeEnum(String type, String desc) {
+ this.type = type;
+ this.desc = desc;
+ }
+
+}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionSystemCodeEnum.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionSystemCodeEnum.java
new file mode 100644
index 0000000..3dc5985
--- /dev/null
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/MissionSystemCodeEnum.java
@@ -0,0 +1,24 @@
+package com.vincent.rsf.openApi.enums;
+
+/**
+ * @author Ryan
+ * @version 1.0
+ * @title TaskType
+ * @description
+ * @create 2025/3/29 17:02
+ */
+public enum MissionSystemCodeEnum {
+ MISSION_SYSTEM_CODE_ENUM_ZY_WCS_TWO("ZY_WCS_TWO", "涓壃WCS2.0"),
+ MISSION_SYSTEM_CODE_ENUM_HK_RCS_YZ_5("HK_RCS_YZ_5", "閾跺骇浜旀湡瀵规帴娴峰悍RCS"),
+
+ MISSION_SYSTEM_CODE_ENUM_WEIGHING_YZ_5("WEIGHING_YZ_5", "閾跺骇浜旀湡绉伴噸"),
+ MISSION_SYSTEM_CODE_ENUM_NO_EXECUTE("NO_EXECUTE", "涓嶆墽琛�"),
+ ;
+ public String type;
+ public String desc;
+
+ MissionSystemCodeEnum(String type, String desc) {
+ this.type = type;
+ this.desc = desc;
+ }
+}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/TaskTypeEnum.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/TaskTypeEnum.java
index 27e93d9..ccea273 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/TaskTypeEnum.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/enums/TaskTypeEnum.java
@@ -14,13 +14,13 @@
TASK_TYPE_ENUM_STA("STA_TO_STA", "绔欑偣闂存惉杩�")
;
+ public String code;
+
+ public String desc;
+
TaskTypeEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
-
- private String code;
-
- private String desc;
}
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsWcsService.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsWcsService.java
index 5859885..73eb294 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsWcsService.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsWcsService.java
@@ -3,13 +3,11 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.openApi.entity.Loc;
-import com.vincent.rsf.openApi.entity.params.WcsChangeLocParam;
-import com.vincent.rsf.openApi.entity.params.WcsCreateInTaskParam;
-import com.vincent.rsf.openApi.entity.params.WcsReassignLocParam;
-import com.vincent.rsf.openApi.entity.params.WcsTaskReportParam;
+import com.vincent.rsf.openApi.entity.params.*;
public interface WmsWcsService extends IService<Loc> {
+ R issueTaskWcs(MissionTaskIssueParam params);
R wcsCreateInTask(WcsCreateInTaskParam params);
R wcsTaskReport(WcsTaskReportParam params);
R wcsReassignLoc(WcsReassignLocParam params);
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
index 52daba3..2a09944 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsRcsServiceImpl.java
@@ -100,7 +100,7 @@
@Transactional(rollbackFor = Exception.class)
public CommonResponse pubTasksWcs(RcsPubTaskParams params) {
/**WCS鍩虹閰嶇疆閾炬帴*/
- String rcsUrl = wcsApi.getHost() + ":" + wcsApi.getPort() + WcsConstant.pubTask;
+ String rcsUrl = wcsApi.getHost() + ":" + wcsApi.getPort() + WcsConstant.createInTask;
log.info("WCS浠诲姟涓嬪彂锛岃姹傚湴鍧�锛� {}锛� 璇锋眰鍙傛暟锛� {}", rcsUrl , JSONObject.toJSONString(params));
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
diff --git a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsWcsServiceImpl.java b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsWcsServiceImpl.java
index 851687b..ace00bd 100644
--- a/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsWcsServiceImpl.java
+++ b/rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsWcsServiceImpl.java
@@ -9,12 +9,13 @@
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.openApi.config.PlatformProperties;
import com.vincent.rsf.openApi.entity.Loc;
+import com.vincent.rsf.openApi.entity.constant.WcsConstant;
import com.vincent.rsf.openApi.entity.constant.WmsConstant;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
-import com.vincent.rsf.openApi.entity.params.WcsChangeLocParam;
-import com.vincent.rsf.openApi.entity.params.WcsCreateInTaskParam;
-import com.vincent.rsf.openApi.entity.params.WcsReassignLocParam;
-import com.vincent.rsf.openApi.entity.params.WcsTaskReportParam;
+import com.vincent.rsf.openApi.entity.params.*;
+import com.vincent.rsf.openApi.enums.MissionActionTypeEnum;
+import com.vincent.rsf.openApi.enums.MissionStepTypeEnum;
+import com.vincent.rsf.openApi.enums.TaskTypeEnum;
import com.vincent.rsf.openApi.mapper.LocMapper;
import com.vincent.rsf.openApi.service.WmsWcsService;
import lombok.extern.slf4j.Slf4j;
@@ -38,12 +39,121 @@
private PlatformProperties.WmsApi wmsApi;
@Autowired
+ private PlatformProperties.WcsApi wcsApi;
+
+ @Autowired
private RestTemplate restTemplate;
/**
* @author Munch D. Luffy
* @date 2026/01/09
- * @description: 浠诲姟涓嬪彂
+ * @description: 浠诲姟涓嬪彂锛堟寚浠や笅鍙戯級
+ * @version 1.0
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R issueTaskWcs(MissionTaskIssueParam param) {
+ if (param.getActionType().equals(MissionActionTypeEnum.MISSION_ACTION_TYPE_ENUM_HTTP_CALL.type)){
+ return issueTaskWcsHttp(param);
+ }
+ return R.error();
+ }
+
+ /**
+ * @author Munch D. Luffy
+ * @date 2026/01/09
+ * @description: 浠诲姟涓嬪彂锛堟寚浠や笅鍙�,HTTP鏂瑰紡锛�
+ * @version 1.0
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public R issueTaskWcsHttp(MissionTaskIssueParam param) {
+ if (param.getStepType().equals(MissionStepTypeEnum.MISSION_STEP_TYPE_REQUEST.type)){
+ return issueTaskWcsHttpREQUEST(param);
+ } else if (param.getStepType().equals(MissionStepTypeEnum.MISSION_STEP_TYPE_UNBIND.type)){
+ return issueTaskWcsHttpREQUEST(param);//寰呭畬鍠�
+ } else if (param.getStepType().equals(MissionStepTypeEnum.MISSION_STEP_TYPE_BIND.type)){
+ return issueTaskWcsHttpREQUEST(param);//寰呭畬鍠�
+ } else if (param.getStepType().equals(MissionStepTypeEnum.MISSION_STEP_TYPE_OBTAIN.type)){
+ return issueTaskWcsHttpREQUEST(param);//寰呭畬鍠�
+ } else if (param.getStepType().equals(MissionStepTypeEnum.MISSION_STEP_TYPE_NO_EXECUTE.type)){
+ return issueTaskWcsHttpREQUEST(param);//寰呭畬鍠�
+ }
+ return R.error();
+ }
+
+ /**
+ * @author Munch D. Luffy
+ * @date 2026/01/09
+ * @description: 浠诲姟涓嬪彂锛堟寚浠や笅鍙�,HTTP鏂瑰紡锛�
+ * @version 1.0
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public R issueTaskWcsHttpREQUEST(MissionTaskIssueParam param) {
+ try{
+ String wcsUrl = wcsApi.getHost() + ":" + wcsApi.getPort();
+ MissionWcsTaskIssueParam missionWcsTaskIssueParam = new MissionWcsTaskIssueParam();
+ if (param.getType().equals(TaskTypeEnum.TASK_TYPE_ENUM_IN.code)){
+ wcsUrl = wcsUrl + WcsConstant.createInTask;
+ missionWcsTaskIssueParam.setTaskNo(param.getTaskNo());
+ missionWcsTaskIssueParam.setLocNo(param.getTargetCode());
+ missionWcsTaskIssueParam.setBarcode(param.getBarcode());
+ missionWcsTaskIssueParam.setTaskPri(param.getTaskPri());
+
+ } else if (param.getType().equals(TaskTypeEnum.TASK_TYPE_ENUM_OUT.code)){
+ wcsUrl = wcsUrl + WcsConstant.createOutTask;
+ missionWcsTaskIssueParam.setTaskNo(param.getTaskNo());
+ missionWcsTaskIssueParam.setLocNo(param.getSourceCode());
+ missionWcsTaskIssueParam.setTaskPri(param.getTaskPri());
+ missionWcsTaskIssueParam.setStaNo(Integer.parseInt(param.getTargetCode()));//鐩爣绔�
+ missionWcsTaskIssueParam.setOutArea("");//鐩爣鍖哄煙
+ missionWcsTaskIssueParam.setBatch("");//鍑哄簱鎵规鍙�
+ missionWcsTaskIssueParam.setBatchSeq(1);//鍑哄簱椤哄簭鍙�
+ } else if (param.getType().equals(TaskTypeEnum.TASK_TYPE_ENUM_TRANSFER.code)){
+ wcsUrl = wcsUrl + WcsConstant.createLocMoveTask;
+ missionWcsTaskIssueParam.setTaskNo(param.getTaskNo());
+ missionWcsTaskIssueParam.setSourceLocNo(param.getSourceCode());
+ missionWcsTaskIssueParam.setLocNo(param.getTargetCode());
+ missionWcsTaskIssueParam.setTaskPri(param.getTaskPri());
+ } else if (param.getType().equals(TaskTypeEnum.TASK_TYPE_ENUM_STA.code)){
+ wcsUrl = wcsUrl + WcsConstant.STA_TO_STA;
+ missionWcsTaskIssueParam.setTaskNo(param.getTaskNo());
+ }
+ /**WMS鍩虹閰嶇疆閾炬帴*/
+ log.info("鍏ュ簱浠诲姟鐢宠锛岃姹傚湴鍧�锛� {}锛� 璇锋眰鍙傛暟锛� {}", wcsUrl , JSONObject.toJSONString(param));
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Type", "application/json");
+ headers.add("api-version", "v2.0");
+ HttpEntity httpEntity = new HttpEntity(param, headers);
+ ResponseEntity<String> exchange = restTemplate.exchange(wcsUrl, HttpMethod.POST, httpEntity, String.class);
+ log.info("WCS浠诲姟鐢宠锛屽搷搴旂粨鏋滐細 {}", exchange);
+ if (Objects.isNull(exchange.getBody())) {
+ return R.error().add("涓嬪彂Wcs杩斿洖鍙傛暟涓虹┖锛侊紒锛�");
+ } else {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.coercionConfigDefaults()
+ .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
+ try {
+ CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
+ if (result.getCode() == 200) {
+ return R.ok(result.getMsg()).add(result.getData());
+ } else {
+ return R.error(result.getMsg());
+// throw new CoolException("浠诲姟鎵ц鐘舵�佷笂鎶ュけ璐ワ紒锛�");
+ }
+ } catch (JsonProcessingException e) {
+// throw new CoolException(e.getMessage());
+ }
+ }
+ } catch (Exception e){
+ log.error(e.getMessage(),e);
+ }
+ return R.error();
+ }
+
+ /**
+ * @author Munch D. Luffy
+ * @date 2026/01/09
+ * @description: 浠诲姟涓嬪彂锛堣鍔ㄦ帴鏀讹級
* @version 1.0
*/
@Override
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/MissionTaskIssueParam.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/MissionTaskIssueParam.java
new file mode 100644
index 0000000..7f53ad0
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/entity/params/MissionTaskIssueParam.java
@@ -0,0 +1,148 @@
+package com.vincent.rsf.server.api.entity.params;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.vincent.rsf.server.system.entity.FlowStepInstance;
+import com.vincent.rsf.server.system.entity.FlowStepTemplate;
+import com.vincent.rsf.server.system.entity.SubsystemFlowTemplate;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class MissionTaskIssueParam {
+
+ /**
+ * WMS浠诲姟鍙�
+ */
+ private String taskNo;
+
+ /*
+ * 绫诲瀷锛氬嚭搴撱�佸叆搴撱�佺Щ搴撱�佺珯鍒扮珯
+ * */
+ private String type;
+
+ /**
+ * 璧风偣缂栫爜
+ */
+ private String sourceCode;
+
+ /**
+ * 缁堢偣缂栫爜
+ */
+ private String targetCode;
+
+ /**
+ * 瀛愮郴缁熺紪鐮�
+ */
+ private String systemCode;
+
+ /**
+ * 瀛愮郴缁熷悕绉�
+ */
+ private String systemName;
+
+ /**
+ * 姝ラ绫诲瀷锛歊EQUEST-璇锋眰, RESPONSE-鍝嶅簲, VALIDATE-鏍¢獙, TRANSFORM-杞崲
+ */
+ private String stepType;
+
+ /**
+ * 鍔ㄤ綔绫诲瀷锛欻TTP_CALL, RPC_CALL, MQ_SEND, DB_OPERATION
+ */
+ private String actionType;
+
+
+ /**
+ * 鍏宠仈flow_instance.id
+ */
+ private Long flowInstanceId;
+
+ /**
+ * 娴佺▼瀹炰緥缂栧彿
+ */
+ private String flowInstanceNo;
+
+ /**
+ * 姝ラ椤哄簭
+ */
+ private Integer stepOrder;
+
+ /**
+ * 姝ラ缂栫爜
+ */
+ private String stepCode;
+
+ /**
+ * 姝ラ鍚嶇О
+ */
+ private String stepName;
+
+ /**
+ * 姝ラ妯℃澘ID
+ */
+ private Long stepTemplateId;
+
+ /**
+ * 鐘舵�侊細0-鎺掗槦涓� 1-寰呮墽琛� 2-鎵ц涓� 3-鎵ц鎴愬姛 4-鎵ц澶辫触 5-宸茶烦杩� 6-宸插彇娑�
+ */
+ private Short status;
+
+ /**
+ * 鎵ц缁撴灉
+ */
+ private String executeResult;
+
+ /**
+ * 閿欒鐮�
+ */
+ private String errorCode;
+
+ /**
+ * 閿欒淇℃伅
+ */
+ private String errorMessage;
+
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ private Date startTime;
+
+ /**
+ * 鎵ц鑰楁椂(绉�)
+ */
+ private Integer durationSeconds;
+
+ /**
+ * 姝ラ閲嶈瘯娆℃暟
+ */
+ private Integer retryTimes;
+
+ public MissionTaskIssueParam() {}
+
+ public MissionTaskIssueParam(FlowStepInstance flowStepInstance, SubsystemFlowTemplate subsystemFlowTemplate, FlowStepTemplate flowStepTemplate ) {
+ this.taskNo = flowStepInstance.getTaskNo();
+ this.systemCode = subsystemFlowTemplate.getSystemCode();
+ this.systemName = subsystemFlowTemplate.getSystemName();
+ this.stepType = flowStepTemplate.getStepType();
+ this.actionType = flowStepTemplate.getActionType();
+
+ this.flowInstanceId = flowStepInstance.getFlowInstanceId();
+ this.flowInstanceNo = flowStepInstance.getFlowInstanceNo();
+ this.stepOrder = flowStepInstance.getStepOrder();
+ this.stepCode = flowStepInstance.getStepCode();
+ this.stepName = flowStepInstance.getStepName();
+ this.stepType = flowStepInstance.getStepType();
+ this.stepTemplateId = flowStepInstance.getStepTemplateId();
+ this.status = flowStepInstance.getStatus();
+ this.executeResult = flowStepInstance.getExecuteResult();
+ this.errorCode = flowStepInstance.getErrorCode();
+ this.errorMessage = flowStepInstance.getErrorMessage();
+ this.startTime = flowStepInstance.getStartTime();
+ this.durationSeconds = flowStepInstance.getDurationSeconds();
+ this.retryTimes = flowStepInstance.getRetryTimes();
+ }
+}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
index 9896868..1861750 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -15,6 +15,7 @@
import com.vincent.rsf.server.api.config.RemotesInfoProperties;
import com.vincent.rsf.server.api.entity.CommonResponse;
import com.vincent.rsf.server.api.entity.constant.RcsConstant;
+import com.vincent.rsf.server.api.entity.params.MissionTaskIssueParam;
import com.vincent.rsf.server.api.entity.params.TaskItemParam;
import com.vincent.rsf.server.api.entity.params.WcsTaskParams;
import com.vincent.rsf.server.api.utils.LocUtils;
@@ -28,10 +29,7 @@
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.entity.*;
import com.vincent.rsf.server.system.service.ConfigService;
-import com.vincent.rsf.server.system.service.impl.FlowInstanceServiceImpl;
-import com.vincent.rsf.server.system.service.impl.FlowStepInstanceServiceImpl;
-import com.vincent.rsf.server.system.service.impl.TaskInstanceNodeServiceImpl;
-import com.vincent.rsf.server.system.service.impl.TaskInstanceServiceImpl;
+import com.vincent.rsf.server.system.service.impl.*;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import com.vincent.rsf.server.system.utils.SystemAuthUtils;
import lombok.extern.slf4j.Slf4j;
@@ -107,6 +105,10 @@
private TaskInstanceNodeServiceImpl taskInstanceNodeService;
@Autowired
private TaskInstanceServiceImpl taskInstanceService;
+ @Autowired
+ private SubsystemFlowTemplateServiceImpl subsystemFlowTemplateService;
+ @Autowired
+ private FlowStepTemplateServiceImpl flowStepTemplateService;
/**
@@ -168,6 +170,15 @@
throw new CoolException(e.getMessage());
}
} else {
+ SubsystemFlowTemplate subsystemFlowTemplate = subsystemFlowTemplateService.getById(flowInstance.getFlowTemplateId());
+ FlowStepTemplate flowStepTemplate = flowStepTemplateService.getById(flowStepInstance.getStepTemplateId());
+
+ MissionTaskIssueParam missionTaskIssueParam = new MissionTaskIssueParam(flowStepInstance,subsystemFlowTemplate,flowStepTemplate);
+
+ missionTaskIssueParam.setType(RcsTaskType.getTypeDesc(task.getTaskType()));
+
+ missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode());
+ missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode());
/**浠诲姟涓嬪彂鎺ュ彛*/
String pubTakUrl = wmsOpenApi.getHost() + ":" + wmsOpenApi.getPort() + RcsConstant.MISSION_TRANSFER_STATION;
@@ -176,7 +187,7 @@
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("api-version", "v2.0");
- HttpEntity httpEntity = new HttpEntity(flowStepInstance, headers);
+ HttpEntity httpEntity = new HttpEntity(missionTaskIssueParam, headers);
ResponseEntity<String> exchange = restTemplate.exchange(pubTakUrl, HttpMethod.POST, httpEntity, String.class);
log.info("浠诲姟涓嬪彂鍚庯紝鍝嶅簲缁撴灉锛� {}", exchange);
if (Objects.isNull(exchange.getBody())) {
--
Gitblit v1.9.1