| | |
| | | // locNo 目标库位 |
| | | String locNo = task.getDestLoc(); |
| | | |
| | | // shuttle |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | if (!shuttleThread.isIdle()) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | //获取距离目标位置最近的空闲可换层提升机 |
| | | LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true); |
| | | if (liftThread == null) { |
| | | return motionList; |
| | | } |
| | | Device transferLiftDevice = liftThread.getDevice(); |
| | | |
| | | if (!shuttleLocNo.equals(locNo)) {//小车不在目标库位 |
| | | // 穿梭车走行至源库位 |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //获取小车待机库位 ==> 进提升机 |
| | | ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | |
| | | //获取小车待机库位 ==> 出提升机 |
| | | ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(originLoc)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | if (shuttleStandbyTo == null || shuttleStandbyFrom == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //穿梭车进提升机库位号 |
| | | String liftLocNoTo = shuttleStandbyTo.getDeviceLoc(); |
| | | |
| | | //穿梭车出提升机库位号 |
| | | String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc(); |
| | | |
| | | //穿梭车进提升机待机位库位号 |
| | | String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机后全部待机位 |
| | | String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//获取全部待机位 |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = shuttleStandbyFrom.getLockPath$(); |
| | | |
| | | //获取出库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.OUT)) |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | if (taskCtg == null) { |
| | | return motionList; |
| | | } |
| | | //获取输送线路径 |
| | | BasConveyorPath basConveyorPath = basConveyorPathService.getOne(new LambdaQueryWrapper<BasConveyorPath>() |
| | | .eq(BasConveyorPath::getDeviceStn, task.getOriginSite()) |
| | | .eq(BasConveyorPath::getDeviceNo, liftProtocol.getLiftNo()) |
| | | .eq(BasConveyorPath::getTypeNo, taskCtg.getId())); |
| | | if (basConveyorPath == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //分析出库路径待机库位 |
| | | String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, locNo, shuttleDevice); |
| | | if (lastPathStartLoc == null) { |
| | | return motionList;//未分析成功 |
| | | } |
| | | |
| | | /** |
| | | * 出库 |
| | | */ |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(originLoc)) { |
| | | |
| | | //穿梭车不在出库库位 |
| | | if (!shuttleLocNo.equals(task.getOriginLoc())) { |
| | | // 穿梭车走行至出库库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | } |
| | | |
| | | // 穿梭车顶升 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(shuttleDevice.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); |
| | | })); |
| | | // 穿梭车出库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | if (!originLoc.equals(lastPathStartLoc)) { |
| | | // 穿梭车载货出库至最后一段路径等待 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | |
| | | //穿梭车托盘下降 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(shuttleDevice.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val()); |
| | | })); |
| | | |
| | | } |
| | | |
| | | // // 穿梭车载货至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | // dto.setLocNo(lastPathStartLoc); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | // dto.setShuttleDevice(shuttleDevice); |
| | | // dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站 |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR |
| | | // )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 二、出库起始层没有穿梭车 |
| | | */ |
| | | } else { |
| | | //小车跨层 |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定换层路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机搬车 至 目标位置层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(liftLocNoFrom)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 更新小车坐标 |
| | | motionList.addAll(kernelService.shuttleUpdateLocation( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 解锁换层路径 |
| | | motionList.addAll(kernelService.mapUnlockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至出库库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车出库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | if (!originLoc.equals(lastPathStartLoc)) { |
| | | // 穿梭车载货出库至最后一段路径等待 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | } |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setShuttleDevice(shuttleDevice); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | } |
| | | return motionList; |
| | | } |