| | |
| | | staProtocol.setInEnable(result1.Content[(i-1)*8+2]); // 可入 |
| | | staProtocol.setOutEnable(result1.Content[(i-1)*8+3]);// 可出 |
| | | staProtocol.setEmptyMk(result1.Content[(i-1)*8+4]); // 空板信号 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | // 根据实时信息更新数据库 |
| | |
| | | |
| | | } 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("读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | } |
| | | |
| | |
| | | // status[4] = staProtocol.isEmptyMk(); |
| | | // OperateResult write2 = siemensS7Net.Write("DB100." + ((staProtocol.getSiteId() - 1) + 40), status); // 状态 |
| | | if (!write.IsSuccess || !write1.IsSuccess) { |
| | | if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | 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)); |
| | | |