From 664b83b2e10025a36b29ad086f68c66cb80e339c Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期三, 02 四月 2025 10:29:20 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java                  |    3 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java   |    8 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java |  322 ++++++----------
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java        |  687 ++---------------------------------
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/OpenUtils.java              |    2 
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java      |   87 ++++
 6 files changed, 254 insertions(+), 855 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java
index 934ccfd..816fb9c 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/MainProcess.java
@@ -47,7 +47,6 @@
 
                     // 鍏ュ簱  ===>> 鍏ュ簱绔欏埌鍫嗗灈鏈虹珯锛屾牴鎹潯鐮佹壂鎻忕敓鎴愬叆搴撳伐浣滄。
                     mainService.generateInboundWrk(); // 缁勬墭
-                    mainService.palletInbound();//鍏ュ簱-鎵樼洏杩涘簱
 
                     // 瑙f瀽鍑哄簱宸ヤ綔妗�
                     mainService.analyzeOutBoundTask();
@@ -55,6 +54,8 @@
                     mainService.analyzeInBoundTask();
                     // 瑙f瀽灏忚溅绉诲姩宸ヤ綔妗�
                     mainService.analyzeMoveTask();
+                    // 瑙f瀽灏忚溅鍏呯數宸ヤ綔妗�
+                    mainService.analyzeChargeTask();
                     // 瑙f瀽灏忚溅杞借揣绉诲姩宸ヤ綔妗�
                     mainService.analyzeLadenMoveTask();
                     // 鍑哄簱  ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
index cc2ba2e..8542d54 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -4,11 +4,9 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.wcs.core.domain.dto.MotionDto;
 import com.zy.asrs.wcs.core.entity.*;
-import com.zy.asrs.wcs.core.model.NavigateNode;
 import com.zy.asrs.wcs.core.model.enums.*;
 import com.zy.asrs.wcs.core.service.*;
 import com.zy.asrs.wcs.core.utils.*;
-import com.zy.asrs.wcs.rcs.News;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.entity.Device;
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
@@ -125,250 +123,50 @@
                 return motionList;
             }
 
-            //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 杩涙彁鍗囨満
+            //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 鎻愬崌鏈�
             ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
                     .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
                     .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo))
                     .eq(ShuttleStandby::getStatus, 1));
 
-            //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 鍑烘彁鍗囨満
-            ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
-                    .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
-                    .eq(ShuttleStandby::getDeviceLev, Utils.getLev(destLoc))
-                    .eq(ShuttleStandby::getStatus, 1));
-            if (shuttleStandbyTo == null || shuttleStandbyFrom == null) {
-                return motionList;
-            }
-
             //绌挎杞﹁繘鎻愬崌鏈哄簱浣嶅彿
             String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
-
-            //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
-            String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc();
 
             //绌挎杞﹁繘鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�  杈撻�佺嚎浣嶇疆
             String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
             //绌挎杞︽崲灞傛椂寰呮満浣嶇疆 浣跨敤琛ㄥ垪 memo鏁版嵁
             String standbyLocNoMemo = shuttleStandbyTo.getMemo();
 
-            //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-            String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc();
-
-            //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞
-            List<String> lockPath = shuttleStandbyFrom.getLockPath$();
-
             // 鍏ュ簱鐩爣灞傛湁绌挎杞�
             if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) {
 
-//                // 鎻愬崌鏈鸿浇璐хЩ鍔�
-//                motionList.addAll(kernelService.liftMoveGoods(
-//                        MotionDto.build((dto -> {
-//                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-//                            dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
-//                            dto.setStaNo(31004);//鍏ュ簱绔欑偣
-//                        }))
-//                        , MotionDto.build((dto -> {
-//                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-//                            dto.setLev(Utils.getLev(task.getDestLoc()));
-//                            dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc())));
-//                            dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue());
-//                            dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
-//                        }))
-//                ));
-
-                // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
-                motionList.addAll(kernelService.shuttleMove(
+                // 鎻愬崌鏈鸿浇璐хЩ鍔�
+                motionList.addAll(kernelService.liftMoveGoods(
                         MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(shuttleLocNo);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLocNo(standbyLocNoTo);
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE
-                ));
-
-                // 绌挎杞﹀叆搴撻《鍗�
-                motionList.addAll(kernelService.shuttleAction(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        })),
-                        MotionCtgType.SHUTTLE_PALLET_LIFT
-                ));
-
-                // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoFrom);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
                             dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(destLoc);
-//                            dto.setReleaseLift(2);//鎵ц涓噴鏀炬彁鍗囨満
-                        })),
-                        MotionCtgType.SHUTTLE_TRANSPORT
-                ));
-
-                // 绌挎杞﹀叆搴撴墭鐩樹笅闄�
-                motionList.addAll(kernelService.shuttleAction(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        })),
-                        MotionCtgType.SHUTTLE_PALLET_DOWN
-                ));
-
-            /**
-             * 浜屻�佸叆搴撶洰鏍囧眰娌℃湁绌挎杞�
-             */
-            } else {
-
-//                // 鎻愬崌鏈鸿浇璐хЩ鍔�
-//                motionList.addAll(kernelService.liftMoveGoods(
-//                        MotionDto.build((dto -> {
-//                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-//                            dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
-//                            dto.setStaNo(31004);//鍏ュ簱绔欑偣
-//                        }))
-//                        , MotionDto.build((dto -> {
-//                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-//                            dto.setLev(Utils.getLev(task.getDestLoc()));
-//                            dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc())));
-//                            dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue());
-//                            dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
-//                        }))
-//                ));
-
-                // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(shuttleLocNo);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoMemo);
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE
-                ));
-
-                // 閿佸畾鎹㈠眰璺緞
-                motionList.addAll(kernelService.mapLockPath(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(JSON.toJSONString(lockPath));
+                            dto.setStaNo(Integer.parseInt(task.getOriginSite()));//鍏ュ簱绔欑偣
                         }))
-                ));
-
-                // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
-                motionList.addAll(kernelService.liftMove(
-                        null
                         , MotionDto.build((dto -> {
                             dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(shuttleLocNo));
-                        }))
-                ));
-
-                // 閿佸畾鎻愬崌鏈�
-                motionList.addAll(kernelService.liftLock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        }))
-                ));
-
-                // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoMemo);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(liftLocNoTo);
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-                ));
-
-                // 瑙i攣鎻愬崌鏈�
-                motionList.addAll(kernelService.liftUnlock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        }))
-                ));
-
-                // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞�
-                motionList.addAll(kernelService.liftMoveShuttle(
-                        MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(shuttleLocNo));
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(destLoc));
-                        }))
-                ));
-
-                // 閿佸畾鎻愬崌鏈�
-                motionList.addAll(kernelService.liftLock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        }))
-                ));
-
-                // 鏇存柊灏忚溅鍧愭爣
-                motionList.addAll(kernelService.shuttleUpdateLocation(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(liftLocNoFrom);
-                        }))
-                ));
-
-                // 绌挎杞︾Щ鍔ㄨ嚦鎻愬崌鏈哄緟鏈轰綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(liftLocNoFrom);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLocNo(standbyLocNoFrom);
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-                ));
-
-                // 瑙i攣鎻愬崌鏈�
-                motionList.addAll(kernelService.liftUnlock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
+                            dto.setLev(Utils.getLev(task.getDestLoc()));
+                            dto.setStaNo(Integer.parseInt(task.getDestSite()));
+                            dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue());
                             dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
                         }))
                 ));
 
-                // 瑙i攣鎹㈠眰璺緞
-                motionList.addAll(kernelService.mapUnlockPath(
-                        null,
+                // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣�
+                motionList.addAll(kernelService.shuttleMove(
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(JSON.toJSONString(lockPath));
-                        }))
+                            dto.setLocNo(shuttleLocNo);
+                        })),
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setShuttleDevice(shuttleDevice);
+                            dto.setLocNo(liftLocNoTo);
+                        })),
+                        MotionCtgType.SHUTTLE_MOVE
                 ));
 
                 // 绌挎杞﹀叆搴撻《鍗�
@@ -380,17 +178,33 @@
                         MotionCtgType.SHUTTLE_PALLET_LIFT
                 ));
 
+                // 绌挎杞﹁浇璐ц蛋琛岃嚦寰呮満搴撲綅
+                motionList.addAll(kernelService.shuttleMove(
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setLocNo(liftLocNoTo);
+                        })),
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setShuttleDevice(shuttleDevice);
+                            dto.setLiftNo(transferLiftDevice.getId().intValue());
+                            dto.setLocNo(standbyLocNoTo);
+                        })),
+                        MotionCtgType.SHUTTLE_TRANSPORT
+                ));
+
                 // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅
                 motionList.addAll(kernelService.shuttleMove(
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoFrom);
+                            dto.setLocNo(standbyLocNoTo);
                         })),
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
                             dto.setShuttleDevice(shuttleDevice);
                             dto.setLiftNo(transferLiftDevice.getId().intValue());
                             dto.setLocNo(destLoc);
+                            dto.setReleaseLift(2);//鎵ц涓噴鏀炬彁鍗囨満
                         })),
                         MotionCtgType.SHUTTLE_TRANSPORT
                 ));
@@ -403,7 +217,6 @@
                         })),
                         MotionCtgType.SHUTTLE_PALLET_DOWN
                 ));
-
             }
 
         }
@@ -465,35 +278,14 @@
                     .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo))
                     .eq(ShuttleStandby::getStatus, 1));
 
-            //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 鍑烘彁鍗囨満
-            ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
-                    .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
-                    .eq(ShuttleStandby::getDeviceLev, Utils.getLev(originLoc))
-                    .eq(ShuttleStandby::getStatus, 1));
-            if (shuttleStandbyTo == null || shuttleStandbyFrom == null) {
-                return motionList;
-            }
-
             //绌挎杞﹁繘鎻愬崌鏈哄簱浣嶅彿
             String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
-
-            //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
-            String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc();
 
             //绌挎杞﹁繘鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙� 杈撻�佺嚎浣嶇疆
             String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
 
             //绌挎杞︽崲灞傛椂寰呮満浣嶇疆 浣跨敤琛ㄥ垪 memo鏁版嵁
             String standbyLocNoMemo = shuttleStandbyTo.getMemo();
-
-            //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-            String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc();
-
-            //绌挎杞﹀嚭鎻愬崌鏈哄悗鍏ㄩ儴寰呮満浣�
-            String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//鑾峰彇鍏ㄩ儴寰呮満浣�
-
-            //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞
-            List<String> lockPath = shuttleStandbyFrom.getLockPath$();
 
             //鑾峰彇鍑哄簱浠诲姟绫诲瀷
             TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
@@ -580,245 +372,27 @@
                         MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR
                 ));
 
-                // 绌挎杞﹀嚭搴撴墭鐩樹笅闄�
-                motionList.addAll(kernelService.shuttleAction(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        })),
-                        MotionCtgType.SHUTTLE_PALLET_DOWN
-                ));
-
-                // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅(鑷姩閫夋嫨鍚堥�傚緟鏈轰綅)
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoFrom);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLocNo(standbyLocs);
-                            dto.setSync(0);//寮傛鎵ц
-                            dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀惧皬杞�
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE_STANDBY
-                ));
-
-                // 鎻愬崌鏈鸿浇璐хЩ鍔�
-                motionList.addAll(kernelService.liftMoveGoods(
-                        MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(task.getOriginLoc()));
-                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//璧峰绔欑偣
-                        }))
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
-                            dto.setStaNo(31001);//鍑哄簱绔欑偣
-                            dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue());
-                            dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
-                        }))
-                ));
-
-                // 杈撻�佺嚎杩愯緭鑷冲嚭搴撳彛
-//                motionList.addAll(kernelService.conveyorOutbound(
-//                        MotionDto.build((dto -> {
-//                            dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
-//                            dto.setStaNo(basConveyorPath.getDeviceStn());
-//                        })),
-//                        MotionDto.build((dto -> {
-//                            dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
-//                            dto.setStaNo(basConveyorPath.getStnNo());
-//                        })),
-//                        MotionCtgType.CONVEYOR_OUTBOUND
-//                ));
-
-            /**
-             * 浜屻�佸嚭搴撹捣濮嬪眰娌℃湁绌挎杞�
-             */
-            } else {
-
-                // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(shuttleLocNo);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoMemo);
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE
-                ));
-
-                // 閿佸畾鎹㈠眰璺緞
-                motionList.addAll(kernelService.mapLockPath(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(JSON.toJSONString(lockPath));
-                        }))
-                ));
-
-                // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+                // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌鍑哄簱灞�
                 motionList.addAll(kernelService.liftMove(
                         null
                         , MotionDto.build((dto -> {
                             dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(shuttleLocNo));
+                            dto.setLev(Utils.getLev(originLoc));
                         }))
                 ));
 
-                // 閿佸畾鎻愬崌鏈�
-                motionList.addAll(kernelService.liftLock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        }))
-                ));
-
-                // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
+                // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣�
                 motionList.addAll(kernelService.shuttleMove(
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoMemo);
+                            dto.setLocNo(standbyLocNoTo);
                         })),
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
                             dto.setShuttleDevice(shuttleDevice);
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                             dto.setLocNo(liftLocNoTo);
                         })),
-                        MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-                ));
-
-                // 瑙i攣鎻愬崌鏈�
-                motionList.addAll(kernelService.liftUnlock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        }))
-                ));
-
-                // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞�
-                motionList.addAll(kernelService.liftMoveShuttle(
-                        MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(shuttleLocNo));
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(Utils.getLev(liftLocNoFrom));
-                        }))
-                ));
-
-                // 閿佸畾鎻愬崌鏈�
-                motionList.addAll(kernelService.liftLock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        }))
-                ));
-
-                // 鏇存柊灏忚溅鍧愭爣
-                motionList.addAll(kernelService.shuttleUpdateLocation(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(liftLocNoFrom);
-                        }))
-                ));
-
-                // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(liftLocNoFrom);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLocNo(standbyLocNoFrom);
-                        })),
-                        MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-                ));
-
-                // 瑙i攣鎻愬崌鏈�
-                motionList.addAll(kernelService.liftUnlock(
-                        null
-                        , MotionDto.build((dto -> {
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
-                        }))
-                ));
-
-                // 瑙i攣鎹㈠眰璺緞
-                motionList.addAll(kernelService.mapUnlockPath(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(JSON.toJSONString(lockPath));
-                        }))
-                ));
-
-                // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍑哄簱搴撲綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoFrom);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLocNo(originLoc);
-                        })),
                         MotionCtgType.SHUTTLE_MOVE
-                ));
-
-                // 绌挎杞﹀嚭搴撻《鍗�
-                motionList.addAll(kernelService.shuttleAction(
-                        null,
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        })),
-                        MotionCtgType.SHUTTLE_PALLET_LIFT
-                ));
-
-                if (!originLoc.equals(lastPathStartLoc)) {
-                    // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰�
-                    motionList.addAll(kernelService.shuttleMove(
-                            MotionDto.build((dto -> {
-                                dto.setShuttleNo(shuttleDevice.getId().intValue());
-                                dto.setLocNo(originLoc);
-                            })),
-                            MotionDto.build((dto -> {
-                                dto.setShuttleNo(shuttleDevice.getId().intValue());
-                                dto.setShuttleDevice(shuttleDevice);
-                                dto.setLocNo(lastPathStartLoc);
-                            })),
-                            MotionCtgType.SHUTTLE_TRANSPORT
-                    ));
-                }
-
-                // 绌挎杞﹁浇璐ц嚦鎻愬崌鏈哄緟鏈轰綅
-                motionList.addAll(kernelService.shuttleMove(
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(lastPathStartLoc);
-                        })),
-                        MotionDto.build((dto -> {
-                            dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setShuttleDevice(shuttleDevice);
-                            dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoFrom);
-                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//杈撻�佺珯
-                        })),
-                        MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR
                 ));
 
                 // 绌挎杞﹀嚭搴撴墭鐩樹笅闄�
@@ -834,12 +408,12 @@
                 motionList.addAll(kernelService.shuttleMove(
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
-                            dto.setLocNo(standbyLocNoFrom);
+                            dto.setLocNo(liftLocNoTo);
                         })),
                         MotionDto.build((dto -> {
                             dto.setShuttleNo(shuttleDevice.getId().intValue());
                             dto.setShuttleDevice(shuttleDevice);
-                            dto.setLocNo(standbyLocs);
+                            dto.setLocNo(standbyLocNoTo);
                             dto.setSync(0);//寮傛鎵ц
                             dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀惧皬杞�
                         })),
@@ -851,29 +425,15 @@
                         MotionDto.build((dto -> {
                             dto.setLiftNo(transferLiftDevice.getId().intValue());
                             dto.setLev(Utils.getLev(task.getOriginLoc()));
-                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//璧峰绔欑偣
+                            dto.setStaNo(Integer.parseInt(task.getOriginSite()));//璧峰绔欑偣
                         }))
                         , MotionDto.build((dto -> {
                             dto.setLiftNo(transferLiftDevice.getId().intValue());
-                            dto.setLev(1);//鍏夋嘲1灞傛槸杈撻�佺嚎灞�
-                            dto.setStaNo(31001);//鍑哄簱绔欑偣
+                            dto.setStaNo(Integer.parseInt(task.getDestSite()));//鍑哄簱绔欑偣
                             dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue());
                             dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
                         }))
                 ));
-
-                // 杈撻�佺嚎杩愯緭鑷冲嚭搴撳彛
-//                motionList.addAll(kernelService.conveyorOutbound(
-//                        MotionDto.build((dto -> {
-//                            dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
-//                            dto.setStaNo(basConveyorPath.getDeviceStn());
-//                        })),
-//                        MotionDto.build((dto -> {
-//                            dto.setDevpNo(basConveyorPath.getDeviceId().intValue());
-//                            dto.setStaNo(basConveyorPath.getStnNo());
-//                        })),
-//                        MotionCtgType.CONVEYOR_OUTBOUND
-//                ));
 
             }
 
