| | |
| | | |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | Thread.sleep(200); |
| | | int writeCount1 = 1; |
| | | int writeCount = 1; |
| | | do { |
| | | try{ |
| | | if(!result.IsSuccess){ |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount1); |
| | | // MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | Thread.sleep(100); |
| | | writeCount1++; |
| | | writeCount++; |
| | | continue; |
| | | } |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 24); |
| | |
| | | log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); |
| | | } |
| | | } |
| | | |
| | | try{ |
| | | Thread.sleep(100); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | // News.error("堆垛机命令回读失败后,重新添加任务到队列 ===>> [id:{}],{},resetFlag={}", slave.getId(), JSON.toJSON(command),resetFlag); |
| | | // MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount1); |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | writeCount1++; |
| | | writeCount++; |
| | | continue; |
| | | |
| | | } else { |
| | | log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); |
| | | break; |
| | |
| | | }catch (Exception e){ |
| | | log.error("堆垛机命令地址写入后回读出错,异常:"+e); |
| | | } |
| | | writeCount1++; |
| | | } while (writeCount1<6); |
| | | writeCount++; |
| | | } while (writeCount<6); |
| | | |
| | | if (command.getAckFinish() == 0) { |
| | | short commandFinish = 1; |
| | |
| | | log.info("下发DB100.18" + "array:"+ JSON.toJSONString(array)); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |