From 3c45d4f9f3aba5bc85a9577e43c0dffc71b93a22 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 10 七月 2025 15:54:27 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/OpenController.java |   70 ++++++++++++++++++++++++++++------
 1 files changed, 57 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index fed6c93..a207073 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -7,20 +7,22 @@
 import com.zy.asrs.domain.enums.NotifyMsgType;
 import com.zy.asrs.domain.param.*;
 import com.zy.asrs.entity.ApiLog;
+import com.zy.asrs.entity.DeviceConfig;
 import com.zy.asrs.entity.LocMast;
+import com.zy.asrs.entity.WrkMast;
 import com.zy.asrs.service.ApiLogService;
+import com.zy.asrs.service.DeviceConfigService;
 import com.zy.asrs.service.LocMastService;
+import com.zy.asrs.service.WrkMastService;
 import com.zy.asrs.utils.NotifyUtils;
 import com.zy.common.annotations.OpenApiLog;
 import com.zy.common.service.CommonService;
 import com.zy.core.cache.SlaveConnection;
 import com.zy.core.dispatcher.ShuttleDispatchUtils;
 import com.zy.core.enums.SlaveType;
-import com.zy.core.model.ForkLiftSlave;
-import com.zy.core.model.ShuttleSlave;
+import com.zy.core.enums.WrkIoType;
 import com.zy.core.model.protocol.ForkLiftProtocol;
 import com.zy.core.model.protocol.ShuttleProtocol;
-import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.ForkLiftThread;
 import com.zy.core.thread.ShuttleThread;
 import lombok.extern.slf4j.Slf4j;
@@ -44,11 +46,13 @@
     @Autowired
     private NotifyUtils notifyUtils;
     @Autowired
-    private SlaveProperties slaveProperties;
-    @Autowired
     private ApiLogService apiLogService;
     @Autowired
     private LocMastService locMastService;
+    @Autowired
+    private WrkMastService wrkMastService;
+    @Autowired
+    private DeviceConfigService deviceConfigService;
 
     @PostMapping("/createMoveTask")
     @OpenApiLog(memo = "灏忚溅绉诲姩浠诲姟")
@@ -233,8 +237,10 @@
         HashMap<String, Object> map = new HashMap<>();
         //鑾峰彇灏忚溅鏁版嵁
         ArrayList<ShuttleProtocol> shuttleProtocols = new ArrayList<>();
-        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
-            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
+        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
+        for (DeviceConfig device : shuttleList) {
+            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
             if (shuttleThread == null) {
                 continue;
             }
@@ -248,8 +254,10 @@
 
         //鑾峰彇璐у弶鎻愬崌鏈烘暟鎹�
         ArrayList<ForkLiftProtocol> forkLiftProtocols = new ArrayList<>();
-        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
-            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
+        List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
+        for (DeviceConfig device : forkLiftList) {
+            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
             if (forkLiftThread == null) {
                 continue;
             }
@@ -337,8 +345,8 @@
 
         apiLogService.insert(new ApiLog(
                 null
-                , "鑾峰彇鎸囧畾搴撲綅淇℃伅"
-                , "/getLocInformation"
+                , "鑾峰彇鍏ㄩ儴搴撲綅淇℃伅"
+                , "/getAllLocInformation"
                 , null
                 , null
                 , null
@@ -362,8 +370,8 @@
 
         apiLogService.insert(new ApiLog(
                 null
-                , "鑾峰彇鎸囧畾搴撲綅淇℃伅"
-                , "/getLocInformation"
+                , "灏忚溅闆嗗悎"
+                , "/shuttleGather"
                 , null
                 , null
                 , null
@@ -380,6 +388,42 @@
         return R.ok().add(shuttleGather);
     }
 
+    @PostMapping("/queryTask")
+    @OpenApiLog(memo = "鏌ヨ浠诲姟")
+    public R queryTask(@RequestBody QueryTaskParam param) {
+        EntityWrapper<WrkMast> wrapper = new EntityWrapper<>();
+        if(param.getTaskNo() != null) {
+            wrapper.eq("wms_wrk_no", param.getTaskNo());
+        }
+
+        if(param.getTaskType() != null) {
+            WrkIoType ioType = WrkIoType.get(param.getTaskType());
+            if(ioType == null) {
+                return R.error("浠诲姟绫诲瀷涓嶅瓨鍦�");
+            }
+            wrapper.eq("io_type", ioType.id);
+        }
+        List<WrkMast> wrkMasts = wrkMastService.selectList(wrapper);
+        apiLogService.insert(new ApiLog(
+                null
+                , "鏌ヨ浠诲姟"
+                , "/queryTask"
+                , null
+                , null
+                , null
+                , null
+                , JSON.toJSONString(wrkMasts)
+                , null
+                , null
+                , 1
+                , new Date()
+                , null
+                , null
+        ));
+
+        return R.ok().add(wrkMasts);
+    }
+
     @GetMapping("/test")
     public R test() {
         notifyUtils.notify("task", 1, "9999", "W9999", NotifyMsgType.SHUTTLE_MOVING, "data");

--
Gitblit v1.9.1