@@ -915,51 +475,12 @@
 
         String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
 
-        //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満
-        LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true);
-        if (liftThread == null) {
-            return motionList;
-        }
-        Device transferLiftDevice = liftThread.getDevice();
-
-        LiftProtocol liftProtocol = liftThread.getStatus();
-        if (liftProtocol == null || liftProtocol.getLiftNo() == null) {
-            return motionList;
-        }
-
         //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
         boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo());
         if (shuttleResult) {
             //瀛樺湪浠诲姟锛岀姝㈣В鏋�
             return motionList;
         }
-
-        //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 杩涙彁鍗囨満
-        ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
-                .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
-                .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo))
-                .eq(ShuttleStandby::getStatus, 1));
-
-        //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 鍑烘彁鍗囨満
-        ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
-                .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
-                .eq(ShuttleStandby::getDeviceLev, Utils.getLev(chargeLocNo))
-                .eq(ShuttleStandby::getStatus, 1));
-        if (shuttleStandbyTo == null || shuttleStandbyFrom == null) {
-            return motionList;
-        }
-
-        //绌挎杞﹁繘鎻愬崌鏈哄簱浣嶅彿
-        String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
-
-        //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
-        String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc();
-
-        //绌挎杞﹁繘鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-        String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
-
-        //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
-        String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc();
 
         // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鍏呯數灞�
         if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) {
@@ -969,128 +490,6 @@
                     MotionDto.build((dto -> {
                         dto.setShuttleNo(shuttleDevice.getId().intValue());
                         dto.setLocNo(shuttleLocNo);
-                    })),
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setShuttleDevice(shuttleDevice);
-                        dto.setLocNo(chargeLocNo);
-                    })),
-                    MotionCtgType.SHUTTLE_MOVE
-            ));
-
-        } else {
-
-            // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
-            motionList.addAll(kernelService.shuttleMove(
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setLocNo(shuttleLocNo);
-                    })),
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setShuttleDevice(shuttleDevice);
-                        dto.setLocNo(standbyLocNoTo);
-                    })),
-                    MotionCtgType.SHUTTLE_MOVE
-            ));
-
-            // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
-            motionList.addAll(kernelService.liftMove(
-                    null
-                    , MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        dto.setLev(Utils.getLev(shuttleLocNo));
-                    }))
-            ));
-
-            // 閿佸畾鎻愬崌鏈�
-            motionList.addAll(kernelService.liftLock(
-                    null
-                    , MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                    }))
-            ));
-
-            // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鎻愬崌鏈�
-            motionList.addAll(kernelService.shuttleMove(
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setLocNo(standbyLocNoTo);
-                    })),
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setShuttleDevice(shuttleDevice);
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        dto.setLocNo(liftLocNoTo);
-                    })),
-                    MotionCtgType.SHUTTLE_MOVE_TO_LIFT
-            ));
-
-            // 瑙i攣鎻愬崌鏈�
-            motionList.addAll(kernelService.liftUnlock(
-                    null
-                    , MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                    }))
-            ));
-
-            // 鎻愬崌鏈烘惉杞� 鑷� 鍏呯數灞�
-            motionList.addAll(kernelService.liftMoveShuttle(
-                    MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        dto.setLev(Utils.getLev(shuttleLocNo));
-                    })),
-                    MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        dto.setLev(Utils.getLev(chargeLocNo));
-                    }))
-            ));
-
-            // 閿佸畾鎻愬崌鏈�
-            motionList.addAll(kernelService.liftLock(
-                    null
-                    , MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                    }))
-            ));
-
-            // 鏇存柊灏忚溅鍧愭爣
-            motionList.addAll(kernelService.shuttleUpdateLocation(
-                    null
-                    , MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setLocNo(liftLocNoFrom);
-                    }))
-            ));
-
-            // 绌挎杞︽彁鍗囨満鑷虫彁鍗囨満寰呮満浣�
-            motionList.addAll(kernelService.shuttleMove(
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                        dto.setLocNo(liftLocNoFrom);
-                    })),
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setShuttleDevice(shuttleDevice);
-                        dto.setLocNo(standbyLocNoFrom);
-                    })),
-                    MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
-            ));
-
-            // 瑙i攣鎻愬崌鏈�
-            motionList.addAll(kernelService.liftUnlock(
-                    null
-                    , MotionDto.build((dto -> {
-                        dto.setLiftNo(transferLiftDevice.getId().intValue());
-                    }))
-            ));
-
-            // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍏呯數浣�
-            motionList.addAll(kernelService.shuttleMove(
-                    MotionDto.build((dto -> {
-                        dto.setShuttleNo(shuttleDevice.getId().intValue());
-                        dto.setLocNo(standbyLocNoFrom);
                     })),
                     MotionDto.build((dto -> {
                         dto.setShuttleNo(shuttleDevice.getId().intValue());
@@ -1204,7 +603,7 @@
             return motionList;
         }
 
-        String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+        String shuttleLocNo = task.getOriginLoc();
 
         // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
         if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
index c3ea2f0..1ceaf1b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -8,25 +8,16 @@
 import com.zy.asrs.common.domain.param.SearchLocParam;
 import com.zy.asrs.common.utils.HttpHandler;
 import com.zy.asrs.framework.common.Cools;
-import com.zy.asrs.framework.common.R;
 import com.zy.asrs.framework.common.SnowflakeIdWorker;
-import com.zy.asrs.framework.exception.CoolException;
 import com.zy.asrs.wcs.core.action.LiftAction;
-import com.zy.asrs.wcs.core.domain.dto.MatDto;
 import com.zy.asrs.wcs.core.domain.dto.RedisMapDto;
 import com.zy.asrs.wcs.core.domain.dto.StaDto;
-import com.zy.asrs.wcs.core.domain.param.CreateInTaskParam;
 import com.zy.asrs.wcs.core.entity.*;
 import com.zy.asrs.wcs.core.kernel.AnalyzeService;
 import com.zy.asrs.wcs.core.model.MapNode;
-import com.zy.asrs.wcs.core.model.command.LiftAssignCommand;
-import com.zy.asrs.wcs.core.model.command.LiftCommand;
 import com.zy.asrs.wcs.core.model.enums.*;
 import com.zy.asrs.wcs.core.service.*;
-import com.zy.asrs.wcs.core.utils.OpenUtils;
-import com.zy.asrs.wcs.core.utils.RedisUtil;
-import com.zy.asrs.wcs.core.utils.ShuttleDispatcher;
-import com.zy.asrs.wcs.core.utils.Utils;
+import com.zy.asrs.wcs.core.utils.*;
 import com.zy.asrs.wcs.rcs.News;
 import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
 import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
@@ -34,7 +25,6 @@
 import com.zy.asrs.wcs.rcs.model.command.LedCommand;
 import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
-import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
 import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
 import com.zy.asrs.wcs.rcs.model.protocol.StaProtocol;
 import com.zy.asrs.wcs.rcs.service.DeviceService;
@@ -45,7 +35,6 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import java.util.*;
 
 /**
@@ -95,6 +84,10 @@
     private OpenUtils openUtils;
     @Autowired
     private LiftAction liftAction;
+    @Autowired
+    private LiftDispatcher liftDispatcher;
+    @Autowired
+    private ShuttleStandbyService shuttleStandbyService;
 
     /**
      * 缁勬墭
@@ -172,6 +165,11 @@
                             && staProtocol.isPakMk()
                     ) {
 
+                        Object object = redisUtil.get(DeviceRedisConstant.LIFT_PALLET_INBOUND + inSta.getStaNo());
+                        if (object != null) {
+                            continue;
+                        }
+
                         // 鑾峰彇鏉$爜鎵弿浠俊鎭�
                         DeviceBarcode deviceBarcode = deviceBarcodeService.getById(basConveyorSta.getBarcodeId());
                         if(deviceBarcode == null) {
@@ -184,7 +182,6 @@
                         String barcode = barcodeThread.getBarcode();
                         if (!Cools.isEmpty(barcode)) {
                             News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", deviceBarcode.getId(), barcode);
-
                         }
 
                         // 鍒ゆ柇閲嶅宸ヤ綔妗�
@@ -228,37 +225,38 @@
                             if (code.equals(200)) {
                                 StartupDto dto = jsonObject.getObject("data", StartupDto.class);
 
-                                String wmsLocNo = dto.getLocNo();
-                                int row = Integer.parseInt(wmsLocNo.substring(0, 2));
-                                int bay = Integer.parseInt(wmsLocNo.substring(2, 5));
-                                int lev = Integer.parseInt(wmsLocNo.substring(5, 7));
-                                String wcsLocNo = Utils.getLocNo(row, bay, lev);
+//                                String wmsLocNo = dto.getLocNo();
+//                                int row = Integer.parseInt(wmsLocNo.substring(0, 2));
+//                                int bay = Integer.parseInt(wmsLocNo.substring(2, 5));
+//                                int lev = Integer.parseInt(wmsLocNo.substring(5, 7));
+//                                String wcsLocNo = Utils.getLocNo(row, bay, lev);
+//
+//                                CreateInTaskParam createInTaskParam = new CreateInTaskParam();
+//                                createInTaskParam.setTaskNo(String.valueOf(dto.getWorkNo()));
+//                                createInTaskParam.setDestLoc(wcsLocNo);
+//                                createInTaskParam.setOriginSite(dto.getSourceStaNo().toString());
+//                                createInTaskParam.setDestSite(dto.getStaNo().toString());
+//                                createInTaskParam.setPriority(11);
+//                                createInTaskParam.setBarcode(barcode);
+//
+//                                R result = openUtils.createInTask(createInTaskParam);
+//                                News.info("鍒涘缓鍏ュ簱浠诲姟锛屼换鍔℃暟鎹�={}锛學MS鍝嶅簲={}锛岃姹傚搷搴�={}", JSON.toJSON(param), JSON.toJSON(jsonObject), JSON.toJSON(result));
+//                                try{
+//                                    String msg = "";
+//                                    HashMap<String, String> hashMap = new HashMap<>();
+//                                    hashMap.put("msg", msg);
+//                                    hashMap.put("sta", inSta.getStaNo().toString());
+//                                    new HttpHandler.Builder()
+//                                            .setUri(wmsUrl)
+//                                            .setPath("/rpc/led/getError")
+//                                            .setJson(JSON.toJSONString(hashMap))
+//                                            .build()
+//                                            .doPost();
+//                                }catch (Exception e){
+//
+//                                }
 
-                                CreateInTaskParam createInTaskParam = new CreateInTaskParam();
-                                createInTaskParam.setTaskNo(String.valueOf(dto.getWorkNo()));
-                                createInTaskParam.setDestLoc(wcsLocNo);
-                                createInTaskParam.setOriginSite(dto.getSourceStaNo().toString());
-                                createInTaskParam.setDestSite(dto.getStaNo().toString());
-                                createInTaskParam.setPriority(11);
-                                createInTaskParam.setBarcode(barcode);
-
-                                R result = openUtils.createInTask(createInTaskParam);
-                                News.info("鍒涘缓鍏ュ簱浠诲姟锛屼换鍔℃暟鎹�={}锛學MS鍝嶅簲={}锛岃姹傚搷搴�={}", JSON.toJSON(param), JSON.toJSON(jsonObject), JSON.toJSON(result));
-                                try{
-                                    String msg = "";
-                                    HashMap<String, String> hashMap = new HashMap<>();
-                                    hashMap.put("msg", msg);
-                                    hashMap.put("sta", inSta.getStaNo().toString());
-                                    new HttpHandler.Builder()
-                                            .setUri(wmsUrl)
-                                            .setPath("/rpc/led/getError")
-                                            .setJson(JSON.toJSONString(hashMap))
-                                            .build()
-                                            .doPost();
-                                }catch (Exception e){
-
-                                }
-
+                                redisUtil.set(DeviceRedisConstant.LIFT_PALLET_INBOUND + inSta.getStaNo(), "in", 10);
                             }else {
                                 String msg = jsonObject.getString("msg");
                                 HashMap<String, String> hashMap = new HashMap<>();
@@ -275,134 +273,6 @@
                         } catch (Exception e) {
                             e.printStackTrace();
                         }
-                    }
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 鍏ュ簱-鎵樼洏杩涘簱
-     */
-    public synchronized void palletInbound() {
-        try {
-            // 鏍规嵁杈撻�佺嚎plc閬嶅巻
-            List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
-                    .eq(Device::getDeviceType, DeviceCtgType.CONVEYOR.val())
-                    .eq(Device::getStatus, 1));
-            for (Device devp : list) {
-                BasConveyor basConveyor = basConveyorService.getOne(new LambdaQueryWrapper<BasConveyor>().eq(BasConveyor::getDeviceId, devp.getId()).eq(BasConveyor::getHostId, devp.getHostId()));
-                // 閬嶅巻鍏ュ簱鍙�
-                for (StaDto inSta : JSON.parseArray(basConveyor.getInSta(), StaDto.class)) {
-                    BasConveyorSta basConveyorSta = basConveyorStaService.selectBySiteNo(inSta.getDeviceStaNo().toString());
-                    if(basConveyorSta == null) {
-                        continue;
-                    }
-
-                    // 鑾峰彇鍏ュ簱绔欎俊鎭�
-                    DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, devp.getId().intValue());
-                    StaProtocol staProtocol = devpThread.getStation().get(inSta.getDeviceStaNo());
-                    if (staProtocol == null) {
-                        continue;
-                    } else {
-                        staProtocol = staProtocol.clone();
-                    }
-                    int workNo = staProtocol.getWorkNo().intValue();
-
-                    // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                    if (staProtocol.isAutoing()
-                            && staProtocol.isLoading()
-                            && staProtocol.isInEnable()
-                            && (workNo >= 0)
-                            && staProtocol.isPakMk()
-                    ) {
-                        Object object = redisUtil.get(DeviceRedisConstant.LIFT_PALLET_INBOUND + workNo);
-                        if (object != null) {
-                            continue;
-                        }
-
-                        Task task = taskService.getOne(new LambdaQueryWrapper<Task>()
-                                .eq(Task::getDestSite, inSta.getDeviceStaNo())
-                                .in(Task::getTaskSts, TaskStsType.NEW_INBOUND.sts)
-                                .eq(Task::getTaskNo, workNo));
-                        if (task != null) {
-                            int lev = Utils.getLev(task.getDestLoc());
-                            Integer targetSite = null;
-                            if (lev == 1) {
-                                targetSite = 31006;
-                            }else if (lev == 2) {
-                                targetSite = 31007;
-                            }else if (lev == 3) {
-                                targetSite = 31008;
-                            }
-                            if(targetSite == null) {
-                                throw new CoolException(lev + "灞傜珯鐐逛俊鎭笉瀛樺湪");
-                            }
-
-                            StaProtocol staProtocol1 = devpThread.getStation().get(targetSite);
-                            if (staProtocol1 == null) {
-                                break;
-                            }
-                            if (!staProtocol1.isAutoing()) {
-                                break;
-                            }
-                            if (staProtocol1.isLoading()) {
-                                break;
-                            }
-                            if (staProtocol1.getWorkNo().intValue() != 0) {
-                                break;
-                            }
-
-                            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, inSta.getLiftNo());
-                            if (liftThread == null) {
-                                break;
-                            }
-
-                            LiftProtocol liftProtocol = liftThread.getStatus();
-                            if (liftProtocol == null) {
-                                break;
-                            }
-
-                            if (!liftThread.isIdle()) {
-                                break;
-                            }
-
-                            if (motionService.count(new LambdaQueryWrapper<Motion>()
-                                    .eq(Motion::getDeviceCtg, DeviceCtgType.LIFT.val())
-                                    .eq(Motion::getDevice, inSta.getLiftNo())
-                                    .eq(Motion::getMotionSts, MotionStsType.EXECUTING.val())) > 0) {
-                                break;
-                            }
-
-                            //妫�娴嬫彁鍗囨満鏄惁鏈変换鍔$粦瀹�
-                            boolean liftResult = Utils.checkLiftHasBinding(liftProtocol.getLiftNo(), String.valueOf(workNo));
-                            if (liftResult) {
-                                //瀛樺湪浠诲姟锛岀姝㈡墽琛�
-                                break;
-                            }
-
-                            //姣忔鎵ц鎻愬崌鏈烘寚浠ら兘缁戝畾鎻愬崌鏈�
-                            task.setLiftNo(liftProtocol.getLiftNo());
-                            task.setUpdateTime(new Date());
-                            if (!taskService.updateById(task)) {
-                                break;
-                            }
-
-                            List<LiftCommand> command = liftThread.getPalletInOutCommand(workNo, 1, lev, inSta.getDeviceStaNo(), targetSite, LiftCommandModeType.PALLET_INOUT);
-
-                            LiftAssignCommand assignCommand = new LiftAssignCommand();
-                            assignCommand.setLiftNo(liftProtocol.getLiftNo());
-                            assignCommand.setTaskNo(workNo);
-                            assignCommand.setDeviceTaskNo(liftThread.generateDeviceTaskNo(workNo, MotionCtgType.LIFT_WITH_GOODS));
-                            assignCommand.setCommands(command);
-                            liftAction.assignWork(liftThread.getDevice(), assignCommand);
-
-                            redisUtil.set(DeviceRedisConstant.LIFT_PALLET_INBOUND + workNo, "send", 60 * 60 * 6);
-                            break;
-                        }
-
                     }
                 }
             }
@@ -633,20 +503,46 @@
                                 }
                             }
 
