From 2d2fd991826837d7189cc488aee6f309a6f5e216 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 09 三月 2026 22:48:46 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/OpenController.java |   59 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 46 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 abc031f..9bbe2f5 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -1,6 +1,6 @@
 package com.zy.asrs.controller;
 
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.core.common.Cools;
 import com.core.common.R;
 import com.core.exception.CoolException;
@@ -36,6 +36,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Slf4j
 @RestController
@@ -150,13 +151,13 @@
         return R.error("浠诲姟鍙栨秷澶辫触");
     }
 
-    @RequestMapping("/deviceStatus")
+    @PostMapping("/deviceStatus")
     // @OpenApiLog(memo = "鑾峰彇璁惧鐘舵��")
     public R getDeviceStatus() {
         HashMap<String, Object> map = new HashMap<>();
         // 鑾峰彇鍫嗗灈鏈烘暟鎹�
         ArrayList<CrnProtocol> crnProtocols = new ArrayList<>();
-        List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+        List<DeviceConfig> crnList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                 .eq("device_type", String.valueOf(SlaveType.Crn)));
         for (DeviceConfig device : crnList) {
             CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, device.getDeviceNo());
@@ -173,7 +174,7 @@
 
         // 鑾峰彇RGV鏁版嵁
         ArrayList<RgvProtocol> rgvProtocols = new ArrayList<>();
-        List<DeviceConfig> rgvList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+        List<DeviceConfig> rgvList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                 .eq("device_type", String.valueOf(SlaveType.Rgv)));
         for (DeviceConfig device : rgvList) {
             RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, device.getDeviceNo());
@@ -190,7 +191,7 @@
 
         // 鑾峰彇鍙屽伐浣嶅爢鍨涙満鏁版嵁
         ArrayList<DualCrnProtocol> dualCrnProtocols = new ArrayList<>();
-        List<DeviceConfig> dualCrnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+        List<DeviceConfig> dualCrnList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                 .eq("device_type", String.valueOf(SlaveType.DualCrn)));
         for (DeviceConfig device : dualCrnList) {
             DualCrnThread dualCrnThread = (DualCrnThread) SlaveConnection.get(SlaveType.DualCrn, device.getDeviceNo());
@@ -207,7 +208,7 @@
 
         // 鑾峰彇杈撻�佺珯鐐规暟鎹�
         ArrayList<StationProtocol> stationProtocols = new ArrayList<>();
-        List<DeviceConfig> stationList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+        List<DeviceConfig> stationList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                 .eq("device_type", String.valueOf(SlaveType.Devp)));
         for (DeviceConfig device : stationList) {
             StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, device.getDeviceNo());
@@ -227,6 +228,38 @@
         map.put("dualCrnList", dualCrnProtocols);
         map.put("stationList", stationProtocols);
         return R.ok().add(map);
+    }
+
+    @PostMapping("/stationStatus")
+    public R getStationStatus(@RequestBody GetStationStatusParam param) {
+        // 鑾峰彇杈撻�佺珯鐐规暟鎹�
+        List<StationProtocol> stationProtocols = new ArrayList<>();
+        List<DeviceConfig> devpList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
+                .eq("device_type", String.valueOf(SlaveType.Devp))
+        );
+        for (DeviceConfig device : devpList) {
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, device.getDeviceNo());
+            if (stationThread == null) {
+                continue;
+            }
+
+            List<StationProtocol> tmp = new ArrayList<>();
+            if(param.getStationIds() == null || param.getStationIds().isEmpty()) {
+                tmp.addAll(stationThread.getStatus());
+            }else {
+                Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
+                for (Integer stationId : param.getStationIds()) {
+                    StationProtocol stationProtocol = statusMap.get(stationId);
+                    if (stationProtocol == null) {
+                        continue;
+                    }
+                    tmp.add(stationProtocol);
+                }
+            }
+            stationProtocols.addAll(tmp);
+        }
+
+        return R.ok().add(stationProtocols);
     }
 
     @PostMapping("/getLocInformation")
@@ -251,7 +284,7 @@
     @OpenApiLog(memo = "鑾峰彇鍏ㄩ儴搴撲綅淇℃伅")
     public R getAllLocInformation(@RequestBody GetAllLocInformationParam param) {
         List<HashMap<String, Object>> list = new ArrayList<>();
-        EntityWrapper<LocMast> wrapper = new EntityWrapper<>();
+        QueryWrapper<LocMast> wrapper = new QueryWrapper<>();
 
         if (!Cools.isEmpty(param.getRow())) {
             wrapper.eq("row1", param.getRow());
@@ -261,7 +294,7 @@
             wrapper.eq("lev1", param.getLev());
         }
 
-        List<LocMast> locMasts = locMastService.selectList(wrapper);
+        List<LocMast> locMasts = locMastService.list(wrapper);
         if (locMasts.isEmpty()) {
             return R.ok().add(list);
         }
@@ -283,7 +316,7 @@
     @PostMapping("/queryTask")
     @OpenApiLog(memo = "鏌ヨ浠诲姟")
     public R queryTask(@RequestBody QueryTaskParam param) {
-        EntityWrapper<WrkMast> wrapper = new EntityWrapper<>();
+        QueryWrapper<WrkMast> wrapper = new QueryWrapper<>();
         if (param.getTaskNo() != null) {
             wrapper.eq("wms_wrk_no", param.getTaskNo());
         }
@@ -295,7 +328,7 @@
             }
             wrapper.eq("io_type", ioType.id);
         }
-        List<WrkMast> wrkMasts = wrkMastService.selectList(wrapper);
+        List<WrkMast> wrkMasts = wrkMastService.list(wrapper);
         return R.ok().add(wrkMasts);
     }
 
@@ -318,7 +351,7 @@
         if (mainProcessPlugin.contains("Fake")) {
             map.put("running", false);
             map.put("isFake", true);
-            Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake"));
+            Config config = configService.getOne(new QueryWrapper<Config>().eq("code", "enableFake"));
             if (config != null) {
                 if (config.getValue().equals("Y")) {
                     map.put("running", true);
@@ -333,7 +366,7 @@
     @PostMapping("/startFakeSystem")
     @OpenApiLog(memo = "鍚姩浠跨湡妯℃嫙")
     public R startFakeSystem() {
-        Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake"));
+        Config config = configService.getOne(new QueryWrapper<Config>().eq("code", "enableFake"));
         if (config != null) {
             config.setValue("Y");
             configService.updateById(config);
@@ -344,7 +377,7 @@
     @PostMapping("/stopFakeSystem")
     @OpenApiLog(memo = "鍋滄浠跨湡妯℃嫙")
     public R stopFakeSystem() {
-        Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake"));
+        Config config = configService.getOne(new QueryWrapper<Config>().eq("code", "enableFake"));
         if (config != null) {
             config.setValue("N");
             configService.updateById(config);

--
Gitblit v1.9.1