From ce9c9af4a3710d17e17814bab629ab4ef474f3f1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 09 七月 2025 11:16:51 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java b/src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java
index e6bcffd..deedfc0 100644
--- a/src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java
+++ b/src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java
@@ -3,12 +3,13 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.zy.asrs.entity.DeviceConfig;
+import com.zy.asrs.service.DeviceConfigService;
 import com.zy.common.utils.HttpHandler;
 import com.zy.core.cache.SlaveConnection;
 import com.zy.core.enums.SlaveType;
 import com.zy.core.model.ShuttleSlave;
 import com.zy.core.model.protocol.ShuttleProtocol;
-import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.ShuttleThread;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
@@ -18,6 +19,7 @@
 import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
+import java.util.List;
 
 /**
  * 灏忚溅鐢甸噺棰勮妫�娴� => 寮哄埗棰勮
@@ -29,7 +31,7 @@
     @Autowired
     private ConfigService configService;
     @Autowired
-    private SlaveProperties slaveProperties;
+    private DeviceConfigService deviceConfigService;
 
     /**
      * 灏忚溅鐢甸噺棰勮妫�娴� => 寮哄埗棰勮
@@ -57,8 +59,10 @@
         buffer.append("銆愰�氱煡銆戝洓鍚戝簱\n");//娑堟伅鏍囬
 
         boolean hasReport = false;//鏄惁鏈夐渶瑕佹姤鍛婄殑鏁版嵁
-        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;
             }

--
Gitblit v1.9.1