+                            //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑鍙崲灞傛彁鍗囨満(鍙兘涓嶇┖闂�)
+                            LiftThread liftThread = liftDispatcher.searchLift(task.getDestLoc(), task.getHostId(), true);
+                            if (liftThread == null) {
+                                continue;
+                            }
+                            Device transferLiftDevice = liftThread.getDevice();
+                            //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 杩涙彁鍗囨満
+                            ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
+                                    .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
+                                    .eq(ShuttleStandby::getDeviceLev, Utils.getLev(task.getDestLoc()))
+                                    .eq(ShuttleStandby::getStatus, 1));
+                            //绌挎杞﹁繘鎻愬崌鏈哄簱浣嶅彿
+                            String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
+                            //绌挎杞﹁繘鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�  杈撻�佺嚎浣嶇疆
+                            String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
+
                             if (Cools.isEmpty(task.getShuttleNo())) {
                                 //鍒嗛厤灏忚溅
-                                //鎼滅储绌洪棽杞�
-                                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
-                                if (shuttleThread == null) {
+                                //璋冨害绌洪棽杞﹀幓鍙栬揣寰呮満浣�
+                                Device shuttleDevice = shuttleDispatcher.dispatchShuttle(task, standbyLocNoTo);
+                                if (shuttleDevice == null) {
                                     News.info("{}浠诲姟鏈壘鍒扮┖闂茬┛姊溅", task.getTaskNo());
                                     continue;
                                 }
 
-                                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//淇濆瓨绌挎杞﹀彿
+                                task.setShuttleNo(Integer.valueOf(shuttleDevice.getDeviceNo()));//淇濆瓨绌挎杞﹀彿
                                 task.setUpdateTime(new Date());
                                 if (!taskService.updateById(task)) {
                                     News.info("{}浠诲姟鏇存柊绌挎杞﹀彿澶辫触", task.getTaskNo());
                                 }
+                                continue;
+                            }
+
+                            //鍒ゆ柇灏忚溅鏄惁鍒拌揪鍙栬揣寰呮満浣嶇疆
+                            String shuttleLocNo = shuttleDispatcher.findShuttleLocNo(task.getShuttleNo(), task.getHostId());
+                            if (shuttleLocNo == null) {
+                                continue;
+                            }
+
+                            if (!standbyLocNoTo.equals(shuttleLocNo)) {
                                 continue;
                             }
 
@@ -838,23 +734,6 @@
     // 瑙f瀽灏忚溅绉诲姩宸ヤ綔妗�
     public synchronized void analyzeMoveTask() {
         for (Task task : taskService.selectWaitAnalyzeMoveTask()) {
-            if (Cools.isEmpty(task.getShuttleNo())) {
-                //鍒嗛厤灏忚溅
-                //鎼滅储绌洪棽杞�
-                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
-                if (shuttleThread == null) {
-                    News.info("{}浠诲姟鏈壘鍒扮┖闂茬┛姊溅", task.getTaskNo());
-                    continue;
-                }
-
-                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//淇濆瓨绌挎杞﹀彿
-                task.setUpdateTime(new Date());
-                if (!taskService.updateById(task)) {
-                    News.info("{}浠诲姟鏇存柊绌挎杞﹀彿澶辫触", task.getTaskNo());
-                }
-                continue;
-            }
-
             // generate motion list
             List<Motion> motionList = analyzeService.generateShuttleMoveMotion(task);
             if (motionList.isEmpty()) {
@@ -864,6 +743,54 @@
 
             // 鏇存柊宸ヤ綔涓绘。
             task.setTaskSts(TaskStsType.ANALYZE_MOVE.sts); // 宸ヤ綔鐘舵��
+            task.setUpdateTime(new Date());
+            if (!taskService.updateById(task)) {
+                News.error("鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", task.getTaskNo());
+            }
+        }
+    }
+
+    // 瑙f瀽灏忚溅鍏呯數宸ヤ綔妗�
+    public synchronized void analyzeChargeTask() {
+        List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.NEW_CHARGE.sts));
+        for (Task task : list) {
+            String locNo = task.getDestLoc();
+
+            Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>()
+                    .eq(Device::getDeviceNo, task.getShuttleNo())
+                    .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
+                    .eq(Device::getHostId, task.getHostId())
+                    .eq(Device::getStatus, 1));
+            if (shuttleDevice == null) {
+                continue;
+            }
+
+            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue());
+            if (shuttleThread == null) {
+                continue;
+            }
+
+            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+                continue;
+            }
+            String shuttleLocNo = task.getOriginLoc();
+
+            if (Utils.getLev(locNo) != Utils.getLev(shuttleLocNo)) {
+                shuttleDispatcher.dispatchShuttle(task, task.getDestLoc());
+                continue;
+            }
+
+            // generate motion list
+            List<Motion> motionList = analyzeService.generateChargeMotion(task);
+            if (Cools.isEmpty(motionList)) {
+                News.error("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟澶辫触!!!", task.getTaskNo());
+                continue;
+            }
+            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
+
+            // 鏇存柊宸ヤ綔涓绘。
+            task.setTaskSts(TaskStsType.ANALYZE_CHARGE.sts);
             task.setUpdateTime(new Date());
             if (!taskService.updateById(task)) {
                 News.error("鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", task.getTaskNo());
@@ -998,15 +925,6 @@
             task.setMemo("charge");
             task.setShuttleNo(Integer.valueOf(device.getDeviceNo()));
 
-            // generate motion list
-            List<Motion> motionList = analyzeService.generateChargeMotion(task);
-            if (Cools.isEmpty(motionList)) {
-                News.error("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟澶辫触!!!", device.getDeviceNo());
-                continue;
-            }
-            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
-
-            task.setTaskSts(TaskStsType.ANALYZE_CHARGE.sts);
             if (!taskService.save(task)) {
                 News.error("淇濆瓨{}鍙峰洓鍚戠┛姊溅鍏呯數浠诲姟澶辫触!!!", device.getDeviceNo());
                 continue;
@@ -1088,7 +1006,7 @@
             task.setTaskCtg(taskCtg.getId());
             task.setPriority(10);
             task.setOriginSite(null);
-            task.setOriginLoc(null);
+            task.setOriginLoc(shuttleProtocol.getCurrentLocNo());
             task.setDestSite(null);
             task.setDestLoc(standByLocNo); // 閬胯浣嶇疆
             task.setIoTime(new Date());
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/OpenUtils.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/OpenUtils.java
index e5b014c..b1e3cf3 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/OpenUtils.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/OpenUtils.java
@@ -399,7 +399,7 @@
         task.setTaskCtg(taskCtg.getId());
         task.setPriority(priority);
         task.setOriginSite(null);
-        task.setOriginLoc(null);
+        task.setOriginLoc(shuttleProtocol.getCurrentLocNo());
         task.setDestSite(null);
         task.setDestLoc(param.getDestLoc());
         task.setIoTime(new Date());
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
index 1808c65..1971cbf 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -1,7 +1,6 @@
 package com.zy.asrs.wcs.core.utils;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zy.asrs.framework.common.Cools;
 import com.zy.asrs.framework.common.SnowflakeIdWorker;
@@ -24,6 +23,7 @@
 import com.zy.asrs.wcs.system.service.DictService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
 
@@ -58,6 +58,63 @@
     private DictService dictService;
     @Autowired
     private NavigateUtils navigateUtils;
+
+    /**
+     * 璋冨害杞﹁締
+     */
+    public Device dispatchShuttle(Task task, String locNo) {
+        ArrayList<ShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅
+        ArrayList<ShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅
+
+        ShuttleThread resThread = null;
+        int lev = Utils.getLev(locNo);
+        List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
+                .eq(Device::getHostId, task.getHostId())
+                .eq(Device::getStatus, 1));
+        //鑾峰彇鍚屽眰灏忚溅
+        List<Device> currentLevDevices = new ArrayList<>();
+        //鑾峰彇璺ㄥ眰灏忚溅
+        HashMap<Integer, List<Device>> diffLevDeviceMap = new HashMap<>();
+        for (Device device : list) {
+            //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
+            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+                continue;
+            }
+
+            int shuttleLev = Utils.getLev(shuttleProtocol.getCurrentLocNo());
+            if (shuttleLev == lev) {
+                currentLevDevices.add(device);
+            } else {
+                List<Device> devices = null;
+                if (diffLevDeviceMap.containsKey(shuttleLev)) {
+                    devices = diffLevDeviceMap.get(shuttleLev);
+                } else {
+                    devices = new ArrayList<>();
+                }
+                devices.add(device);
+                diffLevDeviceMap.put(shuttleLev, devices);
+            }
+        }
+
+        //鎼滅储鍚屽眰
+        resThread = this.searchCurrentLevShuttle(currentLevDevices, locNo);
+
+        //鍚屽眰娌℃湁鎼滅储鍒板悎閫傚皬杞︼紝璺ㄦゼ灞傛悳绱�
+        if (resThread == null) {
+            resThread = this.searchDiffLevShuttle(diffLevDeviceMap, locNo, task);
+        }
+
+        Task result = generateMoveTask(resThread.getDevice(), locNo);
+        if (result != null) {
+            return resThread.getDevice();
+        }
+
+        News.info("{}鐩爣搴撲綅娌℃湁鎼滅储鍒板彲鐢ㄧ┛姊溅", locNo);
+        return null;
+    }
 
     public synchronized ShuttleThread searchIdleShuttle(Task task) {
         String locNo = taskService.judgeInbound(task) ? task.getDestLoc() : task.getOriginLoc();
@@ -318,6 +375,11 @@
             return null;
         }
 
