From 0d04bc5d8080b82338302fba0a59fccff2eaedfc Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 06 七月 2025 11:28:29 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java |   35 +++++------------------------------
 1 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java
index f7e64ab..d96a34b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/ShuttleController.java
@@ -2,13 +2,13 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.common.R;
+import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
-import com.zy.asrs.wcs.rcs.entity.DeviceType;
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
 import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
 import com.zy.asrs.wcs.rcs.service.DeviceService;
-import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
+import com.zy.asrs.wcs.rcs.service.ShuttleService;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
 import com.zy.asrs.wcs.system.controller.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,45 +24,20 @@
     @Autowired
     private DeviceService deviceService;
     @Autowired
-    private DeviceTypeService deviceTypeService;
+    private ShuttleService shuttleService;
 
     @GetMapping("/shuttle/status/list")
     public R getShuttleStatusList() {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, getHostId())
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)));
-        if (deviceType == null) {
-            return R.error("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
-
-        ArrayList<ShuttleProtocol> data = new ArrayList<>();
-        List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
-                .eq(Device::getHostId, getHostId())
-                .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId()));
-        for (Device device : list) {
-            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
-            ShuttleProtocol status = shuttleThread.getStatus();
-            data.add(status);
-        }
+        List<ShuttleProtocol> data = shuttleService.getShuttleStatusList(getHostId());
         return R.ok().add(data);
     }
 
     @GetMapping("/shuttle/status/one/{deviceNo}")
     public R getShuttleStatus(@PathVariable String deviceNo) {
-        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
-                .eq(DeviceType::getHostId, getHostId())
-                .eq(DeviceType::getStatus, 1)
-                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)));
-        if (deviceType == null) {
-            return R.error("璁惧绫诲瀷涓嶅瓨鍦�");
-        }
-
         Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
                 .eq(Device::getHostId, getHostId())
                 .eq(Device::getStatus, 1)
-                .eq(Device::getDeviceType, deviceType.getId())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                 .eq(Device::getDeviceNo, deviceNo));
 
         ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());

--
Gitblit v1.9.1