| | |
| | | write((StaProtocol) task.getData()); |
| | | log.error("输送线下发命令:" + ((StaProtocol) task.getData()).getWorkNo() + "," + ((StaProtocol) task.getData()).getStaNo()); |
| | | break; |
| | | // 写数据 ID+目标站 |
| | | case 3: |
| | | write2((StaProtocol) task.getData()); |
| | | log.error("输送线下发命令:" + ((StaProtocol) task.getData()).getWorkNo() + "," + ((StaProtocol) task.getData()).getStaNo()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private void write2(StaProtocol staProtocol) throws InterruptedException { |
| | | if (null == staProtocol) { |
| | | return; |
| | | } |
| | | OperateResult write = null; |
| | | boolean[] array = new boolean[1]; |
| | | array[0] = true; |
| | | //任务下发次数 |
| | | int writeCount = 0; |
| | | do { |
| | | write = siemensS7Net.Write("DB102.0", array); |
| | | if (write.IsSuccess) { |
| | | log.error("写入输送线命令成功。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } else { |
| | | writeCount++; |
| | | log.error("写入输送线命令失败。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | } |
| | | } while (writeCount < 5); |
| | | |
| | | if (!write.IsSuccess) { |
| | | News.error("SiemensDevp" + " - 4" + " - 写入输送线站点数据失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | } |
| | | } |
| | | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (this.ioModeOf2F != IoModeType.NONE) { |