From 6e7005a9c8f0e9c21f2d3a4d77a779381e859ac3 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期六, 11 四月 2026 10:35:09 +0800
Subject: [PATCH] 1

---
 zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
index 4df073c..370550e 100644
--- a/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
+++ b/zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
@@ -181,6 +181,7 @@
             if (!Cools.isEmpty(barcode)) {
                 StaProtocol staProtocol = station.get(barcodeArr.get(i));
                 if (staProtocol == null) {
+                    log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), barcodeArr.get(i));
                     continue;
                 }
                 staProtocol.setBarcode(barcode);
@@ -209,10 +210,11 @@
         for (int i = 0; i < weightArr.size(); i++) {
             StaProtocol staProtocol = station.get(weightArr.get(i));
             if (staProtocol == null) {
+                log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), weightArr.get(i));
                 continue;
             }
-            double weight = siemensS7Net.getByteTransform().TransSingle(result.Content, i * 4);
-            staProtocol.setWeight(BigDecimal.valueOf(weight).setScale(2, RoundingMode.HALF_UP).doubleValue());
+            double weight = siemensS7Net.getByteTransform().TransSingle(result.Content, i * DeviceField.WEIGHT.getByteLength());
+            staProtocol.setWeight(BigDecimal.valueOf(weight).setScale(4, RoundingMode.HALF_UP).doubleValue());
         }
     }
 
@@ -238,6 +240,10 @@
         for (int i = 0; i < staNosError.size(); i++) {
             Integer siteId = staNosError.get(i);
             StaProtocol staProtocol = station.get(siteId);
+            if (staProtocol == null){
+                log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), staNosError.get(i));
+                continue;
+            }
 
             boolean[] status = siemensS7Net.getByteTransform().TransBool(
                     content, i * DeviceField.DIMENSION_WORD.getByteLength(),
@@ -271,6 +277,7 @@
             Integer siteId = staNos.get(i);
             StaProtocol staProtocol = station.get(siteId);
             if (staProtocol == null) {
+                log.warn("绔欑偣涓嶅瓨鍦� [id:{}] [staNo:{}]", slave.getId(), siteId);
                 continue;
             }
 

--
Gitblit v1.9.1