From f7c06595e0fdbed9e65d6362cc26f05c9da27eb4 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 08 九月 2020 16:31:53 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/DevpThread.java | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/zy/core/thread/DevpThread.java b/src/main/java/com/zy/core/thread/DevpThread.java index 362c164..e7670f0 100644 --- a/src/main/java/com/zy/core/thread/DevpThread.java +++ b/src/main/java/com/zy/core/thread/DevpThread.java @@ -135,6 +135,7 @@ } } if (result.IsSuccess && result1.IsSuccess) { + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId())); // 鏍规嵁瀹炴椂淇℃伅鏇存柊鏁版嵁搴� @@ -155,7 +156,7 @@ } else { OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); - log.error("璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); + log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); } } @@ -183,7 +184,8 @@ OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={1}锛岀珯鐐规暟鎹�={2}", slave.getId(), JSON.toJSON(staProtocol))); log.error("鍐欏叆杈撻�佺嚎绔欑偣鏁版嵁澶辫触銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={}", slave.getId(), JSON.toJSON(staProtocol)); } else { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆� 杈撻�佺嚎鍛戒护涓嬪彂 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol))); + log.info("杈撻�佺嚎鍛戒护涓嬪彂 [id:{}] >>>>> 鍛戒护涓嬪彂锛� {}", slave.getId(), JSON.toJSON(staProtocol)); } } @@ -245,7 +247,13 @@ slave.setPort(6000); DevpThread devpThread = new DevpThread(slave); devpThread.connect(); - devpThread.read(); + OperateResult d1021 = devpThread.melsecMcNet.Write("D102", (short) 234); + if (d1021.IsSuccess) { + System.out.println("success"); + } + OperateResultExOne<Short> d102 = devpThread.melsecMcNet.ReadInt16("D102"); + System.out.println(d102.Content); +// devpThread.read(); System.out.println("绗竴娆¤"); // 鍐� // StaProtocol staProtocol = devpThread.getStation().get(1); @@ -258,7 +266,7 @@ // System.out.println("----------------------------------------"); Thread.sleep(400); // 璇� - devpThread.read(); +// devpThread.read(); System.out.println("绗簩娆¤"); System.out.println(JSON.toJSONString(devpThread.station)); -- Gitblit v1.9.1