From 16437fe3148e09023d64efc48b49e60c172ec107 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 28 五月 2021 14:32:57 +0800 Subject: [PATCH] # --- src/main/webapp/views/console.html | 1 + src/main/webapp/static/css/console.css | 1 + src/main/java/com/zy/core/thread/SiemensDevpThread.java | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index d7d0030..da72c0a 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -43,6 +43,7 @@ add(115);add(116);add(117);add(118);add(119);add(120);add(121);add(122);add(123);add(124);add(125);add(126);add(127);add(128); add(200);add(201);add(202);add(203);add(204);add(205); add(300);add(301);add(302);add(303);add(304);add(305);add(306);add(307);add(308); + add(129); }}; public SiemensDevpThread(DevpSlave slave) { @@ -135,6 +136,21 @@ } } Thread.sleep(50); + OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.226", (short) 4); + if (result3.IsSuccess) { + for (int i = 0; i < 1; i++) { + Integer siteId = staNos.get(i + 44); // 绔欑偣缂栧彿 + StaProtocol staProtocol = station.get(siteId); + if (null == staProtocol) { + staProtocol = new StaProtocol(); + staProtocol.setSiteId(siteId); + station.put(siteId, staProtocol); + } + staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result3.Content, i*2)); // 宸ヤ綔鍙� + staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result3.Content, i*2 + 2)); // 鐩爣绔� + } + } + Thread.sleep(50); OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.140", (short) 35); if (result1.IsSuccess) { for (int i = 0; i < 35; i++) { @@ -176,8 +192,29 @@ } } } + Thread.sleep(50); + OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB100.230", (short) 1); + if (result4.IsSuccess) { + for (int i = 0; i < 1; i++) { + Integer siteId = staNos.get(i + 44); // 绔欑偣缂栧彿 + boolean[] status = siemensS7Net.getByteTransform().TransBool(result4.Content, i, 1); + StaProtocol staProtocol = station.get(siteId); + staProtocol.setAutoing(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]); // 浣庡簱浣� - if (result.IsSuccess && result0.IsSuccess && result1.IsSuccess && result2.IsSuccess) { + if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { + staProtocol.setPakMk(true); + } + } + } + + if (result.IsSuccess && result0.IsSuccess && result1.IsSuccess && result2.IsSuccess && result3.IsSuccess && result4.IsSuccess) { OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId())); @@ -214,15 +251,20 @@ OperateResult write; OperateResult write1; // 涓�鏈� - if (staProtocol.getSiteId() < 300) { + if (staProtocol.getSiteId() < 300 && staProtocol.getSiteId() != 129) { write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 宸ヤ綔鍙� Thread.sleep(100); write1 = siemensS7Net.Write("DB100." + (index*2 + 70), staProtocol.getStaNo()); // 鐩爣绔� // 浜屾湡 - } else { + } else if (staProtocol.getSiteId() >= 300 && staProtocol.getSiteId() != 129){ write = siemensS7Net.Write("DB100." + ((index-35)*2 + 180), staProtocol.getWorkNo()); // 宸ヤ綔鍙� Thread.sleep(100); write1 = siemensS7Net.Write("DB100." + ((index-35)*2 + 198), staProtocol.getStaNo()); // 鐩爣绔� + // 涓夋湡 129 + } else { + write = siemensS7Net.Write("DB100." + ((index-44)*2 + 226), staProtocol.getWorkNo()); // 宸ヤ綔鍙� + Thread.sleep(100); + write1 = siemensS7Net.Write("DB100." + ((index-44)*2 + 228), staProtocol.getStaNo()); // 鐩爣绔� } if (!write.IsSuccess || !write1.IsSuccess) { @@ -270,6 +312,7 @@ } public static void main(String[] args) { + System.out.println(staNos.indexOf(129)); System.out.println(staNos.size()); for (int i = 0; i<staNos.size(); i++) { // System.out.println(i*2); diff --git a/src/main/webapp/static/css/console.css b/src/main/webapp/static/css/console.css index 5e34383..8f29a1b 100644 --- a/src/main/webapp/static/css/console.css +++ b/src/main/webapp/static/css/console.css @@ -144,6 +144,7 @@ /* 杈撻�佺嚎绗笁鍒� */ .site-row-3 { + top: 102px; left: 400px; } .site-row-3 .site { diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html index d6220c4..9db1faf 100644 --- a/src/main/webapp/views/console.html +++ b/src/main/webapp/views/console.html @@ -123,6 +123,7 @@ <!-- 绗�3鍒楋紙瀹藉害 100px锛� --> <div class="site-row site-row-3"> + <div id="site-129" class="site" style="height: 20px;line-height: 20px;width: 80px">129</div> <div id="site-101" class="site" style="height: 20px;line-height: 20px">101</div> <div id="site-125" class="site" style="height: 20px;line-height: 20px;width: 80px">125</div> <div id="site-123" class="site" style="height: 20px;line-height: 20px">123</div> -- Gitblit v1.9.1