From 7c16bcc9b921ebe24ee6f9591e1675afc10816bf Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 25 十二月 2023 10:19:22 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 221619e..d7de2ab 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -143,6 +143,18 @@
         add(4010);add(4016);
     }};
 
+    public static final ArrayList<Integer> errorStaNos1 = new ArrayList<Integer>() {{
+        add(1002);add(1012);
+    }};
+
+    public static final ArrayList<Integer> errorStaNos2 = new ArrayList<Integer>() {{
+        add(2107);
+    }};
+
+    public static final ArrayList<Integer> errorStaNos4 = new ArrayList<Integer>() {{
+        add(3007);add(3012);
+    }};
+
     /**
      * 鏉$爜鏁伴噺
      */
@@ -195,6 +207,19 @@
                 return writeStaNos5;
             case 6:
                 return writeStaNos6;
+            default:
+                throw new CoolException("鑾峰彇绔欑偣澶辫触锛�");
+        }
+    }
+
+    private ArrayList<Integer> getErrorStaNo() {
+        switch (slave.getId()) {
+            case 1:
+                return errorStaNos1;
+            case 2:
+                return errorStaNos2;
+            case 4:
+                return errorStaNos4;
             default:
                 throw new CoolException("鑾峰彇绔欑偣澶辫触锛�");
         }
@@ -313,6 +338,32 @@
             }
         }
 
+        Thread.sleep(200);
+        OperateResultExOne<byte[]> result3 = null;
+        result3 = siemensS7Net.Read("DB101.0", (short) (getErrorStaNo().size() * 8));
+        if (result3.IsSuccess) {
+            for (int i = 0; i < getErrorStaNo().size(); i++) {
+                Integer siteId = getErrorStaNo().get(i); // 绔欑偣缂栧彿
+                StaProtocol staProtocol = station.get(siteId);
+                staProtocol.setLocType1(siemensS7Net.getByteTransform().TransInt16(result.Content, i*8 + 4 ));   // 搴撲綅楂樺害
+                boolean[] status = siemensS7Net.getByteTransform().TransBool(result3.Content, i*4, 2);
+                staProtocol.setF(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]);      // 浣庡簱浣�
+                staProtocol.setEmptyOutPalletRequire(status[8]);      // 绌烘墭鐩樺彲鍑洪渶姹備俊鍙�
+                staProtocol.setEmptyInPalletRequire(status[9]);      // 绌烘墭鐩樺彲鍏ラ渶姹備俊鍙�
+
+                if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
+                    staProtocol.setPakMk(true);
+                }
+            }
+        }
+
         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