From 867505775ff2d205f335be55570a14ee9d15368d Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期五, 24 五月 2024 10:39:39 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 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 f1cc5ad..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("鏈嶅姟鍣ㄥ紓甯�"); } @@ -180,6 +197,7 @@ staProtocol.setWorkNo((short) 0); staProtocol.setNearbySta((short) 1); staProtocol.setLoading(false); + staProtocol.setAutoing(false); } } } @@ -269,11 +287,41 @@ 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]); + + } + } if (slave.getId() == 1){ -- Gitblit v1.9.1