From 3ab7b0a81b52270edaedfdfe0b2c2ca652d41e39 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 28 十一月 2022 11:44:20 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   60 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 0bf2be1..e346c6f 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -56,7 +56,7 @@
     /**
      * 鏉$爜鏁伴噺
      */
-    private int barcodeSize = 3;
+    private int barcodeSize = 4;
 
     /**
      * 鍏ュ嚭搴撴ā寮�
@@ -204,23 +204,47 @@
 //            }
 //        }
         Thread.sleep(200);
-        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.100", (short) (staNoSize));
-        if (result1.IsSuccess) {
-            for (int i = 0; i < staNoSize; i++) {
-                Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
-                boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i, 1);
-                StaProtocol staProtocol = station.get(siteId);
-                staProtocol.setAutoing(status[0]);  // 鑷姩
-                staProtocol.setLoading(status[1]);  // 鏈夌墿
-                staProtocol.setInEnable(status[2]); // 鍙叆
-                staProtocol.setOutEnable(status[3]);// 鍙嚭
-                staProtocol.setEmptyMk(status[4]);  // 绌烘澘淇″彿
-                staProtocol.setFullPlt(status[5]);  // 婊℃墭鐩�
-                staProtocol.setHigh(status[6]);     // 楂樺簱浣�
-                staProtocol.setLow(status[7]);      // 浣庡簱浣�
+        OperateResultExOne<byte[]> result1 = null;
+        if(slave.getId()==1) {
+            result1 = siemensS7Net.Read("DB100.100", (short) (staNoSize));
+            if (result1.IsSuccess) {
+                for (int i = 0; i < staNoSize; i++) {
+                    Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+                    boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i, 1);
+                    StaProtocol staProtocol = station.get(siteId);
+                    staProtocol.setAutoing(status[0]);  // 鑷姩
+                    staProtocol.setLoading(status[1]);  // 鏈夌墿
+                    staProtocol.setInEnable(status[2]); // 鍙叆
+                    staProtocol.setOutEnable(status[3]);// 鍙嚭
+                    staProtocol.setEmptyMk(status[4]);  // 绌烘澘淇″彿
+                    staProtocol.setFullPlt(status[5]);  // 婊℃墭鐩�
+                    staProtocol.setHigh(status[6]);     // 楂樺簱浣�
+                    staProtocol.setLow(status[7]);      // 浣庡簱浣�
 
-                if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
-                    staProtocol.setPakMk(true);
+                    if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
+                        staProtocol.setPakMk(true);
+                    }
+                }
+            }
+        } else if(slave.getId()==2) {
+            result1 = siemensS7Net.Read("DB100.100", (short) (staNoSize * 2));
+            if (result1.IsSuccess) {
+                for (int i = 0; i < staNoSize; i++) {
+                    Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+                    boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i * 2, 1);
+                    StaProtocol staProtocol = station.get(siteId);
+                    staProtocol.setAutoing(status[0]);  // 鑷姩
+                    staProtocol.setLoading(status[1]);  // 鏈夌墿
+                    staProtocol.setInEnable(status[2]); // 鍙叆
+                    staProtocol.setOutEnable(status[3]);// 鍙嚭
+                    staProtocol.setEmptyMk(status[4]);  // 绌烘澘淇″彿
+                    staProtocol.setFullPlt(status[5]);  // 婊℃墭鐩�
+                    staProtocol.setHigh(status[6]);     // 楂樺簱浣�
+                    staProtocol.setLow(status[7]);      // 浣庡簱浣�
+
+                    if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
+                        staProtocol.setPakMk(true);
+                    }
                 }
             }
         }
@@ -243,7 +267,7 @@
 //            this.ioMode = IoModeType.get(result2.Content);
 //        }
 
-        if (result.IsSuccess && result1.IsSuccess) {
+        if (result.IsSuccess && !Cools.isEmpty(result1) && result1.IsSuccess) {
 
             OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
 

--
Gitblit v1.9.1