From 00c4a674872fb4cedaa36c8692bc08144667d0c0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 13 一月 2021 10:27:28 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SiemensDevpThread.java |   56 ++++++++++++++++++++++----------------------------------
 1 files changed, 22 insertions(+), 34 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..3cfbbd6 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();
@@ -181,7 +169,7 @@
 
         } else {
             OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
-            log.error("璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
+            log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
         }
     }
 
@@ -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