| | |
| | | * 读取状态 ====> 整块plc |
| | | */ |
| | | private void read() throws InterruptedException { |
| | | // 更新入出库模式 |
| | | updateIoMode(); |
| | | |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int staNoSize = staNos.size(); |
| | |
| | | } |
| | | int i = barcodeSite2.indexOf(staProtocol.getSiteId()); |
| | | if (i != -1) { |
| | | heightAddress = "DB104." + (i * 4); |
| | | heightAddress = "DB104." + (i * 2); |
| | | } |
| | | |
| | | OperateResult writeResult; |
| | |
| | | //任务下发成功标识 |
| | | boolean writeFlag = false; |
| | | while (writeCount < 5) { |
| | | OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 目标站 |
| | | if (!Cools.isEmpty(staProtocol.getHeight()) && heightAddress != null) { |
| | | OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); // 目标站 |
| | | OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | | log.info("写入高度地址:{},{}", heightAddress, writeResult3); |
| | | if (!writeResult3.IsSuccess) { |
| | | //fangzhi xierukushibai,jiu duoxiejici,meixunhuan |
| | |
| | | } |
| | | } |
| | | } |
| | | OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 目标站 |
| | | if (writeResult1.IsSuccess && writeResult2.IsSuccess) { |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 2); |
| | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (slave.getId() == 1 && this.ioModeOf1F1 != null) { |
| | | if (!siemensS7Net.Write("DB4.2", this.ioModeOf1F1.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线21F1入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | if (!siemensS7Net.Write("DB105.0", this.ioModeOf1F1.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线21F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线1F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F2 != null) { |
| | | if (!siemensS7Net.Write("DB105.2", this.ioModeOf1F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线1F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F3 != null) { |
| | | if (!siemensS7Net.Write("DB105.4", this.ioModeOf1F3.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线1F3入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F4 != null) { |
| | | if (!siemensS7Net.Write("DB105.6", this.ioModeOf1F4.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线1F4入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F5 != null) { |
| | | if (!siemensS7Net.Write("DB105.8", this.ioModeOf1F5.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线1F5入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (slave.getId() == 1 && this.ioModeOf2F1 != null) { |
| | | if (!siemensS7Net.Write("DB105.10", this.ioModeOf2F1.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F2 != null) { |
| | | if (!siemensS7Net.Write("DB4.4", this.ioModeOf1F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={3}", slave.getId())); |
| | | if (slave.getId() == 1 && this.ioModeOf2F2 != null) { |
| | | if (!siemensS7Net.Write("DB105.12", this.ioModeOf2F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F2 != null) { |
| | | if (!siemensS7Net.Write("DB4.2", this.ioModeOf1F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线3F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 1 && this.ioModeOf1F2 != null) { |
| | | if (!siemensS7Net.Write("DB4.4", this.ioModeOf1F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={3}", slave.getId())); |
| | | log.error("写入输送线3F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | if (slave.getId() == 1 && this.ioModeOf2F3 != null) { |
| | | if (!siemensS7Net.Write("DB105.14", this.ioModeOf2F3.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F3入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } |