| | |
| | | System.out.println(index * 2 + 200); |
| | | } |
| | | |
| | | // public IoModeType ioMode = IoModeType.NONE; |
| | | |
| | | private ArrayList<Integer> getStaNo() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | |
| | | * 读取状态 ====> 整块plc |
| | | */ |
| | | 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)); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (this.ioModeOf2F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.180", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | log.error("写入输送线2F入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | if (slave.getId() == 2 && this.ioModeOf2F != null) { |
| | | if (!siemensS7Net.Write("DB4.2", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线21F1入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线2F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 2 && this.ioModeOf2F != null) { |
| | | if (!siemensS7Net.Write("DB4.4", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={3}", slave.getId())); |
| | | log.error("写入输送线2F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 3 && this.ioModeOf2F != null) { |
| | | if (!siemensS7Net.Write("DB4.2", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线3F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 3 && this.ioModeOf2F != null) { |
| | | if (!siemensS7Net.Write("DB4.4", this.ioModeOf2F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={3}", slave.getId())); |
| | | log.error("写入输送线3F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } |