From 990b97bf3e6e9362faa1830fd0c600d54370efd5 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期六, 19 十月 2024 15:07:49 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/controller/OpenController.java | 16 +++++
src/main/java/com/zy/asrs/entity/param/WcsTaskListParam.java | 33 +++++++++++
src/main/java/com/zy/asrs/entity/param/WcsRgvListParam.java | 20 ++++++
src/main/java/com/zy/asrs/entity/param/WcsDataSynchronizationParam.java | 19 ++++++
src/main/java/com/zy/core/model/protocol/RgvProtocol.java | 5 +
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 63 +++++++++++++++++++--
src/main/java/com/zy/asrs/service/OpenService.java | 2
7 files changed, 151 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index 025bc5b..f3f6a82 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -56,6 +56,22 @@
return openService.wcsTaskDistribution(param);
}
+ /**
+ * 鏁版嵁鍚屾
+ */
+ @PostMapping("/status/cs/default/v1")
+ @AppAuth(memo = "WCS鏁版嵁鍚屾")
+ public synchronized R wcsTaskStatus(@RequestHeader(required = false) String appkey,
+ @RequestBody Long timestamp,
+ HttpServletRequest request) {
+ auth(appkey, timestamp, request);
+ if (Cools.isEmpty(timestamp)) {
+ return R.parse(BaseRes.PARAM);
+ }
+
+ return openService.wcsTaskStatus(timestamp);
+ }
+
private void auth(String appkey, Object obj, HttpServletRequest request) {
log.info("{}鎺ュ彛琚闂紱appkey:{}锛涜姹傛暟鎹細{}", "open/sensorType/list/auth/v1", appkey, JSON.toJSONString(obj));
diff --git a/src/main/java/com/zy/asrs/entity/param/WcsDataSynchronizationParam.java b/src/main/java/com/zy/asrs/entity/param/WcsDataSynchronizationParam.java
new file mode 100644
index 0000000..48d2632
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/WcsDataSynchronizationParam.java
@@ -0,0 +1,19 @@
+package com.zy.asrs.entity.param;
+
+import com.zy.asrs.entity.WrkMast;
+import com.zy.asrs.utils.TimeCalculatorUtils;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * Created by Monkey D. Luffy on 2023.07.19
+ * */
+@Data
+public class WcsDataSynchronizationParam {
+ private List<WcsTaskListParam> taskList; // 鏄� 瀛楃涓� 宸ヤ綔鍙�
+ private List<WcsRgvListParam> rgvList; // 鏄� 瀛楃涓� 浣滀笟鏃堕暱
+ private Long timestamp; // 鏄� 瀛楃涓� 浣滀笟灏忚溅缂栧彿
+
+}
diff --git a/src/main/java/com/zy/asrs/entity/param/WcsRgvListParam.java b/src/main/java/com/zy/asrs/entity/param/WcsRgvListParam.java
new file mode 100644
index 0000000..4edf992
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/WcsRgvListParam.java
@@ -0,0 +1,20 @@
+package com.zy.asrs.entity.param;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * Created by Monkey D. Luffy on 2023.07.19
+ * */
+@Data
+public class WcsRgvListParam {
+ private String taskNo; // 鏄� 瀛楃涓� 浣滀笟灏忚溅缂栧彿
+ private String rgvNo; // 鏄� 瀛楃涓� 浣滀笟灏忚溅缂栧彿
+ private String status; // 鏄� 瀛楃涓� 浠诲姟鐘舵�� 1锛氬垵濮� 2锛氫綔涓氫腑 3锛氬畬鎴�
+ private String currSta = ""; // 鏄� 瀛楃涓� 缁撴潫鏃堕棿锛堟牸寮忥細yyyy--MM-dd HH:mm:ss)
+ private List<String> error = new ArrayList<>(); // 鏄� 瀛楃涓� 寮傚父淇℃伅锛堝鏃犲紓甯稿垯涓虹┖鏁扮粍锛�
+
+ public WcsRgvListParam(){}
+}
diff --git a/src/main/java/com/zy/asrs/entity/param/WcsTaskListParam.java b/src/main/java/com/zy/asrs/entity/param/WcsTaskListParam.java
new file mode 100644
index 0000000..285a9be
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/param/WcsTaskListParam.java
@@ -0,0 +1,33 @@
+package com.zy.asrs.entity.param;
+
+import com.zy.asrs.entity.WrkMast;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * Created by Monkey D. Luffy on 2023.07.19
+ * */
+@Data
+public class WcsTaskListParam {
+
+ private String taskNo; // 鏄� 瀛楃涓� 宸ヤ綔鍙�
+ private String rgvNo; // 鏄� 瀛楃涓� 浣滀笟灏忚溅缂栧彿
+ private String startSta; // 鏄� 瀛楃涓� 璧峰浣滀笟绔欙紙鐜┛锛�
+ private String endSta; // 鏄� 瀛楃涓� 鐩爣浣滀笟绔欙紙鐜┛锛�
+ private Integer status; // 鏄� 瀛楃涓� 浠诲姟鐘舵�� 1锛氬垵濮� 2锛氫綔涓氫腑 3锛氬畬鎴�
+ private List<String> error = new ArrayList<>(); // 鏄� 瀛楃涓� 寮傚父淇℃伅锛堝鏃犲紓甯稿垯涓虹┖鏁扮粍锛�
+
+
+ public WcsTaskListParam(){}
+
+ public WcsTaskListParam(WrkMast wrkMast){
+ this.taskNo = wrkMast.getWrkNo().toString();
+ this.rgvNo = wrkMast.getRgvNo().toString();
+ this.startSta = wrkMast.getSourceStaNo().toString();
+ this.endSta = wrkMast.getStaNo().toString();
+ this.status = wrkMast.getWrkSts().intValue();
+ this.error.add(wrkMast.getErrorMemo());
+ }
+}
diff --git a/src/main/java/com/zy/asrs/service/OpenService.java b/src/main/java/com/zy/asrs/service/OpenService.java
index 1d360aa..d545a1e 100644
--- a/src/main/java/com/zy/asrs/service/OpenService.java
+++ b/src/main/java/com/zy/asrs/service/OpenService.java
@@ -10,7 +10,7 @@
/**
*
*/
- List<String> queryStock();
+ R wcsTaskStatus(Long timestamp) ;
R wcsTaskDistribution(WcsTaskDistributionParam param);
diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 356576c..8185b8a 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -3,15 +3,27 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.R;
+import com.zy.asrs.domain.param.RingThroughParam;
import com.zy.asrs.entity.WrkMast;
+import com.zy.asrs.entity.param.WcsDataSynchronizationParam;
+import com.zy.asrs.entity.param.WcsRgvListParam;
import com.zy.asrs.entity.param.WcsTaskDistributionParam;
+import com.zy.asrs.entity.param.WcsTaskListParam;
import com.zy.asrs.service.OpenService;
import com.zy.asrs.service.WrkMastService;
+import com.zy.asrs.utils.Utils;
+import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.RgvSlave;
+import com.zy.core.model.protocol.RgvProtocol;
+import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.RgvThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -22,14 +34,11 @@
@Service
public class OpenServiceImpl implements OpenService {
+
+ @Autowired
+ private SlaveProperties slaveProperties;
@Autowired
private WrkMastService wrkMastService;
-
- @Override
- @Transactional
- public List<String> queryStock() {
- return null;
- }
@Override
@Transactional
@@ -51,4 +60,46 @@
return R.ok();
}
+ @Override
+ @Transactional
+ public R wcsTaskStatus(Long timestamp) {
+ try{
+ WcsDataSynchronizationParam wcsDataSynchronizationParam = new WcsDataSynchronizationParam();
+ List<WcsTaskListParam> wcsTaskListParamList = new ArrayList<>();
+ List<WcsRgvListParam> wcsRgvListParamList = new ArrayList<>();
+ List<WrkMast> wrkMastList = wrkMastService.selectList(new EntityWrapper<>());
+ for (WrkMast wrkMast : wrkMastList){
+ WcsTaskListParam wcsTaskListParam = new WcsTaskListParam(wrkMast);
+ wcsTaskListParamList.add(wcsTaskListParam);
+ }
+ for (RgvSlave rgv : slaveProperties.getRgv()) {
+ // 鑾峰彇RGV淇℃伅
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId());
+ if (rgvThread == null) {
+ continue;
+ }
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ continue;
+ }
+ WcsRgvListParam wcsRgvListParam = new WcsRgvListParam();
+ wcsRgvListParam.setRgvNo(rgv.getId().toString());
+ wcsRgvListParam.setTaskNo(Cools.isEmpty(rgvProtocol.getTaskNo1()) ? null:rgvProtocol.getTaskNo1().toString());
+ wcsRgvListParam.setStatus(rgvProtocol.statusType.desc);
+ List<String> arrayList = new ArrayList<>();
+ if (rgvProtocol.getAlarm()!=0){
+ arrayList.add(rgvProtocol.getAlarm$());
+ }
+ wcsRgvListParam.setError(arrayList);
+ wcsRgvListParamList.add(wcsRgvListParam);
+ }
+ wcsDataSynchronizationParam.setTaskList(wcsTaskListParamList);
+ wcsDataSynchronizationParam.setRgvList(wcsRgvListParamList);
+ wcsDataSynchronizationParam.setTimestamp(timestamp);
+ return R.ok().add(wcsDataSynchronizationParam);
+ } catch (Exception e){
+ return R.error("寮傚父").add("寮傚父淇℃伅锛�"+e);
+ }
+ }
+
}
diff --git a/src/main/java/com/zy/core/model/protocol/RgvProtocol.java b/src/main/java/com/zy/core/model/protocol/RgvProtocol.java
index d3aee88..4f7df3b 100644
--- a/src/main/java/com/zy/core/model/protocol/RgvProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/RgvProtocol.java
@@ -207,4 +207,9 @@
return RgvPos.intValue();
}
+ public String getAlarm$(){
+ //闇�瑕佹牴鎹幇鍦烘敼閫� 鏍规嵁璇诲埌鐨勫�艰幏鍙栧搴旂珯鐐逛綅缃�
+ return null;
+ }
+
}
--
Gitblit v1.9.1