| | |
| | | if (result.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | | crnProtocol.setCrnNo(slave.getId()); |
| | | } |
| | | crnProtocol.setCrnNo(slave.getId()); |
| | | crnProtocol.setMode(siemensNet.getByteTransform().TransInt16(result.Content, 0)); |
| | | crnProtocol.setTaskNo(siemensNet.getByteTransform().TransInt16(result.Content, 2)); |
| | | crnProtocol.setStatus(siemensNet.getByteTransform().TransInt16(result.Content, 4)); |
| | |
| | | |
| | | // 复位信号 |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | // News.error("---第一步、[堆垛机号:{}, 工作号:{}, 载货台信号:{}]==>> 状态为10,等待确认!!", |
| | | // slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "有物" : "无物"); |
| | | News.error("---第一步、[堆垛机号:{}, 工作号:{}, 载货台信号:{},状态:{}]==>> 状态为10,等待确认!!", |
| | | slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "有物" : "无物",crnProtocol.getStatusType()); |
| | | if (resetFlag) { |
| | | if(crnProtocol.getTaskNo()==9999){ |
| | | backHpFlag = false; |
| | |
| | | do { |
| | | OperateResult resultAck = siemensNet.Write("DB100.0", (short) 0); |
| | | if (resultAck.IsSuccess){ |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 2); |
| | | short ack = siemensNet.getByteTransform().TransInt16(resultRead.Content, 0); |
| | | if (ack != 0) { |
| | | writeAck++; |
| | | }else { |
| | | News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), "ack复位完成"); |
| | | break; |
| | | } |
| | | } |
| | |
| | | one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12)); |
| | | one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14)); |
| | | one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16)); |
| | | one.setCommand(siemensNet.getByteTransform().TransInt16(resultRead.Content, 18)); |
| | | one.setTraySize(siemensNet.getByteTransform().TransInt16(resultRead.Content, 20)); |
| | | 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.getTraySize().equals(one.getTraySize()) |
| | | || !command.getTraySize().equals(one.getTraySize()) || !command.getCommand().equals(one.getCommand()) |
| | | || !command.getAckFinish().equals(one.getAckFinish()) |
| | | ){ |
| | | try{ |
| | |
| | | if(result.IsSuccess){ |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | Thread.sleep(200); |
| | | log.info("堆垛机任务完成复位,此时堆垛机状态:"+crnProtocol.getStatusType()+",堆垛机id:"+crnProtocol.getCrnNo()); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.18", (short) 2); |
| | | if (resultRead.IsSuccess) { |
| | | commandFinish=siemensNet.getByteTransform().TransInt16(resultRead.Content, 0); |