From 236edf0559e2d5a6031b1df56a69454baa0357e5 Mon Sep 17 00:00:00 2001
From: zzgtfwq <zzgtfwq>
Date: 星期二, 09 十二月 2025 14:26:44 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 917d3da..ba4aeeb 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -55,6 +55,13 @@
         add(211);add(212);add(213);add(214);add(215);add(216);add(217);add(218);add(219);add(220);
         add(221);add(222);add(224);add(225);
     }};
+    public static final ArrayList<Integer> staNos1W = new ArrayList<Integer>() {{
+        add(118);add(121);add(124);
+    }};
+
+    public static final ArrayList<Integer> staNos2W = new ArrayList<Integer>() {{
+        add(218);add(221);add(224);
+    }};
     private boolean connectDev = false;
     public Long currentTimeMilliConnectDev= 0L;
 
@@ -80,6 +87,16 @@
                 return staNos1;
             case 2:
                 return staNos2;
+            default:
+                throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
+        }
+    }
+    private ArrayList<Integer> getStaNoW() {
+        switch (slave.getId()) {
+            case 1:
+                return staNos1W;
+            case 2:
+                return staNos2W;
             default:
                 throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
         }
@@ -320,24 +337,24 @@
                 }
             }
         }
-        int[] staW = new int[]{1004,1014,1020};
+        ArrayList<Integer> staW = getStaNoW();
 
         //鏉$爜
 //        Thread.sleep(50);
-        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB400.100.0",(short) (barcodeSize*8));
+        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.212",(short) (barcodeSize*8));
         if (result2.IsSuccess) {
             for (int i = 0; i < barcodeSize; i++) {
-                Integer siteId = staW[i]; // 绔欑偣缂栧彿
+                Integer siteId = staW.get(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);
+                String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8");
+                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1+3*slave.getId());
                 if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
                     barcodeThread.setBarcode(barcode);
-                    if (!Cools.isEmpty(barcode) && !barcode.equals("000000")){
+                    if (!Cools.isEmpty(barcode) && !barcode.equals("00000000")){
                         staProtocol.setBarcodeNow(barcode);
                     } else if (Cools.isEmpty(barcode)){
                         staProtocol.setBarcodeNow("-");
@@ -350,10 +367,10 @@
         //鏉$爜
 //        Thread.sleep(50);
 
-        OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB400.148.0",(short) (staW.length*4));
+        OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB101.200",(short) (staW.size()*4));
         if (result3.IsSuccess) {
-            for (int i = 0; i < staW.length; i++) {
-                Integer siteId = staW[i]; // 绔欑偣缂栧彿
+            for (int i = 0; i < staW.size(); i++) {
+                Integer siteId = staW.get(i); // 绔欑偣缂栧彿
                 StaProtocol staProtocol = station.get(siteId);
                 if (null == staProtocol) {
                     staProtocol = new StaProtocol();

--
Gitblit v1.9.1