| | |
| | | private CrnSlave slave; |
| | | private CrnProtocol crnProtocol; |
| | | private boolean resetFlag = false; |
| | | private boolean resetFlagTwo = false; |
| | | |
| | | /** |
| | | * 堆垛机是否在回原点运动中标记 |
| | |
| | | |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | if (crnProtocol.getMode() == 1) { |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | System.out.println(crnProtocol); |
| | | if (resetFlag) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | |
| | | } else if (crnProtocol.getMode() == 2) { |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusTypeTwo()) && crnProtocol.getStatusTypeTwo().equals(CrnStatusType.WAITING)) { |
| | | |
| | | if (resetFlag) { |
| | | if (resetFlagTwo) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | |
| | | } else if (crnProtocol.getMode() == 3) { |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING) && !Cools.isEmpty(crnProtocol.getStatusTypeTwo()) && crnProtocol.getStatusTypeTwo().equals(CrnStatusType.WAITING)) { |
| | | System.out.println(crnProtocol); |
| | | if (resetFlag) { |
| | | if (resetFlag && resetFlagTwo) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | |
| | | one.setDestinationPosXTwo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 22)); |
| | | one.setDestinationPosYTwo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 24)); |
| | | one.setDestinationPosZTwo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 26)); |
| | | if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode()) |
| | | || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY()) |
| | | || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) |
| | | || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) |
| | | || !command.getSourcePosXTwo().equals(one.getSourcePosXTwo()) || !command.getSourcePosYTwo().equals(one.getSourcePosYTwo()) |
| | | || !command.getSourcePosZTwo().equals(one.getSourcePosZTwo()) || !command.getDestinationPosXTwo().equals(one.getDestinationPosXTwo()) |
| | | || !command.getDestinationPosYTwo().equals(one.getDestinationPosYTwo()) || !command.getDestinationPosZTwo().equals(one.getDestinationPosZTwo()) |
| | | ) { |
| | | System.out.println(command.getTaskNo().equals(one.getTaskNo())); |
| | | System.out.println(one); |
| | | try { |
| | | log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | | } catch (Exception e) { |
| | | if (command.getTaskMode() != 2) { |
| | | if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode()) |
| | | || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY()) |
| | | || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) |
| | | || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) |
| | | ) { |
| | | try { |
| | | log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(resultRead)); |
| | | } catch (Exception e1) { |
| | | log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSONString(command)); |
| | | log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | | } catch (Exception e) { |
| | | try { |
| | | log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(resultRead)); |
| | | } catch (Exception e1) { |
| | | log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSONString(command)); |
| | | } |
| | | } |
| | | } |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command), writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | writeCount++; |
| | | continue; |
| | | } else { |
| | | log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | | break; |
| | | } |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command), writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | writeCount++; |
| | | continue; |
| | | } else { |
| | | log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | | break; |
| | | if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode()) |
| | | || !command.getSourcePosXTwo().equals(one.getSourcePosXTwo()) || !command.getSourcePosYTwo().equals(one.getSourcePosYTwo()) |
| | | || !command.getSourcePosZTwo().equals(one.getSourcePosZTwo()) || !command.getDestinationPosXTwo().equals(one.getDestinationPosXTwo()) |
| | | || !command.getDestinationPosYTwo().equals(one.getDestinationPosYTwo()) || !command.getDestinationPosZTwo().equals(one.getDestinationPosZTwo()) |
| | | ) { |
| | | try { |
| | | log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | | } catch (Exception e) { |
| | | try { |
| | | log.error("日志打印失败:===>>参数one报错 [id:{}],{}", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(resultRead)); |
| | | } catch (Exception e1) { |
| | | log.error("日志打印失败:===>> [id:{}],{}", slave.getId(), JSON.toJSONString(command)); |
| | | } |
| | | } |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | log.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSONString(command), writeCount); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | writeCount++; |
| | | continue; |
| | | } else { |
| | | log.info("堆垛机命令地址写入后回读成功[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |