| | |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | // short[] array = new short[10]; |
| | | short[] array = new short[10]; |
| | | short[] array = new short[11]; |
| | | array[0] = command.getAckFinish(); // 任务完成确认位 |
| | | array[1] = command.getTaskNo(); // 任务号 |
| | | array[2] = command.getTaskMode(); // 模式 |
| | |
| | | array[7] = command.getDestinationPosY(); // 目标位置列号 |
| | | array[8] = command.getDestinationPosZ(); // 目标位置层号 |
| | | array[9] = command.getCommand(); |
| | | // array[10] = 0; //备用1 |
| | | array[10] = command.getTraySize(); //备用1 |
| | | |
| | | boolean[] array2 = new boolean[1]; |
| | | array2[0] = command.isTraySize(); |
| | | |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | OperateResult result2 = siemensNet.Write("DB100.22", array2); |
| | | |
| | | News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array); |
| | | |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | |
| | | |
| | | do { |
| | | try{ |
| | | if(!result.IsSuccess || !result2.IsSuccess){ |
| | | if(!result.IsSuccess ){ |
| | | News.error("写入堆垛机plc数据失败,重新下发任务 写入直接失败 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount1); |
| | | // MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | result2 = siemensNet.Write("DB100.22", array2); |
| | | Thread.sleep(100); |
| | | writeCount1++; |
| | | continue; |
| | |
| | | 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.setTraySize(siemensNet.getByteTransform().TransBool(resultRead.Content, 22)); |
| | | 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.isTraySize() == one.isTraySize() |
| | | || !command.getTraySize().equals(one.getTraySize()) |
| | | ){ |
| | | try{ |
| | | News.error("堆垛机命令地址写入后回读失败==>不一致[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); |
| | |
| | | // MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | News.error("写入堆垛机plc数据失败,重新下发任务 回读不一致 ===>> [id:{}],{},[写入次数:{}]", slave.getId(), JSON.toJSON(command),writeCount1); |
| | | result = siemensNet.Write("DB100.0", array); |
| | | result2 = siemensNet.Write("DB100.22", array2); |
| | | writeCount1++; |
| | | continue; |
| | | |