From 92ac16fad20cbd4c0035501ef04605bdb960fc18 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期五, 24 五月 2024 10:36:49 +0800
Subject: [PATCH] #提升机状态

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 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 37fd458..6322db8 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -71,6 +71,12 @@
         add(400);add(401);add(402);add(403);
         add(404);add(405);add(406);add(407);
     }};
+    public static final ArrayList<Integer> hoist1 = new ArrayList<Integer>() {{
+        add(302);add(303);
+    }};
+    public static final ArrayList<Integer> hoist2 = new ArrayList<Integer>() {{
+        add(402);add(403);
+    }};
 
     /**
      * 鏉$爜鏁伴噺
@@ -97,6 +103,17 @@
                 return staNos3;
             case 4:
                 return staNos4;
+            default:
+                throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
+        }
+    }
+
+    private ArrayList<Integer> getHoist() {
+        switch (slave.getId()) {
+            case 3:
+                return hoist1;
+            case 4:
+                return hoist2;
             default:
                 throw new CoolException("鏈嶅姟鍣ㄥ紓甯�");
         }
@@ -276,6 +293,35 @@
                 }
             }
         }
+        if (slave.getId() == 3 || slave.getId() == 4){
+            ArrayList<Integer> hoist = getHoist();
+            int hoistSize = hoist.size();
+            OperateResultExOne<byte[]> resultHoist = siemensS7Net.Read("DB15.0", (short) 33);
+            if (resultHoist.IsSuccess) {
+                    Integer siteId = hoist.get(0); // 绔欑偣缂栧彿
+                    StaProtocol staProtocol = station.get(siteId);
+                    if (null == staProtocol) {
+                        staProtocol = new StaProtocol();
+                        staProtocol.setSiteId(siteId);
+                        station.put(siteId, staProtocol);
+                    }
+                    boolean[] status = siemensS7Net.getByteTransform().TransBool(resultHoist.Content, 32, 1);
+                    staProtocol.setPlace1(status[0]);
+                    staProtocol.setPlace2(status[1]);
+
+                Integer siteId2 = hoist.get(1); // 绔欑偣缂栧彿
+                staProtocol = station.get(siteId2);
+                if (null == staProtocol) {
+                    staProtocol = new StaProtocol();
+                    staProtocol.setSiteId(siteId);
+                    station.put(siteId, staProtocol);
+                }
+                boolean[] status2 = siemensS7Net.getByteTransform().TransBool(resultHoist.Content, 32, 1);
+                staProtocol.setPlace1(status2[2]);
+                staProtocol.setPlace2(status2[3]);
+
+            }
+        }
 
 
         if (slave.getId() == 1){

--
Gitblit v1.9.1