From ef1cd5823fe7cf724e1de875a1a5737a44f160f1 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期四, 15 一月 2026 13:11:12 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/impl/ZyStationV3Thread.java |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/impl/ZyStationV3Thread.java b/src/main/java/com/zy/core/thread/impl/ZyStationV3Thread.java
index 7f518aa..92cadb7 100644
--- a/src/main/java/com/zy/core/thread/impl/ZyStationV3Thread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZyStationV3Thread.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.DateUtils;
 import com.core.common.SpringUtils;
@@ -295,10 +296,7 @@
         }
 
         if(original.getCommandType() == StationCommandType.MOVE){
-            List<Integer> path = original.getNavigatePath();
-            if (path == null || path.isEmpty()) {
-                path = calcPathStationIds(original.getStationId(), original.getTargetStaNo());
-            }
+            List<Integer> path = JSON.parseArray(JSON.toJSONString(original.getNavigatePath(), SerializerFeature.DisableCircularReferenceDetect), Integer.class);
             if (path == null || path.isEmpty()) {
                 return;
             }
@@ -329,6 +327,7 @@
             sendCommand(segCmd);
 
             long runTime = System.currentTimeMillis();
+            boolean firstRun = true;
             while (true) {
                 try {
                     StationProtocol currentStation = findCurrentStationByTask(original.getTaskNo());
@@ -341,7 +340,7 @@
                     }
 
                     runTime = System.currentTimeMillis();
-                    if (currentStation.isRunBlock()) {
+                    if (!firstRun && currentStation.isRunBlock()) {
                         break;
                     }
                     int currentIndex = path.indexOf(currentStation.getStationId());
@@ -370,12 +369,26 @@
                         nextCmd.setCommandType(original.getCommandType());
                         nextCmd.setPalletSize(original.getPalletSize());
                         nextCmd.setNavigatePath(new ArrayList<>(path.subList(currentStartIdx, currentEndIdx + 1)));
-                        sendCommand(nextCmd);
+                        nextCmd.setOriginalNavigatePath(path);
+                        while (true) {
+                            CommandResponse commandResponse = sendCommand(nextCmd);
+                            if (commandResponse == null) {
+                                Thread.sleep(200);
+                                continue;
+                            }
+
+                            if (commandResponse.getResult()) {
+                                break;
+                            }
+
+                            Thread.sleep(200);
+                        }
                     }
                     Thread.sleep(500);
                 } catch (Exception e) {
                     break;
                 }
+                firstRun = false;
             }
         }else {
             sendCommand(original);

--
Gitblit v1.9.1