| | |
| | | */ |
| | | public IoModeType ioModeOf1F = IoModeType.NONE; |
| | | public IoModeType ioModeOf2F = IoModeType.NONE; |
| | | public IoModeType ioModeOf3F = IoModeType.NONE; |
| | | public short ioModeOf3FX = 0; |
| | | public short ioModeOf3FD = 0; |
| | | public IoModeType ioModeOf4F = IoModeType.NONE; |
| | | public short ioModeOf4FX = 0; |
| | | public short ioModeOf4FD = 0; |
| | | |
| | | private ArrayList<Integer> getStaNo() { |
| | | switch (slave.getId()) { |
| | |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2)); // 目标站 |
| | | } |
| | | } |
| | | if (slave.getId()!=1){ |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2F = siemensS7Net.Read("DB102.50", (short) (4)); |
| | | if (result2F.IsSuccess) { |
| | | if (slave.getId()==2){ |
| | | this.ioModeOf3FX = siemensS7Net.getByteTransform().TransInt16(result2F.Content, 0); |
| | | this.ioModeOf3FD = siemensS7Net.getByteTransform().TransInt16(result2F.Content, 2); |
| | | } if (slave.getId()==3){ |
| | | this.ioModeOf4FX = siemensS7Net.getByteTransform().TransInt16(result2F.Content, 0); |
| | | this.ioModeOf4FD = siemensS7Net.getByteTransform().TransInt16(result2F.Content, 2); |
| | | } |
| | | } |
| | | } |
| | | Thread.sleep(200); |
| | |
| | | |
| | | // 更新入出库模式 |
| | | private void updateIoMode() throws InterruptedException { |
| | | if (slave.getId()==1){ |
| | | if (this.ioModeOf1F != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.180", this.ioModeOf1F.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线103入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | |
| | | News.error("写入输送线203入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } else if (slave.getId()==2){ |
| | | if (this.ioModeOf3F != IoModeType.NONE && this.ioModeOf3F.id/2 != this.ioModeOf3FX) { |
| | | if (!siemensS7Net.Write("DB102.50", (short) (this.ioModeOf3F.id/2)).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线113入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | News.error("写入输送线113入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } else if (slave.getId()==3){ |
| | | if (this.ioModeOf4F != IoModeType.NONE && this.ioModeOf4F.id/2 != this.ioModeOf4FX) { |
| | | if (!siemensS7Net.Write("DB102.50", (short) (this.ioModeOf4F.id/2)).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线213入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | News.error("写入输送线213入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |