From e12b25d5fc8170099bfc48d1d4de158a7c4238dc Mon Sep 17 00:00:00 2001
From: Administrator <XS@163.COM>
Date: 星期六, 25 四月 2026 14:19:28 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/utils/StationOperateProcessUtils.java |  957 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 725 insertions(+), 232 deletions(-)

diff --git a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
index 72d192f..837c7a8 100644
--- a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -26,6 +26,8 @@
 import com.zy.core.model.Task;
 import com.zy.core.model.command.StationCommand;
 import com.zy.core.model.protocol.StationProtocol;
+import com.zy.core.task.MainProcessLane;
+import com.zy.core.task.MainProcessTaskSubmitter;
 import com.zy.core.thread.StationThread;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -56,6 +58,203 @@
     private BasStationService basStationService;
     @Autowired
     private StationCycleCapacityService stationCycleCapacityService;
+    @Autowired
+    private MainProcessTaskSubmitter mainProcessTaskSubmitter;
+
+    public void submitStationEnableInTasks(long minIntervalMs) {
+        submitStationEnableInTasks(MainProcessLane.STATION_ENABLE_IN, minIntervalMs);
+    }
+
+    public void submitStationEnableInTasks(MainProcessLane lane, long minIntervalMs) {
+        List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<BasDevp>());
+        for (final BasDevp basDevp : basDevps) {
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo());
+            if (stationThread == null) {
+                continue;
+            }
+            Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
+            if (stationMap == null || stationMap.isEmpty()) {
+                continue;
+            }
+            List<StationObjModel> list = basDevp.getInStationList$();
+            for (final StationObjModel stationObjModel : list) {
+                Integer stationId = stationObjModel == null ? null : stationObjModel.getStationId();
+                if (stationId == null || !stationMap.containsKey(stationId)) {
+                    continue;
+                }
+                mainProcessTaskSubmitter.submitKeyedSerialTask(
+                        lane,
+                        stationId,
+                        "stationEnableInExecute",
+                        minIntervalMs,
+                        new Runnable() {
+                            @Override
+                            public void run() {
+                                stationEnableInExecute(basDevp, stationObjModel);
+                            }
+                        }
+                );
+            }
+        }
+    }
+
+    public void submitStationInTasks(long minIntervalMs) {
+        submitStationInTasks(MainProcessLane.STATION_IN, minIntervalMs);
+    }
+
+    public void submitStationInTasks(MainProcessLane lane, long minIntervalMs) {
+        // 鍏ュ簱涓嬪彂渚濊禆鍗曡疆鍏变韩鐨勬壙杞介鍗犵姸鎬侊紝蹇呴』鏁翠綋涓茶锛岄伩鍏嶅涓珯鐐瑰苟鍙戞椂鍚屾椂閫氳繃瀹归噺妫�鏌ャ��
+        mainProcessTaskSubmitter.submitSerialTask(
+                MainProcessLane.STATION,
+                "stationInExecute",
+                minIntervalMs,
+                new Runnable() {
+                    @Override
+                    public void run() {
+                        stationInExecute();
+                    }
+                }
+        );
+    }
+
+    public void submitCrnStationOutTasks(long minIntervalMs) {
+        submitCrnStationOutTasks(MainProcessLane.STATION_OUT, minIntervalMs);
+    }
+
+    public void submitCrnStationOutTasks(MainProcessLane lane, long minIntervalMs) {
+        // 鍑哄簱绔欑偣涓嬪彂鍚屾牱浼氶鍗犺緭閫佺嚎/鐜嚎瀹归噺锛屼笌 stationInExecute 鍏辩敤 STATION lane 涓茶銆�
+        mainProcessTaskSubmitter.submitSerialTask(
+                MainProcessLane.STATION,
+                "crnStationOutExecute",
+                minIntervalMs,
+                new Runnable() {
+                    @Override
+                    public void run() {
+                        crnStationOutExecute();
+                    }
+                }
+        );
+    }
+
+    public void submitDualCrnStationOutTasks(long minIntervalMs) {
+        submitDualCrnStationOutTasks(MainProcessLane.DUAL_STATION_OUT, minIntervalMs);
+    }
+
+    public void submitDualCrnStationOutTasks(MainProcessLane lane, long minIntervalMs) {
+        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+                .eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts)
+                .isNotNull("dual_crn_no")
+        );
+        for (final WrkMast wrkMast : wrkMasts) {
+            Integer laneKey = wrkMast == null ? null : wrkMast.getSourceStaNo();
+            if (laneKey == null) {
+                laneKey = wrkMast == null ? null : wrkMast.getWrkNo();
+            }
+            mainProcessTaskSubmitter.submitKeyedSerialTask(
+                    lane,
+                    laneKey,
+                    "dualCrnStationOutExecute",
+                    minIntervalMs,
+                    new Runnable() {
+                        @Override
+                        public void run() {
+                            dualCrnStationOutExecute(wrkMast);
+                        }
+                    }
+            );
+        }
+    }
+
+    public void submitStationOutExecuteFinishTasks(long minIntervalMs) {
+        submitStationOutExecuteFinishTasks(MainProcessLane.STATION_OUT_FINISH, minIntervalMs);
+    }
+
+    public void submitStationOutExecuteFinishTasks(MainProcessLane lane, long minIntervalMs) {
+        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN.sts));
+        for (final WrkMast wrkMast : wrkMasts) {
+            Integer laneKey = wrkMast == null ? null : wrkMast.getStaNo();
+            if (laneKey == null) {
+                laneKey = wrkMast == null ? null : wrkMast.getWrkNo();
+            }
+            mainProcessTaskSubmitter.submitKeyedSerialTask(
+                    lane,
+                    laneKey,
+                    "stationOutExecuteFinish",
+                    minIntervalMs,
+                    new Runnable() {
+                        @Override
+                        public void run() {
+                            stationOutExecuteFinish(wrkMast);
+                        }
+                    }
+            );
+        }
+    }
+
+    public void submitCheckTaskToCompleteTasks(long minIntervalMs) {
+        submitCheckTaskToCompleteTasks(MainProcessLane.STATION_COMPLETE, minIntervalMs);
+    }
+
+    public void submitCheckTaskToCompleteTasks(MainProcessLane lane, long minIntervalMs) {
+        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN_COMPLETE.sts));
+        for (final WrkMast wrkMast : wrkMasts) {
+            Integer laneKey = wrkMast == null ? null : wrkMast.getStaNo();
+            if (laneKey == null) {
+                laneKey = wrkMast == null ? null : wrkMast.getWrkNo();
+            }
+            mainProcessTaskSubmitter.submitKeyedSerialTask(
+                    lane,
+                    laneKey,
+                    "checkTaskToComplete",
+                    minIntervalMs,
+                    new Runnable() {
+                        @Override
+                        public void run() {
+                            checkTaskToComplete(wrkMast);
+                        }
+                    }
+            );
+        }
+    }
+
+    public void submitCheckStationRunBlockTasks(long minIntervalMs) {
+        submitCheckStationRunBlockTasks(MainProcessLane.STATION_RUN_BLOCK, minIntervalMs);
+    }
+
+    public void submitCheckStationRunBlockTasks(MainProcessLane lane, long minIntervalMs) {
+        List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<BasDevp>());
+        for (final BasDevp basDevp : basDevps) {
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo());
+            if (stationThread == null) {
+                continue;
+            }
+            List<StationProtocol> statusList = stationThread.getStatus();
+            for (StationProtocol stationProtocol : statusList) {
+                final Integer stationId = stationProtocol == null ? null : stationProtocol.getStationId();
+                if (stationId == null) {
+                    continue;
+                }
+                if (!stationProtocol.isAutoing()
+                        || !stationProtocol.isLoading()
+                        || stationProtocol.getTaskNo() <= 0
+                        || !stationProtocol.isRunBlock()) {
+                    continue;
+                }
+                mainProcessTaskSubmitter.submitKeyedSerialTask(
+                        lane,
+                        stationId,
+                        "checkStationRunBlock",
+                        minIntervalMs,
+                        new Runnable() {
+                            @Override
+                            public void run() {
+                                checkStationRunBlock(basDevp, stationId);
+                            }
+                        }
+                );
+            }
+        }
+    }
 
     //鎵ц杈撻�佺珯鐐瑰叆搴撲换鍔�
     public synchronized void stationInExecute() {
@@ -75,79 +274,165 @@
 
                 List<StationObjModel> list = basDevp.getBarcodeStationList$();
                 for (StationObjModel entity : list) {
-                    Integer stationId = entity.getStationId();
-                    if (!stationMap.containsKey(stationId)) {
-                        continue;
-                    }
-
-                    StationProtocol stationProtocol = stationMap.get(stationId);
-                    if (stationProtocol == null) {
-                        continue;
-                    }
-
-                    Object lock = redisUtil.get(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId);
-                    if (lock != null) {
-                        continue;
-                    }
-
-                    //婊¤冻鑷姩銆佹湁鐗┿�佹湁宸ヤ綔鍙�
-                    if (stationProtocol.isAutoing()
-                            && stationProtocol.isLoading()
-                            && stationProtocol.getTaskNo() > 0
-                    ) {
-                        //妫�娴嬩换鍔℃槸鍚︾敓鎴�
-                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", stationProtocol.getBarcode()));
-                        if (wrkMast == null) {
-                            continue;
-                        }
-
-                        if (wrkMast.getWrkSts() == WrkStsType.INBOUND_DEVICE_RUN.sts) {
-                            continue;
-                        }
-
-                        String locNo = wrkMast.getLocNo();
-                        FindCrnNoResult findCrnNoResult = commonService.findCrnNoByLocNo(locNo);
-                        if (findCrnNoResult == null) {
-                            News.taskInfo(wrkMast.getWrkNo(), "{}宸ヤ綔,鏈尮閰嶅埌鍫嗗灈鏈�", wrkMast.getWrkNo());
-                            continue;
-                        }
-
-                        Integer targetStationId = commonService.findInStationId(findCrnNoResult, stationId);
-                        if (targetStationId == null) {
-                            News.taskInfo(wrkMast.getWrkNo(), "{}绔欑偣,鎼滅储鍏ュ簱绔欑偣澶辫触", stationId);
-                            continue;
-                        }
-
-                        LoopHitResult loopHitResult = findPathLoopHit(limitConfig, stationProtocol.getStationId(), targetStationId, loadGuardState);
-
-                        if (isDispatchBlocked(limitConfig, currentStationTaskCountRef[0], loadGuardState, loopHitResult.isThroughLoop())) {
-                            return;
-                        }
-
-                        StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationId, targetStationId, 0);
-                        if (command == null) {
-                            News.taskInfo(wrkMast.getWrkNo(), "{}宸ヤ綔,鑾峰彇杈撻�佺嚎鍛戒护澶辫触", wrkMast.getWrkNo());
-                            continue;
-                        }
-
-                        wrkMast.setWrkSts(WrkStsType.INBOUND_DEVICE_RUN.sts);
-                        wrkMast.setSourceStaNo(stationProtocol.getStationId());
-                        wrkMast.setStaNo(targetStationId);
-                        wrkMast.setSystemMsg("");
-                        wrkMast.setIoTime(new Date());
-                        if (wrkMastService.updateById(wrkMast)) {
-                            MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
-                            News.info("杈撻�佺珯鐐瑰叆搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationId, wrkMast.getWrkNo(), JSON.toJSONString(command));
-                            redisUtil.set(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId, "lock", 5);
-                            loadGuardState.reserveLoopTask(loopHitResult.getLoopNo());
-                            saveLoopLoadReserve(wrkMast.getWrkNo(), loopHitResult);
-                        }
+                    if (stationInExecute(basDevp, entity, limitConfig, currentStationTaskCountRef, loadGuardState)) {
+                        return;
                     }
                 }
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
+    }
+
+    public void stationEnableInExecute(BasDevp basDevp, StationObjModel stationObjModel) {
+        try {
+            if (basDevp == null || stationObjModel == null || stationObjModel.getStationId() == null) {
+                return;
+            }
+
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo());
+            if (stationThread == null) {
+                return;
+            }
+
+            Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
+            if (stationMap == null) {
+                return;
+            }
+
+            Integer stationId = stationObjModel.getStationId();
+            if (!stationMap.containsKey(stationId)) {
+                return;
+            }
+
+            StationProtocol stationProtocol = stationMap.get(stationId);
+            if (stationProtocol == null) {
+                return;
+            }
+
+            Object lock = redisUtil.get(RedisKeyType.GENERATE_ENABLE_IN_STATION_DATA_LIMIT.key + stationId);
+            if (lock != null) {
+                return;
+            }
+
+            if (stationProtocol.isAutoing()
+                    && stationProtocol.isLoading()
+                    && stationProtocol.getTaskNo() == 0
+                    && stationProtocol.isEnableIn()
+            ) {
+                StationObjModel barcodeStation = stationObjModel.getBarcodeStation();
+                if (barcodeStation == null || barcodeStation.getStationId() == null) {
+                    return;
+                }
+                StationCommand command = stationThread.getCommand(StationCommandType.MOVE, commonService.getWorkNo(WrkIoType.ENABLE_IN.id), stationId, barcodeStation.getStationId(), 0);
+                if (command == null) {
+                    News.info("{}绔欑偣鍚姩鍏ュ簱澶辫触锛岃幏鍙栬緭閫佺嚎鍛戒护澶辫触", stationId);
+                    return;
+                }
+                MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
+                redisUtil.set(RedisKeyType.GENERATE_ENABLE_IN_STATION_DATA_LIMIT.key + stationId, "lock", 15);
+                News.info("{}绔欑偣鍚姩鍏ュ簱鎴愬姛锛屾暟鎹寘:{}", stationId, JSON.toJSONString(command));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void stationInExecute(BasDevp basDevp, StationObjModel stationObjModel) {
+        try {
+            DispatchLimitConfig limitConfig = getDispatchLimitConfig();
+            int[] currentStationTaskCountRef = new int[]{countCurrentStationTask()};
+            LoadGuardState loadGuardState = buildLoadGuardState(limitConfig);
+            stationInExecute(basDevp, stationObjModel, limitConfig, currentStationTaskCountRef, loadGuardState);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private boolean stationInExecute(BasDevp basDevp,
+                                     StationObjModel stationObjModel,
+                                     DispatchLimitConfig limitConfig,
+                                     int[] currentStationTaskCountRef,
+                                     LoadGuardState loadGuardState) {
+        if (basDevp == null || stationObjModel == null || stationObjModel.getStationId() == null) {
+            return false;
+        }
+
+        StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo());
+        if (stationThread == null) {
+            return false;
+        }
+
+        Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
+        Integer stationId = stationObjModel.getStationId();
+        if (stationMap == null || !stationMap.containsKey(stationId)) {
+            return false;
+        }
+
+        StationProtocol stationProtocol = stationMap.get(stationId);
+        if (stationProtocol == null) {
+            return false;
+        }
+
+        Object lock = redisUtil.get(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId);
+        if (lock != null) {
+            return false;
+        }
+
+        //婊¤冻鑷姩銆佹湁鐗┿�佹湁宸ヤ綔鍙�
+        if (stationProtocol.isAutoing()
+                && stationProtocol.isLoading()
+                && stationProtocol.getTaskNo() > 0
+        ) {
+            //妫�娴嬩换鍔℃槸鍚︾敓鎴�
+            WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", stationProtocol.getBarcode()));
+            if (wrkMast == null) {
+                return false;
+            }
+
+            if (wrkMast.getWrkSts() == WrkStsType.INBOUND_DEVICE_RUN.sts) {
+                return false;
+            }
+
+            String locNo = wrkMast.getLocNo();
+            FindCrnNoResult findCrnNoResult = commonService.findCrnNoByLocNo(locNo);
+            if (findCrnNoResult == null) {
+                News.taskInfo(wrkMast.getWrkNo(), "{}宸ヤ綔,鏈尮閰嶅埌鍫嗗灈鏈�", wrkMast.getWrkNo());
+                return false;
+            }
+
+            Integer targetStationId = commonService.findInStationId(findCrnNoResult, stationId);
+            if (targetStationId == null) {
+                News.taskInfo(wrkMast.getWrkNo(), "{}绔欑偣,鎼滅储鍏ュ簱绔欑偣澶辫触", stationId);
+                return false;
+            }
+
+            LoopHitResult loopHitResult = findPathLoopHit(limitConfig, stationProtocol.getStationId(), targetStationId, loadGuardState);
+
+            if (isDispatchBlocked(limitConfig, currentStationTaskCountRef[0], loadGuardState, loopHitResult.isThroughLoop())) {
+                return true;
+            }
+
+            StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationId, targetStationId, 0);
+            if (command == null) {
+                News.taskInfo(wrkMast.getWrkNo(), "{}宸ヤ綔,鑾峰彇杈撻�佺嚎鍛戒护澶辫触", wrkMast.getWrkNo());
+                return false;
+            }
+
+            wrkMast.setWrkSts(WrkStsType.INBOUND_DEVICE_RUN.sts);
+            wrkMast.setSourceStaNo(stationProtocol.getStationId());
+            wrkMast.setStaNo(targetStationId);
+            wrkMast.setSystemMsg("");
+            wrkMast.setIoTime(new Date());
+            if (wrkMastService.updateById(wrkMast)) {
+                MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
+                News.info("杈撻�佺珯鐐瑰叆搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationId, wrkMast.getWrkNo(), JSON.toJSONString(command));
+                redisUtil.set(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId, "lock", 5);
+                loadGuardState.reserveLoopTask(loopHitResult.getLoopNo());
+                saveLoopLoadReserve(wrkMast.getWrkNo(), loopHitResult);
+            }
+        }
+        return false;
     }
 
     //鎵ц鍫嗗灈鏈鸿緭閫佺珯鐐瑰嚭搴撲换鍔�
@@ -164,80 +449,110 @@
             List<Integer> outOrderList = getAllOutOrderList();
 
             for (WrkMast wrkMast : wrkMasts) {
-                Object infoObj = redisUtil.get(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo());
-                if (infoObj == null) {
-                    News.info("鍑哄簱浠诲姟{}鏁版嵁缂撳瓨涓嶅瓨鍦�", wrkMast.getWrkNo());
-                    continue;
-                }
-
-                StationObjModel stationObjModel = JSON.parseObject(infoObj.toString(), StationObjModel.class);
-                StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
-                if (stationThread == null) {
-                    continue;
-                }
-
-                Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
-                StationProtocol stationProtocol = stationMap.get(stationObjModel.getStationId());
-                if (stationProtocol == null) {
-                    continue;
-                }
-
-                Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId());
-                if (lock != null) {
-                    continue;
-                }
-
-                //婊¤冻鑷姩銆佹湁鐗┿�佸伐浣滃彿0
-                if (stationProtocol.isAutoing()
-                        && stationProtocol.isLoading()
-                        && stationProtocol.getTaskNo() == 0
-                ) {
-                    Integer moveStaNo = wrkMast.getStaNo();
-
-                    if (!outOrderList.isEmpty()) {
-                        List<NavigateNode> nodes = navigateUtils.calcByStationId(stationProtocol.getStationId(), wrkMast.getStaNo());
-                        for (int i = nodes.size() - 1; i >= 0; i--) {
-                            NavigateNode node = nodes.get(i);
-                            JSONObject v = JSONObject.parseObject(node.getNodeValue());
-                            if (v != null) {
-                                Integer stationId = v.getInteger("stationId");
-                                if (outOrderList.contains(stationId)) {
-                                    moveStaNo = stationId;
-                                    break;
-                                }
-                            }
-                        }
-                    }
-
-                    LoopHitResult loopHitResult = findPathLoopHit(limitConfig, stationProtocol.getStationId(), moveStaNo, loadGuardState);
-
-                    if (isDispatchBlocked(limitConfig, currentStationTaskCountRef[0], loadGuardState, loopHitResult.isThroughLoop())) {
-                        return;
-                    }
-
-                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), moveStaNo, 0);
-                    if (command == null) {
-                        News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
-                        continue;
-                    }
-
-                    wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts);
-                    wrkMast.setSystemMsg("");
-                    wrkMast.setIoTime(new Date());
-                    if (wrkMastService.updateById(wrkMast)) {
-                        MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
-                        News.info("杈撻�佺珯鐐瑰嚭搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
-                        redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5);
-                        redisUtil.del(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo());
-                        currentStationTaskCountRef[0]++;
-                        loadGuardState.reserveLoopTask(loopHitResult.getLoopNo());
-                        saveLoopLoadReserve(wrkMast.getWrkNo(), loopHitResult);
-                    }
+                if (crnStationOutExecute(wrkMast, limitConfig, currentStationTaskCountRef, loadGuardState, outOrderList)) {
+                    return;
                 }
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
+    }
+
+    public void crnStationOutExecute(WrkMast wrkMast) {
+        try {
+            DispatchLimitConfig limitConfig = getDispatchLimitConfig();
+            int[] currentStationTaskCountRef = new int[]{countCurrentStationTask()};
+            LoadGuardState loadGuardState = buildLoadGuardState(limitConfig);
+            List<Integer> outOrderList = getAllOutOrderList();
+            crnStationOutExecute(wrkMast, limitConfig, currentStationTaskCountRef, loadGuardState, outOrderList);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private boolean crnStationOutExecute(WrkMast wrkMast,
+                                         DispatchLimitConfig limitConfig,
+                                         int[] currentStationTaskCountRef,
+                                         LoadGuardState loadGuardState,
+                                         List<Integer> outOrderList) {
+        if (wrkMast == null || wrkMast.getWrkNo() == null) {
+            return false;
+        }
+
+        Object infoObj = redisUtil.get(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo());
+        if (infoObj == null) {
+            News.info("鍑哄簱浠诲姟{}鏁版嵁缂撳瓨涓嶅瓨鍦�", wrkMast.getWrkNo());
+            return false;
+        }
+
+        StationObjModel stationObjModel = JSON.parseObject(infoObj.toString(), StationObjModel.class);
+        if (stationObjModel == null) {
+            return false;
+        }
+        StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
+        if (stationThread == null) {
+            return false;
+        }
+
+        Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
+        StationProtocol stationProtocol = stationMap == null ? null : stationMap.get(stationObjModel.getStationId());
+        if (stationProtocol == null) {
+            return false;
+        }
+
+        Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId());
+        if (lock != null) {
+            return false;
+        }
+
+        //婊¤冻鑷姩銆佹湁鐗┿�佸伐浣滃彿0
+        if (stationProtocol.isAutoing()
+                && stationProtocol.isLoading()
+                && stationProtocol.getTaskNo() == 0
+        ) {
+            Integer moveStaNo = wrkMast.getStaNo();
+
+            if (outOrderList != null && !outOrderList.isEmpty()) {
+                List<NavigateNode> nodes = navigateUtils.calcByStationId(stationProtocol.getStationId(), wrkMast.getStaNo());
+                for (int i = nodes.size() - 1; i >= 0; i--) {
+                    NavigateNode node = nodes.get(i);
+                    JSONObject v = JSONObject.parseObject(node.getNodeValue());
+                    if (v != null) {
+                        Integer stationId = v.getInteger("stationId");
+                        if (outOrderList.contains(stationId)) {
+                            moveStaNo = stationId;
+                            break;
+                        }
+                    }
+                }
+            }
+
+            LoopHitResult loopHitResult = findPathLoopHit(limitConfig, stationProtocol.getStationId(), moveStaNo, loadGuardState);
+
+            if (isDispatchBlocked(limitConfig, currentStationTaskCountRef[0], loadGuardState, loopHitResult.isThroughLoop())) {
+                return true;
+            }
+
+            StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), moveStaNo, 0);
+            if (command == null) {
+                News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
+                return false;
+            }
+
+            wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts);
+            wrkMast.setSystemMsg("");
+            wrkMast.setIoTime(new Date());
+            if (wrkMastService.updateById(wrkMast)) {
+                MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                News.info("杈撻�佺珯鐐瑰嚭搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
+                redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5);
+                redisUtil.del(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo());
+                currentStationTaskCountRef[0]++;
+                loadGuardState.reserveLoopTask(loopHitResult.getLoopNo());
+                saveLoopLoadReserve(wrkMast.getWrkNo(), loopHitResult);
+            }
+        }
+        return false;
     }
 
     //鎵ц鍙屽伐浣嶅爢鍨涙満杈撻�佺珯鐐瑰嚭搴撲换鍔�
