| | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | // System.out.println("----------------------------------------"); |
| | | Thread.sleep(400); |
| | | // 读 |
| | | devpThread.read(); |
| | | // devpThread.read(); |
| | | System.out.println("第二次读"); |
| | | System.out.println(JSON.toJSONString(devpThread.station)); |
| | | |