From f653130e5df936041f7a5ae005e10c91415b64b1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 10 七月 2025 15:54:33 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  299 ++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 174 insertions(+), 125 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 7e57f62..67ccf13 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -17,10 +17,8 @@
 import com.zy.core.cache.SlaveConnection;
 import com.zy.core.dispatcher.ShuttleDispatchUtils;
 import com.zy.core.enums.*;
-import com.zy.core.model.*;
 import com.zy.core.model.command.*;
 import com.zy.core.model.protocol.*;
-import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.*;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
@@ -38,8 +36,6 @@
 @Service("mainService")
 public class MainServiceImpl {
 
-    @Autowired
-    private SlaveProperties slaveProperties;
     @Autowired
     private WrkMastService wrkMastService;
     @Autowired
@@ -76,6 +72,8 @@
     private NotifyUtils notifyUtils;
     @Autowired
     private BasShuttleChargeService basShuttleChargeService;
+    @Autowired
+    private DeviceConfigService deviceConfigService;
 
     /**
      * 鍒濆鍖栧疄鏃跺湴鍥�
@@ -309,6 +307,23 @@
                 return false;
             }
 
+            List<WrkMast> shuttleMoveList = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+                    .eq("io_type", 200)
+            );
+            for (WrkMast moveWrkMast : shuttleMoveList) {
+                if(Utils.getLev(moveWrkMast.getLocNo()) != Utils.getLev(wrkMast.getSourceLocNo())) {
+                    continue;
+                }
+
+                if(Utils.getLev(moveWrkMast.getLocNo()) == Utils.getLev(moveWrkMast.getSourceLocNo())) {
+                    continue;
+                }
+
+                //瀛樺湪鎹㈠眰浠诲姟锛屽嚭搴撲换鍔℃殏鏃朵笉鎵ц
+                News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽瓨鍦ㄦ崲灞備换鍔★紝鍑哄簱浠诲姟绛夊緟涓�", wrkMast.getWrkNo());
+                return false;
+            }
+
             boolean checkLocPathIsAvailable = navigateUtils.checkLocPathIsAvailable(wrkMast.getSourceLocNo(), liftSta.getLocNo());
             if(!checkLocPathIsAvailable) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屾湭璁$畻鍒板彲鎵ц璺緞锛岀瓑寰呬腑", wrkMast.getWrkNo());
@@ -421,9 +436,11 @@
      */
     public synchronized void shuttleFinished() {
         try {
-            for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
+            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, shuttle.getId());
+                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
                 ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
                 if (shuttleProtocol == null) {
                     continue;
@@ -676,6 +693,29 @@
                 return false;
             }
 
+            //妫�娴嬫ゼ灞傛槸鍚︽湁鍙敤绌挎杞�
+            boolean checkLevHasShuttle = Utils.checkLevHasShuttle(liftSta.getLev());
+            if (!checkLevHasShuttle) {
+                if (wrkMast.getShuttleNo() != null) {
+                    return false;
+                }
+
+                //鑾峰彇灏忚溅寰呮満浣�
+                String standbyLocNo = Utils.getShuttleStandbyLocNo(liftSta.getLocNo());
+                if (standbyLocNo == null) {
+                    News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛岃幏鍙栧皬杞﹀緟鏈轰綅澶辫触", wrkMast.getWrkNo());
+                    return false;
+                }
+
+                //璋冨害灏忚溅鍘诲緟鏈轰綅
+                boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), standbyLocNo);
+                if (!dispatchShuttle) {
+                    News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛岃皟搴﹀皬杞﹀け璐�", wrkMast.getWrkNo());
+                    return false;
+                }
+                return false;
+            }
+
             Integer liftNo = wrkMast.getLiftNo();
             if (liftNo == null) {
                 //鏈垎閰嶆彁鍗囨満
@@ -714,29 +754,6 @@
                 return false;
             }
 
