| | |
| | | package com.zy.asrs.wcs.core.kernel; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wcs.core.domain.dto.MotionDto; |
| | | import com.zy.asrs.wcs.core.entity.*; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.*; |
| | | import com.zy.asrs.wcs.core.service.*; |
| | | import com.zy.asrs.wcs.core.utils.ConveyorDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.LiftDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | 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.SlaveType; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 1.充电任务,2.库位移转,3.小车迁移,4.手动任务 |
| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = shuttleStandbyFrom.getLockPath$(); |
| | | |
| | | // 入库目标层有穿梭车 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) { |
| | | |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | // 穿梭车载货走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | dto.setReleaseLift(2);//执行中释放提升机 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | |
| | | // 穿梭车入库托盘下降 |
| | |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定目标楼层穿梭车待机位路径 |
| | | // 锁定换层路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | })) |
| | | )); |
| | | |
| | | // 解锁换层路径 |
| | | motionList.addAll(kernelService.mapUnlockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车入库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | // 穿梭车载货走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | dto.setReleaseLift(2);//执行中释放提升机 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | |
| | | // 穿梭车入库托盘下降 |
| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机后小车待机位 |
| | | String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc(); |
| | | //穿梭车出提升机后全部待机位 |
| | | String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//获取全部待机位 |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = shuttleStandbyFrom.getLockPath$(); |
| | | |
| | | //获取出库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | |
| | | .eq(BasConveyorPath::getTypeNo, taskCtg.getId())); |
| | | if (basConveyorPath == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //分析出库路径待机库位 |
| | | String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, standbyLocNoTo, shuttleDevice); |
| | | if (lastPathStartLoc == null) { |
| | | return motionList;//未分析成功 |
| | | } |
| | | |
| | | /** |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车出库至提升机待机位 |
| | | // 穿梭车载货出库至最后一段路径等待 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | 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.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位 - 到待机位(自动选择合适待机位) |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocs); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseShuttle(1);//执行完成后释放小车 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_STANDBY |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31001);//出库站点 |
| | | dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位 - 到待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleFromLiftStandbyLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定目标楼层穿梭车待机位路径 |
| | | // 锁定换层路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | })) |
| | | )); |
| | | |
| | | // 解锁换层路径 |
| | | 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 -> { |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车出库至提升机待机位 |
| | | // 穿梭车载货出库至最后一段路径等待 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | 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.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位 - 到待机位(自动选择合适待机位) |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocs); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseShuttle(1);//执行完成后释放小车 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_STANDBY |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31001);//出库站点 |
| | | dto.setSync(0);//异步执行 |
| | | dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位 - 到待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleFromLiftStandbyLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = liftDispatcher.getLockPathByLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定目标楼层穿梭车待机位路径 |
| | | // 锁定换层路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 解锁换层路径 |
| | | motionList.addAll(kernelService.mapUnlockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); |
| | | })); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | // 穿梭车载货走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(targetLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | |
| | | //托盘下降 |