From 9042e885de0413ccfa89d231fc77ddf70c9e58d5 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 11 一月 2021 14:28:07 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 54 +++++++++++++++++++++--------------------------------- 1 files changed, 21 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index 173f38b..5a12873 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -45,17 +45,6 @@ add(200);add(201);add(202);add(203);add(204);add(205); }}; - public static void main(String[] args) { - for (Integer siteId : staNos) { - int divides = (int) Arith.divides(0, siteId, 100); - int remainder = (int) Arith.remainder(siteId, 100); - int index = ((divides - 1) * 50) + remainder; -// System.out.print(siteId + " 浠诲姟鍦板潃 锛� " + index*2); -// System.out.print(" 鐩爣鍦板潃 锛� " + (index*2+200) ); - System.out.println(siteId + " 鐘舵�� 锛� " + (index*2) ); - } - } - public SiemensDevpThread(DevpSlave slave) { this.slave = slave; } @@ -83,9 +72,8 @@ default: break; } - // 蹇冭烦 - heartbeat(); +// heartbeat(); Thread.sleep(400); } catch (Exception e) { e.printStackTrace(); @@ -243,25 +231,25 @@ siemensS7Net.ConnectClose(); } -// public static void main(String[] args) throws Exception { -// DevpSlave slave = new DevpSlave(); -// slave.setIp("192.168.2.125"); -// SiemensDevpThread devpThread = new SiemensDevpThread(slave); -// devpThread.connect(); -// devpThread.read(); -// // 鍐� -// StaProtocol staProtocol = devpThread.getStation().get(1); -// staProtocol.setWorkNo((short) 232); -// staProtocol.setStaNo((short) 6); -// staProtocol.setAutoing(true); -// staProtocol.setEmptyMk(true); -// staProtocol.setInEnable(true); -// devpThread.write(staProtocol); -// System.out.println("----------------------------------------"); -// // 璇� -// devpThread.read(); -// System.out.println(JSON.toJSONString(devpThread.station)); -// -// } + public static void main(String[] args) throws Exception { + DevpSlave slave = new DevpSlave(); + slave.setIp("192.168.2.125"); + SiemensDevpThread devpThread = new SiemensDevpThread(slave); + devpThread.connect(); + devpThread.read(); + // 鍐� + StaProtocol staProtocol = devpThread.getStation().get(1); + staProtocol.setWorkNo((short) 232); + staProtocol.setStaNo((short) 6); + staProtocol.setAutoing(true); + staProtocol.setEmptyMk(true); + staProtocol.setInEnable(true); + devpThread.write(staProtocol); + System.out.println("----------------------------------------"); + // 璇� + devpThread.read(); + System.out.println(JSON.toJSONString(devpThread.station)); + + } } -- Gitblit v1.9.1