From 0366280f46f26ef1a59ba23ac155d97c7de49d5f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 14 十二月 2023 11:30:30 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index f128698..99d6878 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -78,6 +78,18 @@
         add(343);add(344);
     }};
 
+    public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{//218
+        add(302);add(304);
+        add(315);add(322);
+        add(324);add(330);
+        add(332);add(337);
+    }};
+
+    public static final ArrayList<Integer> staNos4 = new ArrayList<Integer>() {{//250
+        add(318);add(320);
+        add(343);
+    }};
+
     //楂樹綆淇″彿绔欑偣
     public static final ArrayList<Integer> locType1StaNos = new ArrayList<Integer>() {{
         add(100);add(103);
@@ -270,25 +282,70 @@
             }
         }
 
-//        Thread.sleep(100);
-//        for (Integer staNo : staNos2) {
-//            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48);
-//            if (result5.IsSuccess) {
-//                StaProtocol staProtocol = station.get(staNo);
-//                if (null == staProtocol) {
-//                    staProtocol = new StaProtocol();
-//                    staProtocol.setSiteId(staNo);
-//                    station.put(staNo, staProtocol);
-//                }
-//
-//                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 8, 1);
-//                boolean[] status2 = siemensS7Net.getByteTransform().TransBool(result5.Content, 21, 1);
-//                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 34));     // 宸ヤ綔鍙�
-//                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 40));   // 鐩爣绔�
-//                staProtocol.setAutoing(status1[0]);  // 鑷姩
-//                staProtocol.setLoading(status2[2]);  // 鏈夌墿
-//            }
-//        }
+        Thread.sleep(100);
+        for (Integer staNo : staNos2) {
+            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".0", (short) 48);
+            if (result5.IsSuccess) {
+                StaProtocol staProtocol = station.get(staNo);
+                StaProtocol staProtocol300 = station.get(300);
+                if (null == staProtocol) {
+                    staProtocol = new StaProtocol();
+                    staProtocol.setSiteId(staNo);
+                    station.put(staNo, staProtocol);
+                }
+
+                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result5.Content, 1, 1);
+                staProtocol.setAutoing(staProtocol300.isAutoing());  // 鑷姩
+                staProtocol.setLoading(status1[2]);  // 鏈夌墿
+
+                if (staNos3.contains(staNo) || staNos4.contains(staNo)) {
+                    continue;
+                }
+                if (staNo == 344) {
+                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result5.Content, 34));     // 宸ヤ綔鍙�
+                }else {
+                    staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result5.Content, 22));     // 宸ヤ綔鍙�
+                }
+            }
+        }
+
+        Thread.sleep(100);
+        for (Integer staNo : staNos3) {
+            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".22.0", (short) 2);
+            OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB" + staNo + ".218.0", (short) 2);
+            if (result5.IsSuccess && result6.IsSuccess) {
+                StaProtocol staProtocol = station.get(staNo);
+                short wrkNo1 = siemensS7Net.getByteTransform().TransInt16(result5.Content, 0);
+                short wrkNo2 = siemensS7Net.getByteTransform().TransInt16(result6.Content, 0);
+                short wrkNo = 0;
+                if (wrkNo1 != 0) {
+                    wrkNo = wrkNo1;
+                }
+                if (wrkNo2 != 0) {
+                    wrkNo = wrkNo2;
+                }
+                staProtocol.setWorkNo(wrkNo);     // 宸ヤ綔鍙�
+            }
+        }
+
+        Thread.sleep(100);
+        for (Integer staNo : staNos4) {
+            OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".22.0", (short) 2);
+            OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB" + staNo + ".250.0", (short) 2);
+            if (result5.IsSuccess && result6.IsSuccess) {
+                StaProtocol staProtocol = station.get(staNo);
+                short wrkNo1 = siemensS7Net.getByteTransform().TransInt16(result5.Content, 0);
+                short wrkNo2 = siemensS7Net.getByteTransform().TransInt16(result6.Content, 0);
+                short wrkNo = 0;
+                if (wrkNo1 != 0) {
+                    wrkNo = wrkNo1;
+                }
+                if (wrkNo2 != 0) {
+                    wrkNo = wrkNo2;
+                }
+                staProtocol.setWorkNo(wrkNo);     // 宸ヤ綔鍙�
+            }
+        }
 
         if (result.IsSuccess && result1.IsSuccess) {
             OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));

--
Gitblit v1.9.1