| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | |
| | | } |
| | | StaProtocol staProtocol = station.get(barcodeSite2.get(i)); |
| | | if (staProtocol != null) { |
| | | while (iterator.hasNext()) { |
| | | String next = iterator.next(); |
| | | if (next.length() < 7 || next.length() > 10 || !next.matches("[0-9]*")) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | staProtocol.setMatIdList(barcodeList); |
| | | } |
| | | } |
| | |
| | | //任务下发成功标识 |
| | | 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())); // 目标站 |
| | | log.info("写入高度地址:{},{}", heightAddress, writeResult3); |
| | | 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 |
| | | writeResult3 = siemensS7Net.Write(heightAddress, Short.parseShort(staProtocol.getHeight())); |
| | |
| | | } |
| | | } |
| | | } |
| | | 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); |
| | |
| | | |
| | | 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())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F1入出库模式失败。输送线plc编号={}", 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())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F2入出库模式失败。输送线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())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F3入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F3入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |