From eb519c38628c40669a63fa2e34f5aae876faecf9 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 21 七月 2025 16:10:58 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  270 +++++++++++++++++------------------------------------
 1 files changed, 88 insertions(+), 182 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 80f3170..cd2efe4 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
@@ -91,7 +87,7 @@
                 Object data = redisUtil.get(RedisKeyType.MAP.key + lev);
                 if (data == null) {//redis鍦板浘鏁版嵁涓虹┖
                     //杞藉叆鍦板浘
-                    List<List<MapNode>> lists = navigateMapData.getJsonData(lev, -1, null, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
+                    List<List<MapNode>> lists = navigateMapData.getJsonData(lev, NavigationMapType.getMapTypes(NavigationMapType.NONE), null, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
 
                     //瀛樺叆鏁版嵁搴�
                     basMap.setData(JSON.toJSONString(lists));
@@ -200,7 +196,7 @@
             assignCommand.setAuto(true);//鑷姩妯″紡
 
             //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(liftSta.getLocNo(), wrkMast.getLocNo(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(liftSta.getLocNo(), wrkMast.getLocNo(), NavigationMapType.getDfxWithDevice(), assignCommand, shuttleThread);
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;
@@ -338,7 +334,7 @@
                 //寮哄埗棰勭暀涓�鍙板皬杞︾粰鍏ュ簱浠诲姟
                 int lev = Utils.getLev(wrkMast.getSourceLocNo());
                 //鑾峰彇褰撳墠妤煎眰鏈夊嚑鍙板彲鐢ㄥ皬杞�
-                int shuttleCount = shuttleDispatchUtils.getShuttleCountByLev(lev);
+                int shuttleCount = shuttleDispatchUtils.getShuttleEnableUseCountByLev(lev);
                 if (shuttleCount >= 2) {//鍙湁鍙敤灏忚溅鏁伴噺澶т簬2锛屾墠杩涜鍏ュ簱浠诲姟棰勭暀灏忚溅
                     int shuttleWrkInObligateCount = 1;//棰勭暀灏忚溅鏁伴噺
                     Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "shuttleWrkInObligateCount").eq("status", 1));
@@ -397,7 +393,7 @@
             assignCommand.setAuto(true);//鑷姩妯″紡
 
             //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), liftSta.getLocNo(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), liftSta.getLocNo(), NavigationMapType.getDfxWithDevice(), assignCommand, shuttleThread);
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;
@@ -433,99 +429,6 @@
             return false;
         }
         return true;
-    }
-
-    /**
-     * 鍥涘悜绌挎杞︿换鍔″畬鎴�
-     */
-    public synchronized void shuttleFinished() {
-        try {
-            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());
-                ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
-                if (shuttleProtocol == null) {
-                    continue;
-                }
-
-                //鍥涘悜绌挎杞︾姸鎬佷负绛夊緟纭銆佸皬杞﹀浜庣┖闂茬姸鎬�
-                if (shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id  //浠诲姟瀹屾垚绛夊緟纭
-                        && shuttleProtocol.getTaskNo() != 0
-                ) {
-                    //灏嗕换鍔℃。鏍囪涓哄畬鎴�
-                    WrkMast wrkMast = wrkMastService.selectByWorkNo(shuttleProtocol.getTaskNo());
-                    if (wrkMast != null) {
-                        if (wrkMast.getWrkSts() == WrkStsType.INBOUND_SHUTTLE_RUN.sts) {
-                            //5.灏忚溅鎼繍涓� ==> 9.鍏ュ簱瀹屾垚
-                            wrkMast.setWrkSts(WrkStsType.COMPLETE_INBOUND.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                        } else if (wrkMast.getWrkSts() == WrkStsType.OUTBOUND_SHUTTLE_RUN.sts) {
-                            //102.灏忚溅鎼繍涓� ==> 103.灏忚溅鎼繍瀹屾垚
-                            wrkMast.setWrkSts(WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                        } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_NEARBY.sts) {
-                            //302.灏忚溅绉诲姩鑷宠繎鐐逛腑 ==> 303.灏忚溅绉诲姩鑷宠繎鐐瑰畬鎴�
-                            wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY_COMPLETE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                        } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_IN_LIFT.sts) {
-                            //304.灏忚溅杩佸叆鎻愬崌鏈轰腑 ==> 305.灏忚溅杩佸叆鎻愬崌鏈哄畬鎴�
-                            wrkMast.setWrkSts(WrkStsType.MOVE_IN_LIFT_COMPLETE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                        } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_OUT_LIFT.sts) {
-                            //308.灏忚溅杩佸嚭鎻愬崌鏈轰腑 ==> 309.灏忚溅杩佸嚭鎻愬崌鏈哄畬鎴�
-                            if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) != Utils.getLev(wrkMast.getLocNo())) {
-                                continue;//灏忚溅鏈埌杈剧洰鏍囧眰
-                            }
-                            wrkMast.setWrkSts(WrkStsType.MOVE_OUT_LIFT_COMPLETE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                        } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_SHUTTLE.sts) {
-                            //310.灏忚溅绉诲姩涓� ==> 311.灏忚溅绉诲姩瀹屾垚
-                            wrkMast.setWrkSts(WrkStsType.COMPLETE_MOVE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                            notifyUtils.notify(String.valueOf(SlaveType.Shuttle), shuttleProtocol.getShuttleNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.SHUTTLE_MOVE_COMPLETE);//瑙﹀彂閫氱煡
-                        } else if (wrkMast.getWrkSts() == WrkStsType.CHARGE_SHUTTLE_WORKING.sts) {
-                            //204.灏忚溅鍏呯數涓� ==> 205.灏忚溅鍏呯數瀹屾垚
-                            wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_COMPLETE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                            notifyUtils.notify(String.valueOf(SlaveType.Shuttle), shuttleProtocol.getShuttleNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.SHUTTLE_POWER_COMPLETE);//瑙﹀彂閫氱煡
-                        } else if (wrkMast.getWrkSts() == WrkStsType.LOC_MOVE_SHUTTLE_RUN.sts) {
-                            //502.灏忚溅鎼繍涓� ==> 509.绉诲簱瀹屾垚
-                            wrkMast.setWrkSts(WrkStsType.COMPLETE_LOC_MOVE.sts);
-                            shuttleThread.setSyncTaskNo(0);
-                            notifyUtils.notify(String.valueOf(SlaveType.Shuttle), shuttleProtocol.getShuttleNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.SHUTTLE_DELIVERY);//瑙﹀彂閫氱煡
-                        } else {
-                            continue;
-                        }
-
-                        if (wrkMastService.updateById(wrkMast)) {
-                            //璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
-                            shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
-                            News.info("鍥涘悜绌挎杞﹀凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傚洓鍚戠┛姊溅鍙�={}", shuttleProtocol.getShuttleNo());
-                        } else {
-                            News.error("鍥涘悜绌挎杞﹀凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅澶辫触锛屼絾鏈壘鍒板伐浣滄。銆傚洓鍚戠┛姊溅鍙�={}锛屽伐浣滃彿={}", shuttleProtocol.getShuttleNo(), shuttleProtocol.getTaskNo());
-                        }
-                    } else {
-                        Object object = redisUtil.get(RedisKeyType.SHUTTLE_WORK_FLAG.key + shuttleProtocol.getTaskNo());
-                        if(object != null){
-                            ShuttleAssignCommand assignCommand = JSON.parseObject(object.toString(), ShuttleAssignCommand.class);
-                            if (!assignCommand.getAuto()) {
-                                //鎵嬪姩妯″紡
-                                //宸ヤ綔鍙锋竻闆�
-                                shuttleThread.setTaskNo(0);
-                                //璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
-                                shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
-                                News.info("鍥涘悜绌挎杞﹀凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傚洓鍚戠┛姊溅鍙�={}", shuttleProtocol.getShuttleNo());
-                            }
-                        }
-                    }
-                }
-
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
     }
 
     /**
@@ -605,7 +508,7 @@
             assignCommand.setAuto(true);//鑷姩妯″紡
 
             //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), wrkMast.getLocNo(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), wrkMast.getLocNo(), NavigationMapType.getDfxWithDevice(), assignCommand, shuttleThread);
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;
@@ -766,9 +669,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();
@@ -894,9 +797,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();
@@ -928,6 +831,9 @@
             for (DeviceConfig device : forkliftList) {
                 //鑾峰彇鎻愬崌鏈轰俊鎭�
                 ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
+                if(forkLiftThread == null) {
+                    continue;
+                }
                 ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
                 if (forkLiftProtocol == null) {
                     continue;
@@ -1302,7 +1208,7 @@
                 return false;
             }
 
-            if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) {
+            if (wrkMast.getLocNo().equals(shuttleProtocol.getCurrentLocNo())) {
                 //灏忚溅鍦ㄥ厖鐢垫々浣嶇疆
                 wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_RUN_COMPLETE.sts);
                 wrkMast.setModiTime(new Date());
@@ -1586,7 +1492,7 @@
             assignCommand.setAuto(true);//鑷姩妯″紡
 
             //璁$畻杩戠偣浣嶇疆
-            String endLocation = navigateUtils.calcEndLocation(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.NORMAL.id, null, null, 1);
+            String endLocation = navigateUtils.calcEndLocation(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), null, null, 1);
             if (endLocation == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽皬杞﹁繎鐐逛綅缃绠楀け璐�", wrkMast.getWrkNo());
                 return false;
@@ -1602,7 +1508,7 @@
             }
 
             //鑾峰彇灏忚溅鍒拌繎鐐硅璧板懡浠�
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), endLocation, NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), endLocation, NavigationMapType.getMapTypes(NavigationMapType.NORMAL, NavigationMapType.SHUTTLE), assignCommand, shuttleThread);
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;//璺緞瑙i攣澶辫触
@@ -1717,7 +1623,7 @@
             assignCommand.setAuto(true);//鑷姩妯″紡
 
             //鑾峰彇灏忚溅鍒版彁鍗囨満琛岃蛋鍛戒护
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread);
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;//璺緞瑙i攣澶辫触
@@ -1779,9 +1685,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();
@@ -1901,7 +1807,7 @@
             assignCommand.setLocNo(wrkMast.getLocNo());//鐩爣搴撲綅
 
             //鑾峰彇灏忚溅鍒扮洰鏍囧簱浣嶅懡浠�
-            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
+            List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread);
             if (commands == null) {
                 News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
                 return false;//璺緞璁$畻澶辫触
@@ -1923,73 +1829,73 @@
 
     //鑷姩鍒囨崲鍑哄叆搴撴ā寮�
     public void autoSwitchForkLiftIOMode() {
-        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);
-                }
-            }
-        }
+//        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);
+//                }
+//            }
+//        }
     }
 
     //鍑哄簱浠诲姟棰勮皟搴︽彁鍗囨満
@@ -2060,9 +1966,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