From f68dd32cdd75924ebded3800cf37fa9110f9ec01 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期五, 07 六月 2024 10:31:33 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index f1cc5ad..068e197 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("鏈嶅姟鍣ㄥ紓甯�"); } @@ -180,6 +197,7 @@ staProtocol.setWorkNo((short) 0); staProtocol.setNearbySta((short) 1); staProtocol.setLoading(false); + staProtocol.setAutoing(false); } } } @@ -269,9 +287,39 @@ station.put((i+1), staProtocol); } staProtocol.setWorkNo(wrkNo); + staProtocol.setAutoing(true); staProtocol.setNearbySta(location); staProtocol.setLoading(status[0]); } + } + } + 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]); + } } @@ -432,14 +480,14 @@ Integer siteId = staNos.get(i); // 绔欑偣缂栧彿 boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4, 1); StaProtocol staProtocol = station.get(siteId); - staProtocol.setBreakerErr(status[0]); - staProtocol.setInfraredErr(status[1]); + staProtocol.setBreakerErr(status[0]); //鎻愬崌鏈� 涓婂崌鏋侀檺 + staProtocol.setInfraredErr(status[1]); //鎻愬崌鏈� 涓嬮檷鏋侀檺 staProtocol.setOutTimeErr(status[2]); staProtocol.setSeizeSeatErr(status[3]); staProtocol.setWrkYgoodsN(status[4]); staProtocol.setInverterErr(status[5]); - staProtocol.setContactErr(status[6]); - staProtocol.setUpcontactErr(status[7]); + staProtocol.setContactErr(status[6]); //鎻愬崌鏈� 宸﹁秴闄� + staProtocol.setUpcontactErr(status[7]); //鎻愬崌鏈� 鍙宠秴闄� } } -- Gitblit v1.9.1