From a40b871aa511865d1a7363c88ffb733f6b084d35 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 02 三月 2026 17:14:15 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java | 44 +++++++++++++++++++++++++++++++-------------
1 files changed, 31 insertions(+), 13 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..b5a077f 100644
--- a/src/main/java/com/zy/core/network/fake/ZyStationFakeSegConnect.java
+++ b/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;
}
// 缁х画绛夊緟鏂扮殑鍒嗘鍛戒护
@@ -414,6 +411,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 +470,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