From d2dbfe9ac555029ac6332703912ac7b753304aaf Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 06 三月 2026 15:52:01 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java b/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java
index 99d4dd9..6233e0c 100644
--- a/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyStationFakeConnect.java
@@ -129,6 +129,10 @@
         }
 
         if(commandType == StationCommandType.WRITE_INFO){
+            if (command.getBarcode() != null) {
+                updateStationBarcode(deviceNo, stationId, command.getBarcode());
+                return;
+            }
             if (taskNo == 9998 && targetStationId == 0) {
                 //鐢熸垚鍑哄簱绔欑偣浠跨湡鏁版嵁
                 generateFakeOutStationData(deviceNo, stationId);
@@ -199,6 +203,23 @@
         }
     }
 
+    private void updateStationBarcode(Integer deviceNo, Integer stationId, String barcode) {
+        List<ZyStationStatusEntity> statusList = deviceStatusMap.get(deviceNo);
+        if (statusList == null) {
+            return;
+        }
+
+        ZyStationStatusEntity status = statusList.stream()
+                .filter(item -> item.getStationId().equals(stationId)).findFirst().orElse(null);
+        if (status == null) {
+            return;
+        }
+
+        synchronized (status) {
+            status.setBarcode(barcode);
+        }
+    }
+
     private void currentLevCommand(StationCommand command, boolean generateBarcode) {
         NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class);
         if (navigateUtils == null) {
@@ -209,14 +230,14 @@
         Integer stationId = command.getStationId();
         Integer targetStationId = command.getTargetStaNo();
 
-        List<NavigateNode> navigateNodes = null;
+        List<NavigateNode> navigateNodes = new ArrayList<>();
         try {
             navigateNodes = navigateUtils.calcByStationId(stationId, targetStationId);
         } catch (Exception e) {
             e.printStackTrace();
         }
 
-        if (navigateNodes == null) {
+        if (navigateNodes.isEmpty()) {
             return;
         }
 
@@ -237,8 +258,8 @@
         Integer stationId = command.getStationId();
         Integer targetStationId = command.getTargetStaNo();
 
-        List<NavigateNode> navigateNodes = null;
-        List<NavigateNode> targetNavigateNodes = null;
+        List<NavigateNode> navigateNodes = new ArrayList<>();
+        List<NavigateNode> targetNavigateNodes = new ArrayList<>();
 
         try {
             BasStation startStation = basStationService.selectById(stationId);
@@ -287,14 +308,22 @@
                     continue;
                 }
 
-                navigateNodes = navigateUtils.calcByStationId(stationId, liftStationId);
-                if(navigateNodes == null){
+                try {
+                    navigateNodes = navigateUtils.calcByStationId(stationId, liftStationId);
+                } catch (Exception e) {
+
+                }
+                if(navigateNodes.isEmpty()){
                     continue;
                 }
 
-                //璁$畻鎻愬崌鏈哄埌鐩爣绔欑殑璺緞
-                targetNavigateNodes = navigateUtils.calcByStationId(targetLiftStationId, targetStationId);
-                if(targetNavigateNodes == null) {
+                try {
+                    //璁$畻鎻愬崌鏈哄埌鐩爣绔欑殑璺緞
+                    targetNavigateNodes = navigateUtils.calcByStationId(targetLiftStationId, targetStationId);
+                } catch (Exception e) {
+
+                }
+                if(targetNavigateNodes.isEmpty()) {
                     continue;
                 }
             }
@@ -302,7 +331,7 @@
             e.printStackTrace();
         }
 
-        if (navigateNodes == null || targetNavigateNodes == null) {
+        if (navigateNodes.isEmpty() || targetNavigateNodes.isEmpty()) {
             return;
         }
 

--
Gitblit v1.9.1