| | |
| | | if (result.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | | crnProtocol.setCrnNo(slave.getId()); |
| | | } |
| | | crnProtocol.setMode(siemensNet.getByteTransform().TransInt16(result.Content, 0)); |
| | | crnProtocol.setTaskNo(siemensNet.getByteTransform().TransInt16(result.Content, 2)); |
| | |
| | | log.error("堆垛机写入命令为空"); |
| | | return false; |
| | | } |
| | | convertRow(command); |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[12]; |
| | | array[0] = command.getAckFinish(); |
| | | array[1] = command.getTaskNo(); |
| | | array[2] = command.getTaskMode(); |
| | | array[3] = command.getSourcePosX(); |
| | | array[4] = command.getSourcePosY(); |
| | | array[5] = command.getSourcePosZ(); |
| | | array[6] = command.getDestinationPosX(); |
| | | array[7] = command.getDestinationPosY(); |
| | | array[8] = command.getDestinationPosZ(); |
| | | array[9] = command.getSourceStaNo(); |
| | | array[10] = command.getDestinationStaNo(); |
| | | array[11] = command.getCommand(); |
| | | short[] array = new short[10]; |
| | | array[0] = command.getAckFinish(); // 任务完成确认位 |
| | | array[1] = command.getTaskNo(); // 任务号 |
| | | array[2] = command.getTaskMode(); // 模式 |
| | | array[3] = command.getSourcePosX(); // 源位置排号 |
| | | array[4] = command.getSourcePosY(); // 源位置列号 |
| | | array[5] = command.getSourcePosZ(); // 源位置层号 |
| | | array[6] = command.getDestinationPosX(); // 目标位置排号 |
| | | array[7] = command.getDestinationPosY(); // 目标位置列号 |
| | | array[8] = command.getDestinationPosZ(); // 目标位置层号 |
| | | // array[9] = command.getSourceStaNo(); |
| | | // array[10] = command.getDestinationStaNo(); |
| | | array[9] = command.getCommand(); |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | |
| | | if (command.getAckFinish() == 0) { |
| | | short commandFinish = 1; |
| | | result = siemensNet.Write("DB100.22", commandFinish); |
| | | Thread.sleep(100L); |
| | | result = siemensNet.Write("DB100.18", commandFinish); |
| | | } |
| | | |
| | | try { |