+        ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+        if (shuttleProtocol == null) {
+            return null;
+        }
+
         Task task = new Task();
         task.setUuid(String.valueOf(snowflakeIdWorker.nextId()));
         task.setTaskNo(String.valueOf(Utils.getTaskNo("MOVE")));
@@ -325,7 +387,7 @@
         task.setTaskCtg(taskCtg.getId());
         task.setPriority(10);
         task.setOriginSite(null);
-        task.setOriginLoc(null);
+        task.setOriginLoc(shuttleProtocol.getCurrentLocNo());
         task.setDestSite(null);
         task.setDestLoc(locNo); // 杩佺Щ浣嶇疆
         task.setIoTime(new Date());
@@ -567,5 +629,26 @@
         return lastPathStartLoc;
     }
 
+    //鑾峰彇灏忚溅鍧愭爣
+    public String findShuttleLocNo(Integer shuttleNo, Long hostId) {
+        Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
+                .eq(Device::getDeviceNo, shuttleNo)
+                .eq(Device::getHostId, hostId)
+                .eq(Device::getStatus, 1));
+        if(device == null) {
+            return null;
+        }
+
+        //鑾峰彇鍥涘悜绌挎杞︾嚎绋�
+        ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
+        ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+        if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+            return null;
+        }
+
+        return shuttleProtocol.getCurrentLocNo();
+    }
+
 
 }
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
index 40b243c..ab95590 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
@@ -403,6 +403,9 @@
                 String requestType = resultBody.getString("requestType");
                 Integer requestId = resultHeader.getInteger("requestId");
                 if (requestType.equals("init")) {
+                    removeIdx = i;//姝ゆ暟鎹凡缁忓鐞嗭紝浠庣粨鏋滈泦涓墧闄�
+                    socketResults.remove(removeIdx);
+
                     Integer code = resultBody.getInteger("code");
                     //灏忚溅澶嶄綅璇锋眰
                     ShuttleCommand initCommand = getInitCommand(requestId, code);
@@ -410,16 +413,11 @@
                     NyShuttleHttpCommand httpCommand = JSON.parseObject(initCommand.getBody(), NyShuttleHttpCommand.class);
                     JSONObject requestResult = requestCommand(httpCommand);
 
-                    removeIdx = i;//姝ゆ暟鎹凡缁忓鐞嗭紝浠庣粨鏋滈泦涓墧闄�
 
                     log.info(MessageFormat.format("銆恵0}銆戝洓鍚戣溅澶嶄綅涓婃姤 ===>> [code:{1}] [ip:{2}] [port:{3}]", device.getId(), code, device.getIp(), device.getPort()));
                     OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戣溅澶嶄綅涓婃姤 ===>> [code:{1}] [ip:{2}] [port:{3}]", device.getId(), code, device.getIp(), device.getPort()));
                     break;
                 }
-            }
-
-            if (removeIdx != -1) {
-                socketResults.remove(removeIdx);
             }
         } catch (Exception e) {
             e.printStackTrace();

--
Gitblit v1.9.1