|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); | 
|---|
|  |  |  | assignCommand.setShuttleNo(deviceNo); | 
|---|
|  |  |  | assignCommand.setTaskNo(motion.getWrkNo()); | 
|---|
|  |  |  | assignCommand.setTaskNo(motion.getTaskNo()); | 
|---|
|  |  |  | assignCommand.setDeviceTaskNo(shuttleThread.generateDeviceTaskNo(motion.getTaskNo(), MotionCtgType.get(motion.getMotionCtgEl()))); | 
|---|
|  |  |  | assignCommand.setSourceLocNo(motion.getOrigin()); | 
|---|
|  |  |  | assignCommand.setLocNo(motion.getTarget()); | 
|---|
|  |  |  | assignCommand.setDeviceId(Integer.parseInt(motion.getDevice())); | 
|---|
|  |  |  | 
|---|
|  |  |  | case SHUTTLE_MOVE_LIFT_PALLET://穿梭车顶升并移动 | 
|---|
|  |  |  | shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; | 
|---|
|  |  |  | shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getWrkNo(), true)); | 
|---|
|  |  |  | shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getTaskNo(), true)); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_MOVE_DOWN_PALLET://穿梭车移动并托盘下降 | 
|---|
|  |  |  | shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; | 
|---|
|  |  |  | shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getWrkNo(), false)); | 
|---|
|  |  |  | shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getTaskNo(), false)); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_MOVE_FROM_LIFT://出提升机 | 
|---|
|  |  |  | // 判断提升机状态 | 
|---|
|  |  |  | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_CHARGE_ON://充电开 | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.CHARGE; | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), true)); | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getChargeCommand(motion.getTaskNo(), true)); | 
|---|
|  |  |  | assignCommand.setCharge(Boolean.TRUE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_CHARGE_OFF://充电关 | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.CHARGE; | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), false)); | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getChargeCommand(motion.getTaskNo(), false)); | 
|---|
|  |  |  | assignCommand.setCharge(Boolean.TRUE); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_PALLET_LIFT://托盘顶升 | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.PALLET_LIFT; | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), true)); | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), true)); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_PALLET_DOWN://托盘下降 | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.PALLET_DOWN; | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), false)); | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), false)); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | throw new CoolException(motion.getMotionCtgEl() + "没有指定任务作业流程!!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getTaskNo().intValue() != motion.getWrkNo()) { | 
|---|
|  |  |  | if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //充电任务 | 
|---|
|  |  |  | if (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl())).equals(MotionCtgType.SHUTTLE_CHARGE_ON)) { | 
|---|
|  |  |  | // 复位穿梭车 | 
|---|
|  |  |  | shuttleProtocol.setTaskNo(0); | 
|---|
|  |  |  | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); | 
|---|
|  |  |  | shuttleProtocol.setPakMk(true); | 
|---|
|  |  |  | shuttleThread.setSyncTaskNo(0); | 
|---|
|  |  |  | shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE); | 
|---|
|  |  |  | shuttleThread.setPakMk(true); | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.WAITING) | 
|---|
|  |  |  | //            && !shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.CHARGING_WAITING) | 
|---|
|  |  |  | //        ) { | 
|---|
|  |  |  | //            return false; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.WAITING) | 
|---|
|  |  |  | && !shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.CHARGING_WAITING) | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断设备是否空闲 | 
|---|
|  |  |  | if (!shuttleThread.isIdle()) { | 
|---|
|  |  |  | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 复位穿梭车 | 
|---|
|  |  |  | shuttleProtocol.setTaskNo(0); | 
|---|
|  |  |  | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); | 
|---|
|  |  |  | shuttleProtocol.setPakMk(true); | 
|---|
|  |  |  | shuttleThread.setSyncTaskNo(0); | 
|---|
|  |  |  | shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE); | 
|---|
|  |  |  | shuttleThread.setPakMk(true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | //通过xy坐标小车二维码 | 
|---|
|  |  |  | String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ(), hostId); | 
|---|
|  |  |  | //获取移动命令 | 
|---|
|  |  |  | ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed); | 
|---|
|  |  |  | ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed); | 
|---|
|  |  |  | command.setNodes(nodes);//将行走节点添加到每一步命令中 | 
|---|
|  |  |  | commands.add(command); | 
|---|
|  |  |  | } | 
|---|