From a77530a0e917f8d2dca1bae55a3730471c8e10a2 Mon Sep 17 00:00:00 2001
From: cpT <1@123>
Date: 星期三, 02 七月 2025 09:22:32 +0800
Subject: [PATCH] #改造

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   70 +++++++++++++++++++++++++++++-----
 1 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 890e381..d56487d 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -321,6 +321,14 @@
                 if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
                     staProtocol.setPakMk(true);
                 }
+
+                if (!staProtocol.isPakMkRun() && !staProtocol.isLoading()) {
+                    staProtocol.setPakMkRun(true);
+                }
+
+                if (!staProtocol.isPakMkTask() && !staProtocol.isLoading()) {
+                    staProtocol.setPakMkTask(true);
+                }
             }
         }
         int[] staW = new int[]{1004,1014,1020};
@@ -340,8 +348,10 @@
                 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
                 if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
                     barcodeThread.setBarcode(barcode);
-                    if (!barcode.equals("000000")){
+                    if (!Cools.isEmpty(barcode) && !barcode.equals("000000")){
                         staProtocol.setBarcodeNow(barcode);
+                    } else if (Cools.isEmpty(barcode)){
+                        staProtocol.setBarcodeNow("-");
                     }
                 }
 
@@ -352,7 +362,6 @@
 //        Thread.sleep(50);
 
         OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB400.148.0",(short) (staW.length*4));
-        OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0",(short) (staW.length*4));
         if (result3.IsSuccess) {
             for (int i = 0; i < staW.length; i++) {
                 Integer siteId = staW[i]; // 绔欑偣缂栧彿
@@ -370,18 +379,34 @@
                 staProtocol.setRightErr(status[4]); // 鍙宠秴闄�
                 staProtocol.setWeightErr(status[5]); // 瓒呴噸
                 staProtocol.setBarcodeErr(status[6]); // 鎵爜澶辫触
-                if (resultErr.IsSuccess){
-                    boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4 + 2, 2);
+            }
+        }
+
+        try{
+            OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0",(short) (staNoSize*4));
+            if (resultErr.IsSuccess){
+                for (int i = 0; i < staNoSize; i++) {
+                    Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+                    StaProtocol staProtocol = station.get(siteId);
+                    if (null == staProtocol) {
+                        staProtocol = new StaProtocol();
+                        staProtocol.setSiteId(siteId);
+                        station.put(siteId, staProtocol);
+                    }
+                    staProtocol.setSiteId(siteId);
+                    boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4, 1);
                     staProtocol.setErrOther1(statusErr[0]);  // 鐢佃矾淇濇姢鍣ㄦ柇寮�
-                    staProtocol.setErrOther1(statusErr[1]);  // 鍏夌數寮傚父
-                    staProtocol.setErrOther1(statusErr[2]);  // 杩愯瓒呮椂
-                    staProtocol.setErrOther1(statusErr[3]);  // 鍗犱綅瓒呮椂
-                    staProtocol.setErrOther1(statusErr[4]);  // 鏈変换鍔℃棤璐ф晠闅�
-                    staProtocol.setErrOther1(statusErr[5]);  // 鍙橀鍣ㄦ晠闅�
-                    staProtocol.setErrOther1(statusErr[6]);  // 鎺ヨЕ鍣ㄦ晠闅�
-                    staProtocol.setErrOther1(statusErr[7]);  // 椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�
+                    staProtocol.setErrOther2(statusErr[1]);  // 鍏夌數寮傚父
+                    staProtocol.setErrOther3(statusErr[2]);  // 杩愯瓒呮椂
+                    staProtocol.setErrOther4(statusErr[3]);  // 鍗犱綅瓒呮椂
+                    staProtocol.setErrOther5(statusErr[4]);  // 鏈変换鍔℃棤璐ф晠闅�
+                    staProtocol.setErrOther6(statusErr[5]);  // 鍙橀鍣ㄦ晠闅�
+                    staProtocol.setErrOther7(statusErr[6]);  // 鎺ヨЕ鍣ㄦ晠闅�
+                    staProtocol.setErrOther8(statusErr[7]);  // 椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�
                 }
             }
+        } catch (Exception e){
+
         }
 
         if (result.IsSuccess) {
@@ -599,6 +624,29 @@
         }
     }
 
+
+    /**
+     * 璁剧疆鍏ュ簱鏍囪
+     */
+    @Override
+    public void setPakMkTask(Integer siteId, boolean pakMk) {
+        StaProtocol staProtocol = station.get(siteId);
+        if (null != staProtocol) {
+            staProtocol.setPakMkTask(pakMk);
+        }
+    }
+
+
+    /**
+     * 璁剧疆鍏ュ簱鏍囪
+     */
+    @Override
+    public void setPakMkRun(Integer siteId, boolean pakMk) {
+        StaProtocol staProtocol = station.get(siteId);
+        if (null != staProtocol) {
+            staProtocol.setPakMkRun(pakMk);
+        }
+    }
     /**
      * 璁剧疆鍏ュ簱鏍囪
      */

--
Gitblit v1.9.1