#
Junjie
1 天以前 715a556c62dddf22e8a6a2154473977915fb2e80
src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
@@ -128,8 +128,6 @@
            boolean initialized = false;
            // 上一步执行时间(用于堵塞检测)
            long stepExecuteTime = System.currentTimeMillis();
            // 避免在到达目标后重复执行到位逻辑
            boolean arrivalHandled = false;
            while (true) {
                if (Thread.currentThread().isInterrupted()) {
@@ -150,7 +148,6 @@
                    Integer commandTargetStationId = command.getTargetStaNo();
                    if (commandTargetStationId != null) {
                        if (!commandTargetStationId.equals(finalTargetStationId)) {
                            arrivalHandled = false;
                            News.info("[WCS Debug] 任务{}切换目标: {} -> {}", taskNo, finalTargetStationId,
                                    commandTargetStationId);
                        }
@@ -235,7 +232,6 @@
                            currentStationId = nextStationId;
                            pendingPathQueue.poll();
                            stepExecuteTime = System.currentTimeMillis();
                            arrivalHandled = false;
                            News.info("[WCS Debug] 任务{}移动到站点: {}, 剩余队列: {}", taskNo, currentStationId,
                                    pendingPathQueue.size());
                            sleep(1000); // 模拟移动耗时
@@ -265,17 +261,18 @@
                    // 路径队列为空,等待新的分段命令
                    if (currentStationId != null && finalTargetStationId != null
                            && currentStationId.equals(finalTargetStationId)) {
                        // 已到达目标,先执行一次到位逻辑,然后继续等待下一条移动命令
                        if (!arrivalHandled) {
                            if (generateBarcode) {
                                Integer targetDeviceNo = getDeviceNoByStationId(finalTargetStationId);
                                if (targetDeviceNo != null) {
                                    generateStationBarcode(taskNo, finalTargetStationId, targetDeviceNo);
                                    News.info("[WCS Debug] 任务{}到达目标{}并生成条码", taskNo, finalTargetStationId);
                                }
                        // 已到达目标:立即清空当前队列并结束本轮执行,后续新命令重新创建执行线程
                        if (generateBarcode) {
                            Integer targetDeviceNo = getDeviceNoByStationId(finalTargetStationId);
                            if (targetDeviceNo != null) {
                                generateStationBarcode(taskNo, finalTargetStationId, targetDeviceNo);
                                News.info("[WCS Debug] 任务{}到达目标{}并生成条码", taskNo, finalTargetStationId);
                            }
                            arrivalHandled = true;
                        }
                        commandQueue.clear();
                        pendingPathQueue.clear();
                        News.info("[WCS Debug] 任务{}到达目标后清空队列并结束,等待后续新命令重启", taskNo);
                        break;
                    }
                    // 继续等待新的分段命令