|  |  | 
 |  |  | package com.zy.asrs.wcs.core.kernel.command; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.zy.asrs.framework.common.Cools; | 
 |  |  | import com.zy.asrs.framework.exception.CoolException; | 
 |  |  | 
 |  |  | import com.zy.asrs.wcs.rcs.News; | 
 |  |  | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; | 
 |  |  | import com.zy.asrs.wcs.core.entity.Motion; | 
 |  |  | import com.zy.asrs.wcs.rcs.entity.Device; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; | 
 |  |  | 
 |  |  |     private LiftAction liftAction; | 
 |  |  |     @Autowired | 
 |  |  |     private LiftDispatcher liftDispatcher; | 
 |  |  |     @Autowired | 
 |  |  |     private ShuttleDispatcher shuttleDispatcher; | 
 |  |  |  | 
 |  |  |     // 计算 | 
 |  |  |     public Boolean accept(Motion motion) { | 
 |  |  | 
 |  |  |         if (null == shuttleProtocol) { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Device shuttleDevice = shuttleThread.getDevice(); | 
 |  |  |         if (!shuttleThread.isIdle(new ExecuteSupport() { | 
 |  |  |             @Override | 
 |  |  |             public Boolean judgement() { | 
 |  |  | 
 |  |  |                 shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_UPDATE_LOCATION; | 
 |  |  |                 shuttleCommands.add(shuttleThread.getUpdateLocationCommand(motion.getTaskNo(), motion.getTarget())); | 
 |  |  |                 break; | 
 |  |  |             case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 | 
 |  |  |                 shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; | 
 |  |  |  | 
 |  |  |                 //获取全部待机位 | 
 |  |  |                 List<String> standbyLocs = JSON.parseArray(motion.getTemp(), String.class); | 
 |  |  |                 //获取可用待机位 | 
 |  |  |                 String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs); | 
 |  |  |                 shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), shuttleFromLiftStandbyLoc, NavigationMapType.NORMAL.id, assignCommand, shuttleThread); | 
 |  |  |  | 
 |  |  |                 //更新动作可用待机位 | 
 |  |  |                 motion.setTarget(shuttleFromLiftStandbyLoc); | 
 |  |  |                 motion.setUpdateTime(new Date()); | 
 |  |  |                 motionService.updateById(motion); | 
 |  |  |  | 
 |  |  |                 break; | 
 |  |  |             default: | 
 |  |  |                 throw new CoolException(motion.getMotionCtgEl() + "没有指定任务作业流程!!!"); | 
 |  |  |         } |