| | |
| | | |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId())); |
| | | if (crnProtocol.getMode() == 1) { |
| | | if (!Cools.isEmpty(crnProtocol.getTaskNo()) && crnProtocol.getStatusType() == CrnStatusType.WAITING_ONE) { |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING_ONE)) { |
| | | if (resetFlag) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short) 1); |
| | | if (write(crnCommand)) { |
| | | resetFlag = false; |
| | | } |
| | | if (resetFlag) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short) 1); |
| | | if (write(crnCommand)) { |
| | | News.info("---第二步、[堆垛机号:{}, 工作号:{}]==>> 一工位复位resetFlag标记成功{}!!", |
| | | slave.getId(), crnProtocol.getTaskNo(), resetFlag); |
| | | resetFlag = false; |
| | | } else { |
| | | News.error("---第二步、[堆垛机号:{}, 工作号:{}]==>> 一工位复位resetFlag标记失败{}!!", |
| | | slave.getId(), crnProtocol.getTaskNo(), resetFlag); |
| | | } |
| | | } |
| | | } else if (crnProtocol.getMode() == 2) { |
| | | } else if (!Cools.isEmpty(crnProtocol.getTaskNo()) && crnProtocol.getStatusTypeTwo() == CrnStatusType.WAITING_TWO) { |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusTypeTwo()) && crnProtocol.getStatusTypeTwo().equals(CrnStatusType.WAITING_TWO)) { |
| | | if (resetFlagTwo) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short) 1); |
| | | if (write(crnCommand)) { |
| | | resetFlagTwo = false; |
| | | } |
| | | if (resetFlagTwo) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short) 1); |
| | | if (write(crnCommand)) { |
| | | News.info("---第二步、[堆垛机号:{}, 工作号:{}]==>> 二工位复位resetFlag标记成功{}!!", |
| | | slave.getId(), crnProtocol.getTaskNo(), resetFlag); |
| | | resetFlagTwo = false; |
| | | } else { |
| | | News.error("---第二步、[堆垛机号:{}, 工作号:{}]==>> 二工位复位resetFlag标记失败{}!!", |
| | | slave.getId(), crnProtocol.getTaskNo(), resetFlag); |
| | | } |
| | | |
| | | } |
| | | } else if (crnProtocol.getMode() == 3) { |
| | | } else if (!Cools.isEmpty(crnProtocol.getTaskNo()) && crnProtocol.getStatusType() == CrnStatusType.WAITING_All && crnProtocol.getStatusTypeTwo() == CrnStatusType.WAITING_All) { |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING_All)) { |
| | | if (resetFlag && resetFlagTwo) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short) 1); |
| | | if (write(crnCommand)) { |
| | | resetFlag = false; |
| | | resetFlagTwo = false; |
| | | } |
| | | if (resetFlag && resetFlagTwo) { |
| | | if (crnProtocol.getTaskNo() == 9999) { |
| | | backHpFlag = false; |
| | | } |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setAckFinish((short) 1); |
| | | if (write(crnCommand)) { |
| | | News.info("---第二步、[堆垛机号:{}, 工作号:{}]==>> 双工位复位resetFlag标记成功{}!!", |
| | | slave.getId(), crnProtocol.getTaskNo(), resetFlag); |
| | | resetFlag = false; |
| | | resetFlagTwo = false; |
| | | } else { |
| | | News.error("---第二步、[堆垛机号:{}, 工作号:{}]==>> 双工位复位resetFlag标记失败{}!!", |
| | | slave.getId(), crnProtocol.getTaskNo(), resetFlag); |
| | | } |
| | | } |
| | | } |
| | |
| | | one.setDestinationPosXTwo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 22)); |
| | | one.setDestinationPosYTwo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 24)); |
| | | one.setDestinationPosZTwo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 26)); |
| | | one.setCommand(siemensNet.getByteTransform().TransInt16(resultRead.Content, 28)); |
| | | one.setAckFinish(siemensNet.getByteTransform().TransInt16(resultRead.Content, 30)); |
| | | 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()) |
| | | || !command.getCommand().equals(one.getCommand()) || !command.getAckFinish().equals(one.getAckFinish()) |
| | | ) { |
| | | try { |
| | | log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |
| | |
| | | || !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()) |
| | | || !command.getCommand().equals(one.getCommand()) || !command.getAckFinish().equals(one.getAckFinish()) |
| | | ) { |
| | | try { |
| | | log.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSONString(command), JSON.toJSONString(one)); |