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/common/utils/ForkLiftUtils.java | 45 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/ForkLiftUtils.java b/src/main/java/com/zy/common/utils/ForkLiftUtils.java
index fd005e4..fed6942 100644
--- a/src/main/java/com/zy/common/utils/ForkLiftUtils.java
+++ b/src/main/java/com/zy/common/utils/ForkLiftUtils.java
@@ -4,13 +4,13 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.SpringUtils;
+import com.zy.asrs.entity.DeviceConfig;
+import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
-import com.zy.core.model.ForkLiftSlave;
import com.zy.core.model.protocol.ForkLiftStaProtocol;
-import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ForkLiftThread;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
@@ -33,23 +33,52 @@
}
for (ForkLiftStaProtocol forkLiftStaProtocol : forkLiftThread.getForkLiftStaProtocols()) {
- list.add(forkLiftStaProtocol.getStaNo());
+ list.add(forkLiftStaProtocol.getSiteId());
+ }
+
+ return list;
+ }
+
+ //鑾峰彇鎻愬崌鏈烘墍缁戝畾鐨勮緭閫佺嚎鎵�鏈夌珯鐐�
+ public static List<Integer> getConveyorBindLiftAllStaNo(Integer liftNo) {
+ List<Integer> list = new ArrayList<>();
+ ConfigService configService = SpringUtils.getBean(ConfigService.class);
+ if (configService == null) {
+ return list;
+ }
+
+ Config conveyorLiftBindConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "conveyorLiftBind"));
+ if(conveyorLiftBindConfig == null) {
+ return list;
+ }
+
+ List<JSONObject> val = JSON.parseArray(conveyorLiftBindConfig.getValue(), JSONObject.class);
+ if (val.isEmpty()) {
+ return list;
+ }
+
+ for (JSONObject data : val) {
+ if(data.getInteger("liftNo").equals(liftNo)) {
+ list.add(data.getInteger("staNo"));
+ }
}
return list;
}
//鑾峰彇鎻愬崌鏈虹珯鐐�
- public static ForkLiftStaProtocol getLiftStaByStaNo(Integer staNo) {
- SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
- for (ForkLiftSlave liftSlave : slaveProperties.getForkLift()) {
- ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftSlave.getId());
+ public static ForkLiftStaProtocol getLiftStaByStaNo(Integer siteId) {
+ DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
+ 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) {
return null;
}
for (ForkLiftStaProtocol forkLiftStaProtocol : forkLiftThread.getForkLiftStaProtocols()) {
- if (forkLiftStaProtocol.getStaNo().equals(staNo)) {
+ if (forkLiftStaProtocol.getSiteId().equals(siteId)) {
return forkLiftStaProtocol;
}
}
--
Gitblit v1.9.1