@@ -248,50 +563,65 @@
                     .isNotNull("dual_crn_no")
             );
             for (WrkMast wrkMast : wrkMasts) {
-                Object infoObj = redisUtil.get(RedisKeyType.DUAL_CRN_OUT_TASK_STATION_INFO.key + wrkMast.getWrkNo());
-                if (infoObj == null) {
-                    News.info("鍑哄簱浠诲姟{}鏁版嵁缂撳瓨涓嶅瓨鍦�", wrkMast.getWrkNo());
-                    continue;
+                dualCrnStationOutExecute(wrkMast);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void dualCrnStationOutExecute(WrkMast wrkMast) {
+        try {
+            if (wrkMast == null || wrkMast.getWrkNo() == null) {
+                return;
+            }
+
+            Object infoObj = redisUtil.get(RedisKeyType.DUAL_CRN_OUT_TASK_STATION_INFO.key + wrkMast.getWrkNo());
+            if (infoObj == null) {
+                News.info("鍑哄簱浠诲姟{}鏁版嵁缂撳瓨涓嶅瓨鍦�", wrkMast.getWrkNo());
+                return;
+            }
+
+            StationObjModel stationObjModel = JSON.parseObject(infoObj.toString(), StationObjModel.class);
+            if (stationObjModel == null) {
+                return;
+            }
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
+            if (stationThread == null) {
+                return;
+            }
+
+            Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
+            StationProtocol stationProtocol = stationMap == null ? null : stationMap.get(stationObjModel.getStationId());
+            if (stationProtocol == null) {
+                return;
+            }
+
+            Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId());
+            if (lock != null) {
+                return;
+            }
+
+            //婊¤冻鑷姩銆佹湁鐗┿�佸伐浣滃彿0
+            if (stationProtocol.isAutoing()
+                    && stationProtocol.isLoading()
+                    && stationProtocol.getTaskNo() == 0
+            ) {
+                StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
+                if (command == null) {
+                    News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
+                    return;
                 }
 
-                StationObjModel stationObjModel = JSON.parseObject(infoObj.toString(), StationObjModel.class);
-                StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
-                if (stationThread == null) {
-                    continue;
-                }
-
-                Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
-                StationProtocol stationProtocol = stationMap.get(stationObjModel.getStationId());
-                if (stationProtocol == null) {
-                    continue;
-                }
-
-                Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId());
-                if (lock != null) {
-                    continue;
-                }
-
-                //婊¤冻鑷姩銆佹湁鐗┿�佸伐浣滃彿0
-                if (stationProtocol.isAutoing()
-                        && stationProtocol.isLoading()
-                        && stationProtocol.getTaskNo() == 0
-                ) {
-                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
-                    if (command == null) {
-                        News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
-                        continue;
-                    }
-
-                    wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts);
-                    wrkMast.setSystemMsg("");
-                    wrkMast.setIoTime(new Date());
-                    if (wrkMastService.updateById(wrkMast)) {
-                        MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
-                        notifyUtils.notify(String.valueOf(SlaveType.Devp), stationObjModel.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN, null);
-                        News.info("杈撻�佺珯鐐瑰嚭搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
-                        redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5);
-                        redisUtil.del(RedisKeyType.DUAL_CRN_OUT_TASK_STATION_INFO.key + wrkMast.getWrkNo());
-                    }
+                wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts);
+                wrkMast.setSystemMsg("");
+                wrkMast.setIoTime(new Date());
+                if (wrkMastService.updateById(wrkMast)) {
+                    MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
+                    notifyUtils.notify(String.valueOf(SlaveType.Devp), stationObjModel.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN, null);
+                    News.info("杈撻�佺珯鐐瑰嚭搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
+                    redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5);
+                    redisUtil.del(RedisKeyType.DUAL_CRN_OUT_TASK_STATION_INFO.key + wrkMast.getWrkNo());
                 }
             }
         } catch (Exception e) {
@@ -304,37 +634,48 @@
         try {
             List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN.sts));
             for (WrkMast wrkMast : wrkMasts) {
-                Integer wrkNo = wrkMast.getWrkNo();
-                Integer targetStaNo = wrkMast.getStaNo();
+                stationOutExecuteFinish(wrkMast);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
-                boolean complete = false;
-                BasStation basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("station_id", targetStaNo));
-                if (basStation == null) {
-                    continue;
-                }
+    public void stationOutExecuteFinish(WrkMast wrkMast) {
+        try {
+            if (wrkMast == null) {
+                return;
+            }
+            Integer wrkNo = wrkMast.getWrkNo();
+            Integer targetStaNo = wrkMast.getStaNo();
 
-                StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
-                if (stationThread == null) {
-                    continue;
-                }
+            boolean complete = false;
+            BasStation basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("station_id", targetStaNo));
+            if (basStation == null) {
+                return;
+            }
 
-                Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
-                StationProtocol stationProtocol = statusMap.get(basStation.getStationId());
-                if (stationProtocol == null) {
-                    continue;
-                }
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
+            if (stationThread == null) {
+                return;
+            }
 
-                if (stationProtocol.getTaskNo().equals(wrkNo)) {
-                    complete = true;
-                }
+            Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
+            StationProtocol stationProtocol = statusMap == null ? null : statusMap.get(basStation.getStationId());
+            if (stationProtocol == null) {
+                return;
+            }
 
-                if (complete) {
-                    wrkMast.setWrkSts(WrkStsType.STATION_RUN_COMPLETE.sts);
-                    wrkMast.setIoTime(new Date());
-                    wrkMastService.updateById(wrkMast);
-                    notifyUtils.notify(String.valueOf(SlaveType.Devp), basStation.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN_COMPLETE, null);
-                    redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60);
-                }
+            if (stationProtocol.getTaskNo().equals(wrkNo)) {
+                complete = true;
+            }
+
+            if (complete) {
+                wrkMast.setWrkSts(WrkStsType.STATION_RUN_COMPLETE.sts);
+                wrkMast.setIoTime(new Date());
+                wrkMastService.updateById(wrkMast);
+                notifyUtils.notify(String.valueOf(SlaveType.Devp), basStation.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN_COMPLETE, null);
+                redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -346,40 +687,51 @@
         try {
             List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN_COMPLETE.sts));
             for (WrkMast wrkMast : wrkMasts) {
-                Integer wrkNo = wrkMast.getWrkNo();
-                Integer targetStaNo = wrkMast.getStaNo();
+                checkTaskToComplete(wrkMast);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
-                Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkNo);
-                if (lock != null) {
-                    continue;
-                }
+    public void checkTaskToComplete(WrkMast wrkMast) {
+        try {
+            if (wrkMast == null) {
+                return;
+            }
+            Integer wrkNo = wrkMast.getWrkNo();
+            Integer targetStaNo = wrkMast.getStaNo();
 
-                boolean complete = false;
-                BasStation basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("station_id", targetStaNo));
-                if (basStation == null) {
-                    continue;
-                }
+            Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkNo);
+            if (lock != null) {
+                return;
+            }
 
-                StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
-                if (stationThread == null) {
-                    continue;
-                }
+            boolean complete = false;
+            BasStation basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("station_id", targetStaNo));
+            if (basStation == null) {
+                return;
+            }
 
-                Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
-                StationProtocol stationProtocol = statusMap.get(basStation.getStationId());
-                if (stationProtocol == null) {
-                    continue;
-                }
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
+            if (stationThread == null) {
+                return;
+            }
 
-                if (!stationProtocol.getTaskNo().equals(wrkNo)) {
-                    complete = true;
-                }
+            Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
+            StationProtocol stationProtocol = statusMap == null ? null : statusMap.get(basStation.getStationId());
+            if (stationProtocol == null) {
+                return;
+            }
 
-                if (complete) {
-                    wrkMast.setWrkSts(WrkStsType.COMPLETE_OUTBOUND.sts);
-                    wrkMast.setIoTime(new Date());
-                    wrkMastService.updateById(wrkMast);
-                }
+            if (!stationProtocol.getTaskNo().equals(wrkNo)) {
+                complete = true;
+            }
+
+            if (complete) {
+                wrkMast.setWrkSts(WrkStsType.COMPLETE_OUTBOUND.sts);
+                wrkMast.setIoTime(new Date());
+                wrkMastService.updateById(wrkMast);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -523,6 +875,147 @@
         }
     }
 
