|  |  |  | 
|---|
|  |  |  | private ShuttleAction shuttleAction; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LiftAction liftAction; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LiftDispatcher liftDispatcher; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 计算 | 
|---|
|  |  |  | public Boolean accept(Motion motion) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 判断提升机是否空闲 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | if (!liftThread.isIdle(MotionCtgType.SHUTTLE_MOVE_FROM_LIFT)) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (liftProtocol.getLev() != Utils.getLev(motion.getTarget())) {//判断提升机是否达到目标层 | 
|---|
|  |  |  | if (liftProtocol.getLev() != liftDispatcher.getLiftLevOffset(liftThread.getDevice().getId().intValue(), Utils.getLev(motion.getTarget()))) {//判断提升机是否达到目标层 | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | })) { | 
|---|
|  |  |  | //锁定提升机 | 
|---|
|  |  |  | List<LiftCommand> lockCommand = liftThread.getLockCommand(motion.getTaskNo(), true);//获取提升机锁定命令 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); | 
|---|
|  |  |  | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); | 
|---|
|  |  |  | liftAssignCommand.setTaskNo(motion.getTaskNo()); | 
|---|
|  |  |  | ArrayList<LiftCommand> list = new ArrayList<>(); | 
|---|
|  |  |  | list.addAll(lockCommand); | 
|---|
|  |  |  | liftAssignCommand.setCommands(list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); | 
|---|
|  |  |  | return false;//等待下一次轮询 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //                //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | //                if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | //                    return false; | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; | 
|---|
|  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 判断提升机是否空闲 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | if (!liftThread.isIdle(MotionCtgType.SHUTTLE_MOVE_TO_LIFT)) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (liftProtocol.getLev() != Utils.getLev(motion.getTarget())) {//判断提升机是否达到目标层 | 
|---|
|  |  |  | if (liftProtocol.getLev() != liftDispatcher.getLiftLevOffset(liftThread.getDevice().getId().intValue(), Utils.getLev(motion.getTarget()))) {//判断提升机是否达到目标层 | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | })) { | 
|---|
|  |  |  | //锁定提升机 | 
|---|
|  |  |  | List<LiftCommand> lockCommand = liftThread.getLockCommand(motion.getTaskNo(), true);//获取提升机锁定命令 | 
|---|
|  |  |  | if (lockCommand == null) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); | 
|---|
|  |  |  | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); | 
|---|
|  |  |  | liftAssignCommand.setTaskNo(motion.getTaskNo()); | 
|---|
|  |  |  | ArrayList<LiftCommand> list = new ArrayList<>(); | 
|---|
|  |  |  | list.addAll(lockCommand); | 
|---|
|  |  |  | liftAssignCommand.setCommands(list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); | 
|---|
|  |  |  | return false;//等待下一次轮询 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //                //判断提升机工作号是否和当前任务相同 | 
|---|
|  |  |  | //                if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { | 
|---|
|  |  |  | //                    return false; | 
|---|
|  |  |  | //                } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; | 
|---|
|  |  |  | 
|---|
|  |  |  | case SHUTTLE_PALLET_DOWN://托盘下降 | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.PALLET_DOWN; | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), false)); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_UPDATE_LOCATION://小车坐标更新 | 
|---|
|  |  |  | shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_UPDATE_LOCATION; | 
|---|
|  |  |  | shuttleCommands.add(shuttleThread.getUpdateLocationCommand(motion.getTaskNo(), motion.getTarget())); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | throw new CoolException(motion.getMotionCtgEl() + "没有指定任务作业流程!!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | list.addAll(signalCommand); | 
|---|
|  |  |  | liftAssignCommand.setCommands(list); | 
|---|
|  |  |  | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); | 
|---|
|  |  |  | redisUtil.set(DeviceRedisConstant.COMMAND_TMP + motion.getTaskNo(), true, 120); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | liftThread.setSyncTaskNo(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case SHUTTLE_UPDATE_LOCATION://小车坐标更新 | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|