-            //妫�娴嬫ゼ灞傛槸鍚︽湁鍙敤绌挎杞�
-            boolean checkLevHasShuttle = Utils.checkLevHasShuttle(liftSta.getLev());
-            if (!checkLevHasShuttle) {
-                if (wrkMast.getShuttleNo() != null) {
-                    return false;
-                }
-
-                //鑾峰彇灏忚溅寰呮満浣�
-                String standbyLocNo = Utils.getShuttleStandbyLocNo(liftSta.getLocNo());
-                if (standbyLocNo == null) {
-                    News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛岃幏鍙栧皬杞﹀緟鏈轰綅澶辫触", wrkMast.getWrkNo());
-                    return false;
-                }
-
-                //璋冨害灏忚溅鍘诲緟鏈轰綅
-                boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), standbyLocNo);
-                if (!dispatchShuttle) {
-                    News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛岃皟搴﹀皬杞﹀け璐�", wrkMast.getWrkNo());
-                    return false;
-                }
-                return false;
-            }
-
             //璇锋眰涓婄骇绯荤粺锛屾槸鍚﹀厑璁稿叆搴�
             boolean inMission = ForkLiftUtils.queryInMission(wrkMast.getSourceStaNo(), liftSta.getLiftNo(), wrkMast.getWmsWrkNo());
             if (!inMission) {
@@ -745,9 +762,9 @@
             }
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            List<ForkLiftCommand> liftCommands = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), wrkMast.getSourceStaNo(), liftSta.getLev());
+            ForkLiftCommand liftCommand = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), wrkMast.getSourceStaNo(), liftSta.getLev());
             ArrayList<ForkLiftCommand> commands = new ArrayList<>();
-            commands.addAll(liftCommands);
+            commands.add(liftCommand);
 
             //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
             LiftAssignCommand assignCommand = new LiftAssignCommand();
@@ -873,9 +890,9 @@
             }
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            List<ForkLiftCommand> liftCommands = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), liftSta.getLev(), wrkMast.getStaNo());
+            ForkLiftCommand liftCommand = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), liftSta.getLev(), wrkMast.getStaNo());
             ArrayList<ForkLiftCommand> commands = new ArrayList<>();
-            commands.addAll(liftCommands);
+            commands.add(liftCommand);
 
             //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
             LiftAssignCommand assignCommand = new LiftAssignCommand();
@@ -902,9 +919,14 @@
      */
     public synchronized void forkLiftFinished() {
         try {
-            for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
+            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, forkLiftSlave.getId());
+                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
+                if(forkLiftThread == null) {
+                    continue;
+                }
                 ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
                 if (forkLiftProtocol == null) {
                     continue;
@@ -974,9 +996,11 @@
      */
     private void recShuttleErr() {
         Date now = new Date();
-        for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
+        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, shuttleSlave.getId());
+            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
             if (shuttleThread == null) {
                 continue;
             }
@@ -987,7 +1011,7 @@
 
             if (shuttleProtocol.getTaskNo() != 0) {
                 //鏈変换鍔�
-                BasShuttleErrLog latest = basShuttleErrLogService.findLatestByTaskNo(shuttleSlave.getId(), shuttleProtocol.getTaskNo());
+                BasShuttleErrLog latest = basShuttleErrLogService.findLatestByTaskNo(device.getDeviceNo(), shuttleProtocol.getTaskNo());
                 // 鏈夊紓甯�
                 if (latest == null) {
                     if (shuttleProtocol.getErrorCode() != null && Integer.parseInt(shuttleProtocol.getErrorCode()) != 0) {
@@ -1005,7 +1029,7 @@
                                 null,    // 缁撴潫鏃堕棿
                                 wrkMast.getWrkSts(),    // 宸ヤ綔鐘舵��
                                 wrkMast.getIoType(),    // 鍏ュ嚭搴撶被鍨�
-                                shuttleSlave.getId(),    // 鍥涘悜绌挎杞�
+                                device.getDeviceNo(),    // 鍥涘悜绌挎杞�
                                 null,    // plc
                                 wrkMast.getLocNo(),    // 鐩爣搴撲綅
                                 wrkMast.getStaNo(),    // 鐩爣绔�
@@ -1023,7 +1047,7 @@
                                 JSON.toJSONString(shuttleProtocol)    // 绯荤粺鐘舵�佹暟鎹�
                         );
                         if (!basShuttleErrLogService.insert(basShuttleErrLog)) {
-                            News.error("鍥涘悜绌挎杞lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", shuttleSlave.getId(), errName);
+                            News.error("鍥涘悜绌挎杞lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", device.getDeviceNo(), errName);
                         }
                     }
                 } else {
@@ -1033,7 +1057,7 @@
                         latest.setUpdateTime(now);
                         latest.setStatus(2);
                         if (!basShuttleErrLogService.updateById(latest)) {
-                            News.error("鍥涘悜绌挎杞lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", shuttleSlave.getId(), latest.getId());
+                            News.error("鍥涘悜绌挎杞lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", device.getDeviceNo(), latest.getId());
                         }
                     }
                 }
@@ -1046,9 +1070,11 @@
      */
     private void recLiftErr() {
         Date now = new Date();
-        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
+        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, forkLiftSlave.getId());
+            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
             if (forkLiftThread == null) {
                 continue;
             }
@@ -1059,7 +1085,7 @@
 
             if (forkLiftProtocol.getTaskNo() != 0) {
                 //鏈変换鍔�
-                BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(forkLiftSlave.getId(), forkLiftProtocol.getTaskNo());
+                BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(device.getDeviceNo(), forkLiftProtocol.getTaskNo());
                 // 鏈夊紓甯�
                 if (latest == null) {
                     if (forkLiftProtocol.getErrorCode() != null && forkLiftProtocol.getErrorCode() != 0) {
@@ -1078,7 +1104,7 @@
                                 null,    // 缁撴潫鏃堕棿
                                 wrkMast.getWrkSts(),    // 宸ヤ綔鐘舵��
                                 wrkMast.getIoType(),    // 鍏ュ嚭搴撶被鍨�
-                                forkLiftSlave.getId(),    // 鎻愬崌鏈�
+                                device.getDeviceNo(),    // 鎻愬崌鏈�
                                 null,    // plc
                                 wrkMast.getLocNo(),    // 鐩爣搴撲綅
                                 wrkMast.getStaNo(),    // 鐩爣绔�
@@ -1096,7 +1122,7 @@
                                 JSON.toJSONString(forkLiftProtocol)    // 绯荤粺鐘舵�佹暟鎹�
                         );
                         if (!basLiftErrLogService.insert(basLiftErrLog)) {
-                            News.error("鎻愬崌鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", forkLiftSlave.getId(), errName);
+                            News.error("鎻愬崌鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", device.getDeviceNo(), errName);
                         }
                     }
                 } else {
@@ -1106,7 +1132,7 @@
                         latest.setUpdateTime(now);
                         latest.setStatus(2);
                         if (!basLiftErrLogService.updateById(latest)) {
-                            News.error("鎻愬崌鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", forkLiftSlave.getId(), latest.getId());
+                            News.error("鎻愬崌鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", device.getDeviceNo(), latest.getId());
                         }
                     }
                 }
@@ -1125,9 +1151,11 @@
                 return;//鏃犲厖鐢垫々
             }
 
