From f1bb341dab32e6ca83b453efa60fff729a89639d Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期六, 10 一月 2026 15:11:50 +0800
Subject: [PATCH] #1
---
src/main/java/com/zy/core/network/real/ZyStationRealConnect.java | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/zy/core/network/real/ZyStationRealConnect.java b/src/main/java/com/zy/core/network/real/ZyStationRealConnect.java
index 2083e72..a16bbea 100644
--- a/src/main/java/com/zy/core/network/real/ZyStationRealConnect.java
+++ b/src/main/java/com/zy/core/network/real/ZyStationRealConnect.java
@@ -121,9 +121,9 @@
if (statusEntity == null) {
continue;
}
- String barcode = siemensNet.getByteTransform().TransString(result2.Content, i * 16, 4, "UTF-8");
+ String barcode = siemensNet.getByteTransform().TransString(result2.Content, i * 16, 8, "UTF-8");
barcode = barcode.trim();
- barcodeEntity.setBarcode(barcode);
+ statusEntity.setBarcode(barcode);
}
}
@@ -144,16 +144,14 @@
return commandResponse;
}
- OperateResult write = null;
+ OperateResult writeTaskNo = null;
+ OperateResult writeTargetStaNo = null;
// 浠诲姟涓嬪彂娆℃暟
int writeCount = 0;
do {
- short[] data = new short[2];
- data[0] = command.getTaskNo().shortValue();
- data[1] = command.getTargetStaNo().shortValue();
-
- write = siemensNet.Write("DB100." + index * 4, data);
- if (write.IsSuccess) {
+ writeTaskNo = siemensNet.Write("DB100." + index * 4, command.getTaskNo());
+ writeTargetStaNo = siemensNet.Write("DB100." + index * 4 + 4, command.getTargetStaNo().shortValue());
+ if (writeTaskNo.IsSuccess && writeTargetStaNo.IsSuccess) {
log.error("鍐欏叆杈撻�佺嚎鍛戒护鎴愬姛銆傜珯鐐圭紪鍙�={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", command.getStationId(), JSON.toJSON(command),
writeCount);
commandResponse.setResult(true);
@@ -166,12 +164,7 @@
}
} while (writeCount < 5);
- if (write == null) {
- commandResponse.setMessage("鍐欏叆鍛戒护澶辫触");
- return commandResponse;
- }
-
- if (!write.IsSuccess) {
+ if (!writeTaskNo.IsSuccess || !writeTargetStaNo.IsSuccess) {
ZyStationStatusEntity staProtocol = findStatusEntity(command.getStationId());
OutputQueue.DEVP.offer(MessageFormat.format("鍐欏叆杈撻�佺嚎绔欑偣鏁版嵁澶辫触銆傜珯鐐圭紪鍙�={1}锛岀珯鐐规暟鎹�={2}", command.getStationId(),
JSON.toJSON(staProtocol)));
--
Gitblit v1.9.1