From 802e2b36bb16d3f169b00652ccc65fd361082451 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 21 三月 2026 14:58:17 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/impl/ZyStationV4Thread.java | 67 ++++++++++++++++++++-------------
1 files changed, 41 insertions(+), 26 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/impl/ZyStationV4Thread.java b/src/main/java/com/zy/core/thread/impl/ZyStationV4Thread.java
index 2cfd566..19b3642 100644
--- a/src/main/java/com/zy/core/thread/impl/ZyStationV4Thread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZyStationV4Thread.java
@@ -240,6 +240,11 @@
liftTransferPath.add(stationNo);
}
}
+ if (path.isEmpty()) {
+ log.warn("杈撻�佺嚎鍛戒护鐢熸垚澶辫触锛岃矾寰勪负绌猴紝taskNo={}, stationId={}, targetStationId={}",
+ taskNo, stationId, targetStationId);
+ return null;
+ }
stationCommand.setNavigatePath(path);
stationCommand.setLiftTransferPath(liftTransferPath);
}
@@ -378,20 +383,8 @@
}
int segCursor = 0;
- while (true) {
- CommandResponse commandResponse = sendCommand(segmentCommands.get(segCursor));
- if (commandResponse == null) {
- try {
- Thread.sleep(200);
- } catch (Exception ignore) {}
- continue;
- }
- if (commandResponse.getResult()) {
- break;
- }
- try {
- Thread.sleep(200);
- } catch (Exception ignore) {}
+ if (!sendSegmentWithRetry(segmentCommands.get(segCursor), original.getTaskNo())) {
+ return;
}
long runTime = System.currentTimeMillis();
@@ -432,18 +425,8 @@
int thresholdSegment = (int) Math.ceil(segLen * segmentAdvanceRatio);
if (remainingSegment <= thresholdSegment && segCursor < segmentCommands.size() - 1) {
segCursor++;
- while (true) {
- CommandResponse commandResponse = sendCommand(segmentCommands.get(segCursor));
- if (commandResponse == null) {
- Thread.sleep(200);
- continue;
- }
-
- if (commandResponse.getResult()) {
- break;
- }
-
- Thread.sleep(200);
+ if (!sendSegmentWithRetry(segmentCommands.get(segCursor), original.getTaskNo())) {
+ break;
}
}
Thread.sleep(500);
@@ -530,4 +513,36 @@
}
return null;
}
+
+ private boolean sendSegmentWithRetry(StationCommand command, Integer taskNo) {
+ while (true) {
+ if (isTaskMoveReset(taskNo)) {
+ return false;
+ }
+ CommandResponse commandResponse = sendCommand(command);
+ if (commandResponse == null) {
+ sleepQuietly(200L);
+ continue;
+ }
+ if (commandResponse.getResult()) {
+ return true;
+ }
+ sleepQuietly(200L);
+ }
+ }
+
+ private boolean isTaskMoveReset(Integer taskNo) {
+ if (taskNo == null || redisUtil == null) {
+ return false;
+ }
+ Object cancel = redisUtil.get(RedisKeyType.DEVICE_STATION_MOVE_RESET.key + taskNo);
+ return cancel != null;
+ }
+
+ private void sleepQuietly(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (Exception ignore) {
+ }
+ }
}
--
Gitblit v1.9.1