From 02551a6a9aa82dd483fe059890767853f15ee172 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 25 三月 2026 18:49:21 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java | 89 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 82 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
index c54062f..48749d6 100644
--- a/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
+++ b/src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -20,6 +20,7 @@
import com.zy.common.utils.NavigateUtils;
import com.zy.common.utils.RedisUtil;
import com.zy.core.move.StationMoveCoordinator;
+import com.zy.core.move.StationMoveDispatchMode;
import com.zy.core.move.StationMoveSession;
import com.zy.core.News;
import com.zy.core.cache.MessageQueue;
@@ -162,7 +163,16 @@
wrkMast.setModiTime(now);
if (wrkMastService.updateById(wrkMast)) {
wrkAnalysisService.markInboundStationStart(wrkMast, now);
- offerDevpCommandWithDedup(basDevp.getDevpNo(), command, "stationInExecute");
+ boolean offered = offerDevpCommandWithDedup(basDevp.getDevpNo(), command, "stationInExecute");
+ if (offered && stationMoveCoordinator != null) {
+ stationMoveCoordinator.recordDispatch(
+ wrkMast.getWrkNo(),
+ stationProtocol.getStationId(),
+ "stationInExecute",
+ command,
+ false
+ );
+ }
News.info("杈撻�佺珯鐐瑰叆搴撳懡浠や笅鍙戞垚鍔燂紝绔欑偣鍙�={}锛屽伐浣滃彿={}锛屽懡浠ゆ暟鎹�={}", stationId, wrkMast.getWrkNo(), JSON.toJSONString(command));
redisUtil.set(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId, "lock", 5);
loadGuardState.reserveLoopTask(loopHitResult.getLoopNo());
@@ -333,7 +343,16 @@
wrkMast.setSystemMsg("");
wrkMast.setIoTime(new Date());
if (wrkMastService.updateById(wrkMast)) {
- offerDevpCommandWithDedup(stationObjModel.getDeviceNo(), command, "dualCrnStationOutExecute");
+ boolean offered = offerDevpCommandWithDedup(stationObjModel.getDeviceNo(), command, "dualCrnStationOutExecute");
+ if (offered && stationMoveCoordinator != null) {
+ stationMoveCoordinator.recordDispatch(
+ wrkMast.getWrkNo(),
+ stationProtocol.getStationId(),
+ "dualCrnStationOutExecute",
+ command,
+ false
+ );
+ }
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);
@@ -499,6 +518,7 @@
pathLenFactor,
"checkStationRunBlock_reroute"
).withRunBlockCommand()
+ .withSuppressDispatchGuard()
.withCancelSessionBeforeDispatch()
.withResetSegmentCommandsBeforeDispatch();
executeSharedReroute(context);
@@ -583,6 +603,10 @@
continue;
}
+ if (stationProtocol.isRunBlock()) {
+ continue;
+ }
+
if (!stationProtocol.getStationId().equals(stationProtocol.getTargetStaNo())) {
continue;
}
@@ -595,6 +619,9 @@
continue;
}
if (Objects.equals(stationProtocol.getStationId(), wrkMast.getStaNo())) {
+ continue;
+ }
+ if (shouldSkipOutOrderDispatchForExistingRoute(wrkMast.getWrkNo(), stationProtocol.getStationId())) {
continue;
}
@@ -641,11 +668,7 @@
continue;
}
- StationCommand circleCommand = getWatchCircleCommand(stationProtocol.getTaskNo());
- if (circleCommand == null) {
- continue;
- }
- if (!stationProtocol.getStationId().equals(circleCommand.getTargetStaNo())) {
+ if (!isWatchingCircleArrival(stationProtocol.getTaskNo(), stationProtocol.getStationId())) {
continue;
}
@@ -789,6 +812,14 @@
&& stationMoveCoordinator != null
&& stationMoveCoordinator.shouldSuppressDispatch(taskNo, stationId, plan.command())) {
return RerouteExecutionResult.skip("dispatch-suppressed");
+ }
+ if (context.sceneType() == RerouteSceneType.RUN_BLOCK_REROUTE
+ && shouldSkipRunBlockRerouteForExistingSession(taskNo, stationId, plan.command())) {
+ News.info("杈撻�佺珯鐐瑰牭濉為噸瑙勫垝鍛戒腑宸茬敓鏁堝悓璺緞璺嚎锛屽凡璺宠繃閲嶅涓嬪彂銆傜珯鐐瑰彿={}锛屽伐浣滃彿={}锛岀洰鏍囩珯={}",
+ stationId,
+ taskNo,
+ plan.command().getTargetStaNo());
+ return RerouteExecutionResult.skip("run-block-same-path");
}
if (context.requireOutOrderDispatchLock()
&& !tryAcquireOutOrderDispatchLock(taskNo, stationId)) {
@@ -1352,6 +1383,50 @@
return true;
}
+ private boolean shouldSkipOutOrderDispatchForExistingRoute(Integer wrkNo, Integer stationId) {
+ if (stationMoveCoordinator == null || wrkNo == null || wrkNo <= 0 || stationId == null) {
+ return false;
+ }
+ StationMoveSession session = stationMoveCoordinator.loadSession(wrkNo);
+ if (session == null) {
+ return false;
+ }
+ boolean protectedStatus = session.isActive() || StationMoveSession.STATUS_BLOCKED.equals(session.getStatus());
+ if (!protectedStatus || !session.containsStation(stationId)) {
+ return false;
+ }
+ if (StationMoveDispatchMode.CIRCLE == session.getDispatchMode()) {
+ return true;
+ }
+ return !Objects.equals(stationId, session.getCurrentRouteTargetStationId());
+ }
+
+ private boolean shouldSkipRunBlockRerouteForExistingSession(Integer wrkNo,
+ Integer stationId,
+ StationCommand candidateCommand) {
+ if (stationMoveCoordinator == null
+ || wrkNo == null || wrkNo <= 0
+ || stationId == null
+ || candidateCommand == null) {
+ return false;
+ }
+ StationMoveSession session = stationMoveCoordinator.loadSession(wrkNo);
+ if (session == null) {
+ return false;
+ }
+ boolean protectedStatus = session.isActive() || StationMoveSession.STATUS_BLOCKED.equals(session.getStatus());
+ if (!protectedStatus) {
+ return false;
+ }
+ boolean sameDispatchStation = Objects.equals(stationId, session.getCurrentStationId())
+ || Objects.equals(stationId, session.getDispatchStationId());
+ if (!sameDispatchStation) {
+ return false;
+ }
+ String candidateSignature = stationMoveCoordinator.buildPathSignature(candidateCommand);
+ return !isBlank(candidateSignature) && Objects.equals(candidateSignature, session.getPathSignature());
+ }
+
private boolean isWatchingCircleArrival(Integer wrkNo, Integer stationId) {
if (stationMoveCoordinator != null) {
StationMoveSession session = stationMoveCoordinator.loadSession(wrkNo);
--
Gitblit v1.9.1