| | |
| | | import com.zy.asrs.wcs.core.utils.*; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | 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 BasConveyorService basConveyorService; |
| | | @Autowired |
| | | private BasConveyorStaService basConveyorStaService; |
| | | @Autowired |
| | | private ShuttleDispatcher shuttleDispatcher; |
| | | |
| | | // 计算 |
| | | public Boolean accept(Motion motion) { |
| | |
| | | if (shuttleThread == null) { |
| | | return false; |
| | | } |
| | | Device shuttleDevice = shuttleThread.getDevice(); |
| | | |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (null == shuttleProtocol) { |
| | | return false; |
| | |
| | | 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() + "没有指定任务作业流程!!!"); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | break; |
| | | case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(motion.getTarget())) { |
| | | return false; |
| | | } |
| | | |
| | | if (Optional.ofNullable(motion.getReleaseShuttle()).orElse(0) == 1) {//释放穿梭车 |
| | | task.setShuttleNo(0); |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | return false; |
| | | } |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |