From 7635dc25bd2a4d565df496b2d96354639966768d Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 25 九月 2025 11:09:44 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java | 16 ++++++++++++----
1 files changed, 12 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 3fb997c..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;
}
@@ -72,6 +76,10 @@
continue;//鍏呯數涓紝鏃犻渶閫氱煡
}
+ if (shuttleProtocol.getBatteryPower() == null) {
+ continue;
+ }
+
if (Integer.parseInt(shuttleProtocol.getBatteryPower()) < shuttlePowerEarlyValue) {
buffer.append(shuttleProtocol.getShuttleNo()).append("鍙峰皬杞︼紝鐢甸噺").append(shuttleProtocol.getBatteryPower()).append("锛岃娉ㄦ剰銆俓n");
hasReport = true;
--
Gitblit v1.9.1