From 873941c1a6c4aefe7e172be973865957b0ae4378 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 19 三月 2026 15:21:44 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 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 a39b1b7..e6bd3be 100644
--- a/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
@@ -128,7 +128,7 @@
             boolean initialized = false;
             // 涓婁竴姝ユ墽琛屾椂闂达紙鐢ㄤ簬鍫靛妫�娴嬶級
             long stepExecuteTime = System.currentTimeMillis();
-            // 閬垮厤鍦ㄥ埌杈剧洰鏍囧悗閲嶅鎵ц鍒颁綅閫昏緫
+            // 浠呭湪姣忔鍒拌揪鐩爣鏃舵墽琛屼竴娆″埌浣嶅鐞嗭紝閬垮厤閲嶅鐢熸垚鏉$爜
             boolean arrivalHandled = false;
 
             while (true) {
@@ -265,7 +265,7 @@
                     // 璺緞闃熷垪涓虹┖锛岀瓑寰呮柊鐨勫垎娈靛懡浠�
                     if (currentStationId != null && finalTargetStationId != null
                             && currentStationId.equals(finalTargetStationId)) {
-                        // 宸插埌杈剧洰鏍囷紝鍏堟墽琛屼竴娆″埌浣嶉�昏緫锛岀劧鍚庣户缁瓑寰呬笅涓�鏉$Щ鍔ㄥ懡浠�
+                        // 宸插埌杈惧綋鍓嶇洰鏍囧悗缁х画绛夊緟涓嬩竴鏉″垎娈靛懡浠わ紝閬垮厤鎺掑簭/缁曞湀鍦烘櫙鍚炴帀鍚庣画鍛戒护
                         if (!arrivalHandled) {
                             if (generateBarcode) {
                                 Integer targetDeviceNo = getDeviceNoByStationId(finalTargetStationId);
@@ -414,6 +414,10 @@
         }
 
         if (command.getCommandType() == StationCommandType.WRITE_INFO) {
+            if (command.getBarcode() != null) {
+                updateStationBarcode(deviceNo, stationId, command.getBarcode());
+                return;
+            }
             if (taskNo == 9998 && targetStationId == 0) {
                 // 鐢熸垚鍑哄簱绔欑偣浠跨湡鏁版嵁
                 generateFakeOutStationData(deviceNo, stationId);
@@ -469,6 +473,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);
+        }
+    }
+
     // segmentedPathCommand 鏂规硶宸插垹闄わ紝鍔熻兘宸叉暣鍚堝埌 runTaskLoop
 
     private Integer getDeviceNoByStationId(Integer stationId) {

--
Gitblit v1.9.1