-            for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
+            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, shuttle.getId());
+                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
                 ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
                 if (shuttleProtocol == null) {
                     continue;
@@ -1200,15 +1228,15 @@
                 wrkMast.setIoType(WrkIoType.SHUTTLE_CHARGE.id);//300.鍏呯數
                 wrkMast.setIoPri((double) 999);
                 wrkMast.setLocNo(chargeLocNo);
-                wrkMast.setShuttleNo(shuttle.getId());
+                wrkMast.setShuttleNo(device.getDeviceNo());
                 wrkMast.setMemo("charge");
                 wrkMast.setAppeTime(new Date());
                 if (!wrkMastService.insert(wrkMast)) {
-                    News.error("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟澶辫触!!!", shuttle.getId());
+                    News.error("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟澶辫触!!!", device.getDeviceNo());
                     continue;
                 }
 
-                News.info("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟鎴愬姛!!!", shuttle.getId());
+                News.info("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟鎴愬姛!!!", device.getDeviceNo());
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -1221,8 +1249,10 @@
     public synchronized void executeShuttleCharge() {
         try {
             //鏌ヨ灏忚溅鍏呯數浠诲姟
-            for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
-                WrkMast wrkMast = wrkMastService.selectChargeWorking(shuttle.getId());
+            List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+                    .eq("device_type", String.valueOf(SlaveType.Shuttle)));
+            for (DeviceConfig device : shuttleList) {
+                WrkMast wrkMast = wrkMastService.selectChargeWorking(device.getDeviceNo());
                 if(wrkMast == null) {
                     continue;
                 }
@@ -1343,7 +1373,7 @@
             ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
             assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());//鍥涘悜绌挎杞﹀彿
             assignCommand.setTaskNo(wrkMast.getWrkNo());//浠诲姟鍙�
-            assignCommand.setTaskMode(ShuttleTaskModeType.CHARGE.id);//鍑哄簱妯″紡
+            assignCommand.setTaskMode(ShuttleTaskModeType.CHARGE_ON.id);//鍏呯數寮�
             assignCommand.setSourceLocNo(shuttleProtocol.getCurrentLocNo());//婧愬簱浣�(灏忚溅褰撳墠浣嶇疆)
 
             List<ShuttleCommand> commands = shuttleOperaUtils.getShuttleChargeCommand(assignCommand, shuttleThread, true);
@@ -1384,7 +1414,7 @@
             ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
             assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());//鍥涘悜绌挎杞﹀彿
             assignCommand.setTaskNo(wrkMast.getWrkNo());//浠诲姟鍙�
-            assignCommand.setTaskMode(ShuttleTaskModeType.CHARGE.id);//鍑哄簱妯″紡
+            assignCommand.setTaskMode(ShuttleTaskModeType.CHARGE_OFF.id);//鍏呯數鍏�
             assignCommand.setSourceLocNo(shuttleProtocol.getCurrentLocNo());//婧愬簱浣�(灏忚溅褰撳墠浣嶇疆)
 
             List<ShuttleCommand> commands = shuttleOperaUtils.getShuttleChargeCommand(assignCommand, shuttleThread, false);
@@ -1566,6 +1596,7 @@
                 wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY_COMPLETE.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓�  301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 303.灏忚溅绉诲姩鑷宠繎鐐瑰畬鎴�
                 wrkMast.setModiTime(now);
                 wrkMast.setSystemMsg("");//娓呯┖娑堟伅
+                wrkMastService.updateById(wrkMast);
                 return true;
             }
 
@@ -1652,6 +1683,22 @@
                 return false;
             }
 
+            List<WrkMast> outWrkMastList = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+                    .eq("io_type", 101)
+                    .in("wrk_sts"
+                            , WrkStsType.OUTBOUND_SHUTTLE_RUN.sts
+                            , WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts
+                            , WrkStsType.OUTBOUND_LIFT_RUN.sts
+                            , WrkStsType.OUTBOUND_LIFT_RUN_COMPLETE.sts
+                    )
+            );
+            for (WrkMast outWrkMast : outWrkMastList) {
+                if(Utils.getLev(outWrkMast.getSourceLocNo()) == Utils.getLev(wrkMast.getLocNo())) {
+                    News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽瓨鍦ㄦ鍦ㄦ墽琛岀殑灏忚溅鍑哄簱浠诲姟锛岀姝㈢Щ鍔ㄨ嚦绔欑偣", wrkMast.getWrkNo());
+                    return false;
+                }
+            }
+
             if (wrkMast.getLiftNo() == null) {
                 //鐢宠鎻愬崌鏈鸿祫婧�(璇ヤ换鍔¢渶瑕佹崲灞傚繀椤绘彁鍓嶇嫭鍗犳彁鍗囨満)
                 boolean applyForkLift = forkLiftAction.applyForkLift(liftSta.getLiftNo(), wrkMast.getWrkNo());
@@ -1731,9 +1778,9 @@
             }
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            List<ForkLiftCommand> liftCommands = forkLiftThread.getShuttleSwitchCommand(wrkMast.getWrkNo(), sourceLiftSta.getLev(), liftSta.getLev());
+            ForkLiftCommand liftCommand = forkLiftThread.getShuttleSwitchCommand(wrkMast.getWrkNo(), sourceLiftSta.getLev(), liftSta.getLev());
             ArrayList<ForkLiftCommand> commands = new ArrayList<>();
