From bdf43f554f9bc7f0de94e7530e79af9193341334 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 19 三月 2026 15:38:49 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java | 43 +++++++++++++++++++++++++++++++++++++------
1 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java b/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
index e6bd3be..d2cfe98 100644
--- a/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
@@ -27,6 +27,7 @@
import java.util.Arrays;
public class ZyStationFakeSegConnect implements ZyStationConnectApi {
+ private static final long DEFAULT_FAKE_RUN_BLOCK_TIMEOUT_MS = 10000L;
// 绔欑偣绾ч攣锛氭瘡涓珯鐐圭嫭绔嬩竴鎶婇攣锛屾彁鍗囧苟鍙戞�ц兘
private final Map<Integer, ReentrantLock> stationLocks = new ConcurrentHashMap<>();
@@ -128,6 +129,7 @@
boolean initialized = false;
// 涓婁竴姝ユ墽琛屾椂闂达紙鐢ㄤ簬鍫靛妫�娴嬶級
long stepExecuteTime = System.currentTimeMillis();
+ long runBlockTimeoutMs = getFakeRunBlockTimeoutMs();
// 浠呭湪姣忔鍒拌揪鐩爣鏃舵墽琛屼竴娆″埌浣嶅鐞嗭紝閬垮厤閲嶅鐢熸垚鏉$爜
boolean arrivalHandled = false;
@@ -145,6 +147,15 @@
StationCommand command = commandQueue.poll(100, TimeUnit.MILLISECONDS);
if (command != null) {
taskLastUpdateTime.put(taskNo, System.currentTimeMillis());
+ List<Integer> newPath = command.getNavigatePath();
+ Integer lastInQueue = getLastInQueue(pendingPathQueue);
+ int startIndex = getPathAppendStartIndex(newPath, currentStationId, lastInQueue);
+
+ if (newPath != null && !newPath.isEmpty() && startIndex < 0) {
+ News.info("[WCS Debug] 浠诲姟{}蹇界暐鏃犳硶琛旀帴鐨勬棫璺緞娈�: {}, 褰撳墠浣嶇疆: {}, 闃熷垪灏�: {}", taskNo,
+ newPath, currentStationId, lastInQueue);
+ continue;
+ }
// 姣忔鎺ユ敹鍛戒护閮藉埛鏂扮洰鏍囷紝閬垮厤娌跨敤鏃х洰鏍囧鑷寸姸鎬佹姈鍔�
Integer commandTargetStationId = command.getTargetStaNo();
@@ -164,12 +175,7 @@
}
// 灏嗘柊璺緞杩藉姞鍒板緟鎵ц闃熷垪
- List<Integer> newPath = command.getNavigatePath();
if (newPath != null && !newPath.isEmpty()) {
- // 鑾峰彇闃熷垪涓渶鍚庝竴涓珯鐐癸紙鐢ㄤ簬琛旀帴鐐瑰幓閲嶏級
- Integer lastInQueue = getLastInQueue(pendingPathQueue);
- int startIndex = getPathAppendStartIndex(newPath, currentStationId, lastInQueue);
-
for (int i = startIndex; i < newPath.size(); i++) {
pendingPathQueue.offer(newPath.get(i));
}
@@ -244,7 +250,8 @@
if (!checkTaskNoInArea(taskNo)) {
boolean fakeAllowCheckBlock = getFakeAllowCheckBlock();
- if (fakeAllowCheckBlock && System.currentTimeMillis() - stepExecuteTime > 10000) {
+ if (fakeAllowCheckBlock
+ && System.currentTimeMillis() - stepExecuteTime > runBlockTimeoutMs) {
// 璁ゅ畾鍫靛
boolean result = runBlockStation(taskNo, currentStationId, currentDeviceNo, taskNo,
currentStationId);
@@ -330,6 +337,11 @@
if (idx >= 0) {
return idx + 1;
}
+ return -1;
+ }
+
+ if (lastInQueue != null) {
+ return -1;
}
return 0;
@@ -387,6 +399,25 @@
return fakeAllowCheckBlock;
}
+ private long getFakeRunBlockTimeoutMs() {
+ long timeoutMs = DEFAULT_FAKE_RUN_BLOCK_TIMEOUT_MS;
+ Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
+ if (systemConfigMapObj instanceof Map) {
+ Map<?, ?> systemConfigMap = (Map<?, ?>) systemConfigMapObj;
+ Object value = systemConfigMap.get("fakeRunBlockTimeoutMs");
+ if (value != null) {
+ try {
+ long parsed = Long.parseLong(String.valueOf(value).trim());
+ if (parsed > 0) {
+ timeoutMs = parsed;
+ }
+ } catch (Exception ignore) {
+ }
+ }
+ }
+ return timeoutMs;
+ }
+
@Override
public CommandResponse sendOriginCommand(String address, short[] data) {
return new CommandResponse(true, "鍘熷鍛戒护宸插彈鐞嗭紙寮傛鎵ц锛�");
--
Gitblit v1.9.1