+    public void checkStationRunBlock(BasDevp basDevp, Integer stationId) {
+        try {
+            if (basDevp == null || stationId == null) {
+                return;
+            }
+
+            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo());
+            if (stationThread == null) {
+                return;
+            }
+
+            Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
+            StationProtocol stationProtocol = statusMap == null ? null : statusMap.get(stationId);
+            if (stationProtocol == null) {
+                return;
+            }
+
+            List<Integer> runBlockReassignLocStationList = new ArrayList<>();
+            for (StationObjModel stationObjModel : basDevp.getRunBlockReassignLocStationList$()) {
+                runBlockReassignLocStationList.add(stationObjModel.getStationId());
+            }
+
+            if (!(stationProtocol.isAutoing()
+                    && stationProtocol.isLoading()
+                    && stationProtocol.getTaskNo() > 0
+                    && stationProtocol.isRunBlock())) {
+                return;
+            }
+
+            WrkMast wrkMast = wrkMastService.selectByWorkNo(stationProtocol.getTaskNo());
+            if (wrkMast == null) {
+                News.info("杈撻�佺珯鐐瑰彿={} 杩愯闃诲锛屼絾鏃犳硶鎵惧埌瀵瑰簲浠诲姟锛屽伐浣滃彿={}", stationProtocol.getStationId(), stationProtocol.getTaskNo());
+                return;
+            }
+
+            Object lock = redisUtil.get(RedisKeyType.CHECK_STATION_RUN_BLOCK_LIMIT_.key + stationProtocol.getTaskNo());
+            if (lock != null) {
+                return;
+            }
+            redisUtil.set(RedisKeyType.CHECK_STATION_RUN_BLOCK_LIMIT_.key + stationProtocol.getTaskNo(), "lock", 15);
+
+            if (wrkMast.getIoType() == WrkIoType.IN.id && runBlockReassignLocStationList.contains(stationProtocol.getStationId())) {
+                //绔欑偣澶勪簬閲嶆柊鍒嗛厤搴撲綅鍖哄煙
+                //杩愯鍫靛锛岄噸鏂扮敵璇蜂换鍔�
+                String response = wmsOperateUtils.applyReassignTaskLocNo(wrkMast.getWrkNo(), stationProtocol.getStationId());
+                if (response == null) {
+                    News.taskError(wrkMast.getWrkNo(), "璇锋眰WMS閲嶆柊鍒嗛厤搴撲綅鎺ュ彛澶辫触锛屾帴鍙f湭鍝嶅簲锛侊紒锛乺esponse锛歿}", response);
+                    return;
+                }
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getInteger("code").equals(200)) {
+                    StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+
+                    String sourceLocNo = wrkMast.getLocNo();
+                    String locNo = dto.getLocNo();
+
+                    LocMast sourceLocMast = locMastService.queryByLoc(sourceLocNo);
+                    if (sourceLocMast == null) {
+                        News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 婧愬簱浣嶄俊鎭笉瀛樺湪", sourceLocNo);
+                        return;
+                    }
+
+                    if (!sourceLocMast.getLocSts().equals("S")) {
+                        News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 婧愬簱浣嶇姸鎬佷笉澶勪簬鍏ュ簱棰勭害", sourceLocNo);
+                        return;
+                    }
+
+                    LocMast locMast = locMastService.queryByLoc(locNo);
+                    if (locMast == null) {
+                        News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 鐩爣搴撲綅淇℃伅涓嶅瓨鍦�", locNo);
+                        return;
+                    }
+
+                    if (!locMast.getLocSts().equals("O")) {
+                        News.taskInfo(wrkMast.getWrkNo(), "搴撲綅鍙�:{} 鐩爣搴撲綅鐘舵�佷笉澶勪簬绌哄簱浣�", locNo);
+                        return;
+                    }
+
+                    FindCrnNoResult findCrnNoResult = commonService.findCrnNoByLocNo(locNo);
+                    if (findCrnNoResult == null) {
+                        News.taskInfo(wrkMast.getWrkNo(), "{}宸ヤ綔,鏈尮閰嶅埌鍫嗗灈鏈�", wrkMast.getWrkNo());
+                        return;
+                    }
+                    Integer crnNo = findCrnNoResult.getCrnNo();
+
+                    Integer targetStationId = commonService.findInStationId(findCrnNoResult, stationProtocol.getStationId());
+                    if (targetStationId == null) {
+                        News.taskInfo(wrkMast.getWrkNo(), "{}绔欑偣,鎼滅储鍏ュ簱绔欑偣澶辫触", stationProtocol.getStationId());
+                        return;
+                    }
+
+                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), targetStationId, 0);
+                    if (command == null) {
+                        News.taskInfo(wrkMast.getWrkNo(), "{}宸ヤ綔,鑾峰彇杈撻�佺嚎鍛戒护澶辫触", wrkMast.getWrkNo());
+                        return;
+                    }
+
+                    //鏇存柊婧愬簱浣�
+                    sourceLocMast.setLocSts("O");
+                    sourceLocMast.setModiTime(new Date());
+                    locMastService.updateById(sourceLocMast);
+
+                    //鏇存柊鐩爣搴撲綅
+                    locMast.setLocSts("S");
+                    locMast.setModiTime(new Date());
+                    locMastService.updateById(locMast);
+
+                    //鏇存柊宸ヤ綔妗f暟鎹�
+                    wrkMast.setLocNo(locNo);
+                    wrkMast.setStaNo(targetStationId);
+
+                    if (findCrnNoResult.getCrnType().equals(SlaveType.Crn)) {
+                        wrkMast.setCrnNo(crnNo);
+                    } else if (findCrnNoResult.getCrnType().equals(SlaveType.DualCrn)) {
+                        wrkMast.setDualCrnNo(crnNo);
+                    } else {
+                        throw new CoolException("鏈煡璁惧绫诲瀷");
+                    }
+
+                    if (wrkMastService.updateById(wrkMast)) {
+                        MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
+                    }
+                } else {
+                    News.error("璇锋眰WMS鎺ュ彛澶辫触锛侊紒锛乺esponse锛歿}", response);
+                }
+            } else {
+                //杩愯鍫靛锛岄噸鏂拌绠楄矾绾�
+                StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
+                if (command == null) {
+                    News.taskInfo(wrkMast.getWrkNo(), "鑾峰彇杈撻�佺嚎鍛戒护澶辫触");
+                    return;
+                }
+
+                MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
+                News.info("杈撻�佺珯鐐瑰牭濉炲悗閲嶆柊璁$畻璺緞鍛戒护涓嬪彂鎴愬姛锛岀珯鐐瑰彿={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     //鑾峰彇杈撻�佺嚎浠诲姟鏁伴噺
     public synchronized int getCurrentStationTaskCount() {
         return countCurrentStationTask();

--
Gitblit v1.9.1