| | |
| | | */ |
| | | private void read() throws InterruptedException { |
| | | // // 更新入出库模式 |
| | | updateIoMode(); |
| | | // updateIoMode(); |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int staNoSize = staNos.size(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8)); |
| | |
| | | |
| | | //外形检测 |
| | | OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.702.0", (short) (barcodeSize*1)); |
| | | if(resultErr1.IsSuccess){ |
| | | StaProtocol staProtocol1 = station.get(101); |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, 0, 1); |
| | | staProtocol1.setFrontErr(status1[0]); |
| | |
| | | staProtocol1.setRightErr(status1[4]); |
| | | staProtocol1.setWeightErr(status1[5]); |
| | | staProtocol1.setBarcodeErr(status1[6]); |
| | | |
| | | } |
| | | |
| | | Thread.sleep(200); |
| | | if(slave.getId()==1) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (this.ioModeOf1F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.80", this.ioModeOf1F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线1F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (this.ioModeOf2F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.82", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (this.ioModeOf3F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.84", this.ioModeOf3F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F3入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线3F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (this.ioModeOf4F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.86", this.ioModeOf4F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线F4入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线4F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 心跳 |