| | |
| | | add(341);add(346); |
| | | }}; |
| | | |
| | | //出入库站点检测报警信息 |
| | | public static final ArrayList<Integer> outInAlarmStaNos = new ArrayList<Integer>(){{ |
| | | add(101);add(102);add(104); |
| | | add(201);add(202);add(204); |
| | | add(340);add(345); |
| | | }}; |
| | | |
| | | public boolean charge0; |
| | | public boolean charge1; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //出入库站点检测报警信息 |
| | | Thread.sleep(100); |
| | | for (Integer staNo : outInAlarmStaNos) { |
| | | OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB" + staNo + ".20.0", (short) 2); |
| | | if (result5.IsSuccess) { |
| | | if (staNo == 101 || staNo == 201) { |
| | | staNo--; |
| | | }else { |
| | | staNo++; |
| | | } |
| | | StaProtocol staProtocol = station.get(staNo); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result5.Content, 0, 2); |
| | | staProtocol.setBarcodeErr(status[4]);//扫码失败 |
| | | staProtocol.setFrontErr(status[8]);//前超限 |
| | | staProtocol.setBackErr(status[9]);//后超限 |
| | | staProtocol.setLeftErr(status[10]);//左超限 |
| | | staProtocol.setRightErr(status[11]);//右超限 |
| | | staProtocol.setHighErr(status[12]);//超高 |
| | | staProtocol.setWeightErr(status[13]);//超重 |
| | | } |
| | | } |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | int writeCount = 0; |
| | | //任务下发成功标识 |
| | | boolean writeFlag = false; |
| | | while(writeCount < 5){ |
| | | while(writeCount < 1){ |
| | | writeResult = siemensS7Net.Write("DB1000." + index*4, array); // 工作号、目标站 |
| | | if(writeResult.IsSuccess){ |
| | | Thread.sleep(200); |
| | | Thread.sleep(500); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB1000." + index*4, (short)4); |
| | | if(readResult.IsSuccess){ |
| | | short workNo = siemensS7Net.getByteTransform().TransInt16(readResult.Content, 0); |
| | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线命令尝试5次失败。输送线plc编号={1},站点数据={2}", slave.getId(), JSON.toJSON(staProtocol))); |
| | | log.error("写入输送线命令尝试5次失败。输送线plc编号={},站点数据={}", slave.getId(), JSON.toJSON(staProtocol)); |
| | | |
| | | //重新添加数据到任务队列 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(2, staProtocol)); |
| | | // //重新添加数据到任务队列 |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, slave.getId(), new Task(2, staProtocol)); |
| | | read();//读取1次设备状态 |
| | | return; |
| | | } else { |