| | |
| | | // 写入数据 |
| | | case 2: |
| | | write((SteCommand) task.getData()); |
| | | Thread.sleep(200); |
| | | readStatus(); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | steProtocol = new SteProtocol(); |
| | | } |
| | | steProtocol.setSteNo(slave.getId().shortValue()); |
| | | steProtocol.setMode((short) 0); |
| | | steProtocol.setMode((short) -1); |
| | | steProtocol.setStatus(SteStatusType.OFF_LINE); |
| | | steProtocol.setTaskNo((short) 0); |
| | | steProtocol.setExecute(false); |
| | |
| | | // 开始任务 |
| | | if (!command.getComplete()) { |
| | | //组织任务前,先清空写任务确认位,以及任务完成确认位 |
| | | siemensS7Net.Write("V2000.0", false); |
| | | siemensS7Net.Write("V2000.1", false); |
| | | OperateResult result01 = siemensS7Net.Write("V2000.0", false); |
| | | OperateResult result02 = siemensS7Net.Write("V2000.1", false); |
| | | // 1.任务号 |
| | | OperateResult result0 = siemensS7Net.Write("V998", command.getTaskNo().shortValue()); |
| | | try { |
| | |
| | | } else { |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】写入穿梭车plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | News.error("写入穿梭车plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort()); |
| | | |
| | | //写入失败后,重新添加commanddao 任务队列中,并立即回读一次设备状态 |
| | | MessageQueue.offer(SlaveType.Ste, slave.getId(), new Task(2, command)); |
| | | readStatus(); |
| | | |
| | | initSte(); |
| | | return false; |
| | | } |
| | | } |