-            commands.addAll(liftCommands);
+            commands.add(liftCommand);
 
             //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
             LiftAssignCommand assignCommand = new LiftAssignCommand();
@@ -1875,71 +1922,73 @@
 
     //鑷姩鍒囨崲鍑哄叆搴撴ā寮�
     public void autoSwitchForkLiftIOMode() {
-        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
-            Integer liftNo = forkLiftSlave.getId();
-            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftNo);
-            if (forkLiftThread == null) {
-                continue;
-            }
-            ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
-            if (forkLiftProtocol == null) {
-                continue;
-            }
-
-            List<Integer> liftAllStaNo = ForkLiftUtils.getLiftAllStaNo(liftNo);
-            if (liftAllStaNo.isEmpty()) {
-                continue;
-            }
-
-            List<Integer> conveyorBindLiftAllStaNo = ForkLiftUtils.getConveyorBindLiftAllStaNo(liftNo);
-            if (conveyorBindLiftAllStaNo.isEmpty()) {
-                continue;
-            }
-
-            //鑾峰彇鍏ュ簱浠诲姟
-            List<WrkMast> inWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
-                    .in("sta_no", liftAllStaNo)
-                    .in("wrk_sts"
-                            , WrkStsType.NEW_INBOUND.sts
-                            , WrkStsType.INBOUND_DEVICE_RUN.sts
-                            , WrkStsType.INBOUND_LIFT_RUN.sts
-                            , WrkStsType.INBOUND_LIFT_RUN_COMPLETE.sts
-                            , WrkStsType.INBOUND_SHUTTLE_RUN.sts
-                            , WrkStsType.INBOUND_SHUTTLE_RUN_COMPLETE.sts
-                    ));
-
-            //鑾峰彇鍑哄簱浠诲姟
-            List<WrkMast> outWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
-                    .in("sta_no", conveyorBindLiftAllStaNo)
-                    .in("wrk_sts"
-                            , WrkStsType.NEW_OUTBOUND.sts
-                            , WrkStsType.OUTBOUND_SHUTTLE_RUN.sts
-                            , WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts
-                            , WrkStsType.OUTBOUND_LIFT_RUN.sts
-                            , WrkStsType.OUTBOUND_LIFT_RUN_COMPLETE.sts
-                    ));
-
-            if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.NONE)) {
-                //鏈煡妯″紡
-                if (!inWrkMasts.isEmpty()) {
-                    forkLiftThread.switchIOMode(ForkLiftIoModeType.IN);
-                } else if (!outWrkMasts.isEmpty()) {
-                    forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT);
-                }else {
-                    forkLiftThread.switchIOMode(ForkLiftIoModeType.IN);
-                }
-            } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.IN)) {
-                //鍏ュ簱妯″紡
-                if (inWrkMasts.isEmpty() && !outWrkMasts.isEmpty()) {
-                    forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT);
-                }
-            } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.OUT)) {
-                //鍑哄簱妯″紡
-                if (outWrkMasts.isEmpty() && !inWrkMasts.isEmpty()) {
-                    forkLiftThread.switchIOMode(ForkLiftIoModeType.IN);
-                }
-            }
-        }
+//        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+//                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
+//        for (DeviceConfig device : forkliftList) {
+//            Integer liftNo = device.getDeviceNo();
+//            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftNo);
+//            if (forkLiftThread == null) {
+//                continue;
+//            }
+//            ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
+//            if (forkLiftProtocol == null) {
+//                continue;
+//            }
+//
+//            List<Integer> liftAllStaNo = ForkLiftUtils.getLiftAllStaNo(liftNo);
+//            if (liftAllStaNo.isEmpty()) {
+//                continue;
+//            }
+//
+//            List<Integer> conveyorBindLiftAllStaNo = ForkLiftUtils.getConveyorBindLiftAllStaNo(liftNo);
+//            if (conveyorBindLiftAllStaNo.isEmpty()) {
+//                continue;
+//            }
+//
+//            //鑾峰彇鍏ュ簱浠诲姟
+//            List<WrkMast> inWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+//                    .in("sta_no", liftAllStaNo)
+//                    .in("wrk_sts"
+//                            , WrkStsType.NEW_INBOUND.sts
+//                            , WrkStsType.INBOUND_DEVICE_RUN.sts
+//                            , WrkStsType.INBOUND_LIFT_RUN.sts
+//                            , WrkStsType.INBOUND_LIFT_RUN_COMPLETE.sts
+//                            , WrkStsType.INBOUND_SHUTTLE_RUN.sts
+//                            , WrkStsType.INBOUND_SHUTTLE_RUN_COMPLETE.sts
+//                    ));
+//
+//            //鑾峰彇鍑哄簱浠诲姟
+//            List<WrkMast> outWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+//                    .in("sta_no", conveyorBindLiftAllStaNo)
+//                    .in("wrk_sts"
+//                            , WrkStsType.NEW_OUTBOUND.sts
+//                            , WrkStsType.OUTBOUND_SHUTTLE_RUN.sts
+//                            , WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts
+//                            , WrkStsType.OUTBOUND_LIFT_RUN.sts
+//                            , WrkStsType.OUTBOUND_LIFT_RUN_COMPLETE.sts
+//                    ));
+//
+//            if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.NONE)) {
+//                //鏈煡妯″紡
+//                if (!inWrkMasts.isEmpty()) {
+//                    forkLiftThread.switchIOMode(ForkLiftIoModeType.IN);
+//                } else if (!outWrkMasts.isEmpty()) {
+//                    forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT);
+//                }else {
+//                    forkLiftThread.switchIOMode(ForkLiftIoModeType.IN);
+//                }
+//            } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.IN)) {
+//                //鍏ュ簱妯″紡
+//                if (inWrkMasts.isEmpty() && !outWrkMasts.isEmpty()) {
+//                    forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT);
+//                }
+//            } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.OUT)) {
+//                //鍑哄簱妯″紡
+//                if (outWrkMasts.isEmpty() && !inWrkMasts.isEmpty()) {
+//                    forkLiftThread.switchIOMode(ForkLiftIoModeType.IN);
+//                }
+//            }
+//        }
     }
 
     //鍑哄簱浠诲姟棰勮皟搴︽彁鍗囨満
@@ -2010,9 +2059,9 @@
             int workNo = commonService.getWorkNo(WrkIoType.FORKLIFT_MOVE.id);//鑾峰彇浠诲姟鍙�
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
-            List<ForkLiftCommand> liftCommand = forkLiftThread.getMoveCommand(workNo, forkLiftProtocol.getLev(), Utils.getLev(wrkMast.getSourceLocNo()));
+            ForkLiftCommand liftCommand = forkLiftThread.getMoveCommand(workNo, forkLiftProtocol.getLev(), Utils.getLev(wrkMast.getSourceLocNo()));
             ArrayList<ForkLiftCommand> commands = new ArrayList<>();
-            commands.addAll(liftCommand);
+            commands.add(liftCommand);
 
             //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
             LiftAssignCommand assignCommand = new LiftAssignCommand();

--
Gitblit v1.9.1