From 909164aa1859fdf25330eb130bc90b8bd22e540b Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 24 三月 2026 12:00:51 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
index ec8a453..ea10e5d 100644
--- a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -466,6 +466,17 @@
 
                         if (wrkMast.getIoType() == WrkIoType.IN.id && runBlockReassignLocStationList.contains(stationProtocol.getStationId())) {
                             //绔欑偣澶勪簬閲嶆柊鍒嗛厤搴撲綅鍖哄煙
+                            int currentTaskBufferCommandCount = countCurrentTaskBufferCommands(
+                                    stationProtocol.getTaskBufferItems(),
+                                    stationProtocol.getTaskNo()
+                            );
+                            if (currentTaskBufferCommandCount > 0) {
+                                News.info("杈撻�佺珯鐐硅繍琛屽牭濉為噸鍒嗛厤宸茶烦杩囷紝缂撳瓨鍖轰粛瀛樺湪褰撳墠浠诲姟鍛戒护銆傜珯鐐瑰彿={}锛屽伐浣滃彿={}锛屽綋鍓嶄换鍔″懡浠ゆ暟={}",
+                                        stationProtocol.getStationId(),
+                                        stationProtocol.getTaskNo(),
+                                        currentTaskBufferCommandCount);
+                                continue;
+                            }
                             //杩愯鍫靛锛岄噸鏂扮敵璇蜂换鍔�
                             String response = wmsOperateUtils.applyReassignTaskLocNo(wrkMast.getWrkNo(), stationProtocol.getStationId());
                             if (Cools.isEmpty(response)) {
@@ -562,6 +573,10 @@
                                 continue;
                             }
 
+                            if (countCurrentTaskBufferCommands(stationProtocol.getTaskBufferItems(), stationProtocol.getTaskNo()) > 0) {
+                                continue;
+                            }
+
                             StationCommand command = stationThread.getRunBlockRerouteCommand(
                                     wrkMast.getWrkNo(),
                                     stationProtocol.getStationId(),
@@ -577,6 +592,7 @@
                                 continue;
                             }
 
+                            resetSegmentMoveCommandsBeforeReroute(wrkMast.getWrkNo());
                             offerDevpCommandWithDedup(basDevp.getDevpNo(), command, "checkStationRunBlock_reroute");
                             syncOutOrderWatchState(wrkMast, stationProtocol.getStationId(), outOrderStationIds, dispatchDecision, command);
                             News.info("杈撻�佺珯鐐瑰牭濉炲悗閲嶆柊璁$畻璺緞鍛戒护涓嬪彂鎴愬姛锛岀珯鐐瑰彿={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
@@ -677,6 +693,13 @@
                     continue;
                 }
 
+                if (countCurrentTaskBufferCommands(stationProtocol.getTaskBufferItems(), stationProtocol.getTaskNo()) > 0) {
+                    continue;
+                }
+                if (isWatchingCircleTransit(wrkMast.getWrkNo(), stationProtocol.getStationId())) {
+                    continue;
+                }
+
                 if (isWatchingCircleArrival(wrkMast.getWrkNo(), stationProtocol.getStationId())) {
                     continue;
                 }
@@ -707,6 +730,7 @@
                 if (!tryAcquireOutOrderDispatchLock(wrkMast.getWrkNo(), stationProtocol.getStationId())) {
                     continue;
                 }
+                resetSegmentMoveCommandsBeforeReroute(wrkMast.getWrkNo());
                 syncOutOrderWatchState(wrkMast, stationProtocol.getStationId(), outOrderStationIds, dispatchDecision, command);
                 offerDevpCommandWithDedup(stationObjModel.getDeviceNo(), command, "checkStationOutOrder");
                 News.info(dispatchDecision.isCircle() ? "{}浠诲姟杩涜缁曞湀" : "{}浠诲姟鐩存帴鍘荤洰鏍囩偣", wrkMast.getWrkNo());
@@ -756,6 +780,9 @@
                 if (Objects.equals(stationProtocol.getStationId(), wrkMast.getStaNo())) {
                     continue;
                 }
+                if (countCurrentTaskBufferCommands(stationProtocol.getTaskBufferItems(), stationProtocol.getTaskNo()) > 0) {
+                    continue;
+                }
 
                 Double pathLenFactor = resolveOutboundPathLenFactor(wrkMast);
                 OutOrderDispatchDecision dispatchDecision = resolveOutboundDispatchDecision(
@@ -783,6 +810,7 @@
                 if (!tryAcquireOutOrderDispatchLock(wrkMast.getWrkNo(), stationProtocol.getStationId())) {
                     continue;
                 }
+                resetSegmentMoveCommandsBeforeReroute(wrkMast.getWrkNo());
                 syncOutOrderWatchState(wrkMast, stationProtocol.getStationId(), outOrderList, dispatchDecision, command);
                 offerDevpCommandWithDedup(basDevp.getDevpNo(), command, "watchCircleStation");
             }
@@ -1259,6 +1287,15 @@
         return command != null && stationId != null && stationId.equals(command.getTargetStaNo());
     }
 
+    private boolean isWatchingCircleTransit(Integer wrkNo, Integer stationId) {
+        StationCommand command = getWatchCircleCommand(wrkNo);
+        if (command == null || stationId == null || Objects.equals(stationId, command.getTargetStaNo())) {
+            return false;
+        }
+        List<Integer> navigatePath = command.getNavigatePath();
+        return navigatePath != null && navigatePath.contains(stationId);
+    }
+
     private StationCommand getWatchCircleCommand(Integer wrkNo) {
         if (wrkNo == null || wrkNo <= 0) {
             return null;

--
Gitblit v1.9.1