From 4da282d3a87fb648ae6865929f5862b27d05a562 Mon Sep 17 00:00:00 2001
From: cpT <1@123>
Date: 星期四, 03 七月 2025 15:07:25 +0800
Subject: [PATCH] #改造

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

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index a2fd278..d56487d 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -321,25 +321,45 @@
                 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};
 
         //鏉$爜
 //        Thread.sleep(50);
         OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB400.100.0",(short) (barcodeSize*8));
         if (result2.IsSuccess) {
             for (int i = 0; i < barcodeSize; i++) {
+                Integer siteId = staW[i]; // 绔欑偣缂栧彿
+                StaProtocol staProtocol = station.get(siteId);
+                if (null == staProtocol) {
+                    staProtocol = new StaProtocol();
+                    station.put(siteId, staProtocol);
+                }
                 String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,6, "UTF-8");
                 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
                 if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
                     barcodeThread.setBarcode(barcode);
+                    if (!Cools.isEmpty(barcode) && !barcode.equals("000000")){
+                        staProtocol.setBarcodeNow(barcode);
+                    } else if (Cools.isEmpty(barcode)){
+                        staProtocol.setBarcodeNow("-");
+                    }
                 }
+
             }
         }
 
         //鏉$爜
 //        Thread.sleep(50);
-        int[] staW = new int[]{1004,1014,1020};
 
         OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB400.148.0",(short) (staW.length*4));
         if (result3.IsSuccess) {
@@ -357,7 +377,36 @@
                 staProtocol.setHighErr(status[2]);  // 楂樿秴闄�
                 staProtocol.setLeftErr(status[3]);  // 宸﹁秴闄�
                 staProtocol.setRightErr(status[4]); // 鍙宠秴闄�
+                staProtocol.setWeightErr(status[5]); // 瓒呴噸
+                staProtocol.setBarcodeErr(status[6]); // 鎵爜澶辫触
             }
+        }
+
+        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.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) {
@@ -575,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