|  |  | 
 |  |  |                             if (wrkMast.getWrkSts() == 8 || Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) { | 
 |  |  |                                 //同一层直接取货无需经过提升机 | 
 |  |  |                                 //直接计算车到提升机取货再到库位路径指令 | 
 |  |  |                                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo, assignCommand); | 
 |  |  |                                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo, assignCommand,shuttleThread); | 
 |  |  |                                 if (wrkMast.getWrkSts() == 8) { | 
 |  |  |                                     //此时车在提升机内部,需要多下达一步指令让车移动到提升机口 | 
 |  |  |                                     BasDevp basDevp = basDevpService.selectById(109);//获取提升机信息 | 
 |  |  |                                     ShuttleCommand moveCommand = new ShuttleCommand(); | 
 |  |  |                                     moveCommand.setCommandWord((short) 1); | 
 |  |  |                                     moveCommand.setStartCodeNum(Short.parseShort(basDevp.getQrCodeValue()));//提升机内部二维码 | 
 |  |  |                                     moveCommand.setDistCodeNum(commands.get(0).getStartCodeNum());//提升机口二维码 | 
 |  |  |                                     moveCommand.setStartToDistDistance(1300); | 
 |  |  |                                     moveCommand.setMiddleToDistDistance(0); | 
 |  |  |                                     moveCommand.setRunDirection(commands.get(0).getRunDirection()); | 
 |  |  |                                     moveCommand.setCommandEnd((short) 1); | 
 |  |  |                                     short startCode = Short.parseShort(basDevp.getQrCodeValue());//提升机内部二维码 | 
 |  |  |                                     Short distCode = commands.get(0).getStartCodeNum();//提升机口二维码 | 
 |  |  |                                     Short runDirection = commands.get(0).getRunDirection();//运行方向 | 
 |  |  |                                     //获取命令 | 
 |  |  |                                     ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, runDirection); | 
 |  |  |                                     commands.add(0, moveCommand);//将该指令添加到队头 | 
 |  |  |                                 } | 
 |  |  |                                 assignCommand.setCommands(commands); | 
 |  |  | 
 |  |  |                                 //不同层,将目标库位分配成提升机库位号 | 
 |  |  |  | 
 |  |  |                                 //小车移动到提升机口,计算路径 | 
 |  |  |                                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand); | 
 |  |  |                                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread); | 
 |  |  |                                 //分配目标库位 | 
 |  |  |                                 shuttleProtocol.setLocNo(liftLocNo); | 
 |  |  |                                 //目标库位 | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     //获取起点-终点指令。mapType:1=》无货地图,2=》有货地图 | 
 |  |  |     public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand) { | 
 |  |  |     public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) { | 
 |  |  |         //计算小车起点到中点所需命令 | 
 |  |  |         List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNo, mapType); | 
 |  |  |         List<ShuttleCommand> commands = new ArrayList<>(); | 
 |  |  | 
 |  |  |             //目标路径 | 
 |  |  |             NavigateNode endPath = nodes.get(nodes.size() - 1); | 
 |  |  |             Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 | 
 |  |  |  | 
 |  |  |             ShuttleCommand command = new ShuttleCommand(); | 
 |  |  |             command.setCommandWord((short) 1); | 
 |  |  |  | 
 |  |  |             //通过xy坐标小车二维码 | 
 |  |  |             Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ()); | 
 |  |  |             command.setStartCodeNum(startCodeNum); | 
 |  |  |  | 
 |  |  |             command.setMiddleCodeNum((short) 1); | 
 |  |  |  | 
 |  |  |             //通过xy坐标小车二维码 | 
 |  |  |             Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ()); | 
 |  |  |             command.setDistCodeNum(distCodeNum); | 
 |  |  |  | 
 |  |  |             command.setStartToDistDistance(allDistance); | 
 |  |  |             command.setMiddleToDistDistance(0); | 
 |  |  |             command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id); | 
 |  |  |             command.setPalletLift((short) 1); | 
 |  |  |             command.setForceMoveDistance(0); | 
 |  |  |             command.setChargeSwitch((short) 2); | 
 |  |  |             command.setIOControl((short) 0); | 
 |  |  |             command.setRadarTmp((short) 0); | 
 |  |  |             command.setCommandEnd((short) 1); | 
 |  |  |             //获取移动命令 | 
 |  |  |             ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id); | 
 |  |  |             commands.add(command); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     //获取起点-中点-终点指令 | 
 |  |  |     public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String middleLocNo, String locNo, ShuttleAssignCommand assignCommand) { | 
 |  |  |     public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String middleLocNo, String locNo, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) { | 
 |  |  |         //计算小车起点到中点所需命令 | 
 |  |  |         List<NavigateNode> calc = NavigateUtils.calc(startLocNo, middleLocNo, 1);//小车无货,走入库地图 | 
 |  |  |         List<ShuttleCommand> commands = new ArrayList<>(); | 
 |  |  | 
 |  |  |             NavigateNode endPath = nodes.get(nodes.size() - 1); | 
 |  |  |             Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 | 
 |  |  |  | 
 |  |  |             ShuttleCommand command = new ShuttleCommand(); | 
 |  |  |             command.setCommandWord((short) 1); | 
 |  |  |  | 
 |  |  |             //通过xy坐标小车二维码 | 
 |  |  |             Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ()); | 
 |  |  |             command.setStartCodeNum(startCodeNum); | 
 |  |  |  | 
 |  |  |             command.setMiddleCodeNum((short) 1); | 
 |  |  |  | 
 |  |  |             //通过xy坐标小车二维码 | 
 |  |  |             Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ()); | 
 |  |  |             command.setDistCodeNum(distCodeNum); | 
 |  |  |  | 
 |  |  |             command.setStartToDistDistance(allDistance); | 
 |  |  |             command.setMiddleToDistDistance(0); | 
 |  |  |             command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id); | 
 |  |  |             command.setPalletLift((short) 1); | 
 |  |  |             command.setForceMoveDistance(0); | 
 |  |  |             command.setChargeSwitch((short) 2); | 
 |  |  |             command.setIOControl((short) 0); | 
 |  |  |             command.setRadarTmp((short) 0); | 
 |  |  |             command.setCommandEnd((short) 1); | 
 |  |  |             //获取移动命令 | 
 |  |  |             ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id); | 
 |  |  |             commands.add(command); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //小车指令到达目标位置后,再发出一条顶升指令 | 
 |  |  |         ShuttleCommand command = new ShuttleCommand(); | 
 |  |  |         command.setCommandWord((short) 2); | 
 |  |  |         command.setPalletLift((short) 1); | 
 |  |  |         command.setCommandEnd((short) 1); | 
 |  |  |         commands.add(command); | 
 |  |  |         commands.add(shuttleThread.getPalletCommand((short) 1)); | 
 |  |  |  | 
 |  |  |         //计算小车中点到终点所需命令 | 
 |  |  |         List<NavigateNode> calc2 = NavigateUtils.calc(middleLocNo, locNo, 2);//小车有货,走出库地图(出库地图有专用货道) | 
 |  |  | 
 |  |  |             NavigateNode endPath = nodes.get(nodes.size() - 1); | 
 |  |  |             Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 | 
 |  |  |  | 
 |  |  |             command = new ShuttleCommand(); | 
 |  |  |             command.setCommandWord((short) 1); | 
 |  |  |  | 
 |  |  |             //通过xy坐标小车二维码 | 
 |  |  |             Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ()); | 
 |  |  |             command.setStartCodeNum(startCodeNum); | 
 |  |  |  | 
 |  |  |             command.setMiddleCodeNum((short) 1); | 
 |  |  |  | 
 |  |  |             //通过xy坐标小车二维码 | 
 |  |  |             Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ()); | 
 |  |  |             command.setDistCodeNum(distCodeNum); | 
 |  |  |  | 
 |  |  |             command.setStartToDistDistance(allDistance); | 
 |  |  |             command.setMiddleToDistDistance(0); | 
 |  |  |             command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id); | 
 |  |  |             command.setPalletLift((short) 1); | 
 |  |  |             command.setForceMoveDistance(0); | 
 |  |  |             command.setChargeSwitch((short) 2); | 
 |  |  |             command.setIOControl((short) 0); | 
 |  |  |             command.setRadarTmp((short) 0); | 
 |  |  |             command.setCommandEnd((short) 1); | 
 |  |  |             commands.add(command); | 
 |  |  |             ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id); | 
 |  |  |             commands.add(moveCommand); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //小车指令到达目标位置后,再发出一条托盘下降指令 | 
 |  |  |         command = new ShuttleCommand(); | 
 |  |  |         command.setCommandWord((short) 2); | 
 |  |  |         command.setPalletLift((short) 2); | 
 |  |  |         command.setCommandEnd((short) 1); | 
 |  |  |         commands.add(command); | 
 |  |  |         commands.add(shuttleThread.getPalletCommand((short) 2)); | 
 |  |  |  | 
 |  |  |         assignCommand.setNodes(allNode);//当前任务所占用的节点list | 
 |  |  |         //所使用的路径进行锁定禁用 | 
 |  |  | 
 |  |  |                         if (Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) { | 
 |  |  |                             //同一层(将小车移动到货物位置) | 
 |  |  |  | 
 |  |  |                             List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand); | 
 |  |  |                             List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread); | 
 |  |  |                             //分配目标库位 | 
 |  |  |                             shuttleProtocol.setLocNo(wrkMast.getSourceLocNo()); | 
 |  |  |                             //目标库位 | 
 |  |  | 
 |  |  |                             //不同层,将目标库位分配成提升机库位号(将小车移动到提升机位置) | 
 |  |  |  | 
 |  |  |                             //小车到提升机口指令 | 
 |  |  |                             List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand); | 
 |  |  |                             List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread); | 
 |  |  |                             shuttleProtocol.setLocNo(liftLocNo); | 
 |  |  |                             //目标库位 | 
 |  |  |                             assignCommand.setLocNo(liftLocNo); | 
 |  |  | 
 |  |  |                             wrkMast.setWrkSts(22L);//小车迁移状态 | 
 |  |  |                         } | 
 |  |  |                     } else if (wrkMast.getWrkSts() == 25) { | 
 |  |  |                         List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand); | 
 |  |  |                         List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread); | 
 |  |  |                         //此时车在提升机内部,需要多下达一步指令让车移动到提升机口 | 
 |  |  |                         BasDevp basDevp = basDevpService.selectById(109);//获取提升机信息 | 
 |  |  |                         ShuttleCommand moveCommand = new ShuttleCommand(); | 
 |  |  |                         moveCommand.setCommandWord((short) 1);//小车移动指令字 | 
 |  |  |                         moveCommand.setStartCodeNum(Short.parseShort(basDevp.getQrCodeValue()));//提升机二维码 | 
 |  |  |                         moveCommand.setDistCodeNum(commands.get(0).getStartCodeNum()); | 
 |  |  |                         moveCommand.setStartToDistDistance(1300); | 
 |  |  |                         moveCommand.setMiddleToDistDistance(0); | 
 |  |  |                         moveCommand.setRunDirection(commands.get(0).getRunDirection()); | 
 |  |  |                         moveCommand.setCommandEnd((short) 1); | 
 |  |  |                         short startCode = Short.parseShort(basDevp.getQrCodeValue());//提升机二维码 | 
 |  |  |                         Short distCode = commands.get(0).getStartCodeNum();//目标二维码 | 
 |  |  |                         //获取移动命令 | 
 |  |  |                         ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, commands.get(0).getRunDirection()); | 
 |  |  |                         commands.add(0, moveCommand);//将该指令添加到队头 | 
 |  |  |  | 
 |  |  |                         //分配目标库位 | 
 |  |  | 
 |  |  |                 ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); | 
 |  |  |  | 
 |  |  |                 //获取小车到充电库位路径指令 | 
 |  |  |                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, chargeLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand); | 
 |  |  |                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, chargeLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread); | 
 |  |  |                 //进行充电中 | 
 |  |  |                 shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING); | 
 |  |  |  | 
 |  |  | 
 |  |  |                 assignCommand.setCharge(true);//充电任务 | 
 |  |  |  | 
 |  |  |                 //创建充电指令 | 
 |  |  |                 ShuttleCommand command = new ShuttleCommand(); | 
 |  |  |                 command.setCommandWord((short) 5);//充电 | 
 |  |  |                 command.setShuttleNo(shuttleProtocol.getShuttleNo()); | 
 |  |  |                 command.setChargeSwitch((short) 1);//开始充电 | 
 |  |  |                 command.setCommandEnd((short) 1); | 
 |  |  |                 ShuttleCommand command = shuttleThread.getChargeSwitchCommand((short) 1);//开始充电 | 
 |  |  |                 commands.add(command); | 
 |  |  |  | 
 |  |  |                 //指令集分配 | 
 |  |  | 
 |  |  |                 ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); | 
 |  |  |  | 
 |  |  |                 //小车移动到提升机口,计算路径 | 
 |  |  |                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand); | 
 |  |  |                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread); | 
 |  |  |                 //分配目标库位 | 
 |  |  |                 shuttleProtocol.setLocNo(liftLocNo); | 
 |  |  |  | 
 |  |  | 
 |  |  |                 assignCommand.setCharge(true); | 
 |  |  |  | 
 |  |  |                 //创建充电指令 | 
 |  |  |                 ShuttleCommand command = new ShuttleCommand(); | 
 |  |  |                 command.setCommandWord((short) 5);//充电 | 
 |  |  |                 command.setShuttleNo(shuttleProtocol.getShuttleNo()); | 
 |  |  |                 command.setChargeSwitch((short) 2);//断开充电 | 
 |  |  |                 command.setCommandEnd((short) 1); | 
 |  |  |                 ShuttleCommand command = shuttleThread.getChargeSwitchCommand((short) 2);//断开充电 | 
 |  |  |                 commands.add(command); | 
 |  |  |  | 
 |  |  |                 //指令集分配 |