| | |
| | | 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.TaskStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.WorkZoneType; |
| | | import com.zy.asrs.wcs.core.service.ShuttleStandbyService; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.core.utils.ConveyorDispatcher; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * todo:luxiaotao 1.充电任务,2.库位移转,3.小车迁移 |
| | | * 1.充电任务,2.库位移转,3.小车迁移,4.手动任务 |
| | | * Created by vincent on 2023/10/11 |
| | | */ |
| | | @Service |
| | |
| | | // locNo |
| | | String locNo = task.getDestLoc(); |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (device == null) { |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | return motionList; |
| | | } |
| | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } else { |
| | | //小车跨层 |
| | | |
| | | //获取距离目标位置最近的空闲提升机 |
| | | LiftThread liftThread = liftDispatcher.searchIdleLift(locNo, task.getHostId()); |
| | | if (liftThread == null) { |
| | | return motionList; |
| | | } |
| | | Device liftDevice = liftThread.getDevice(); |
| | | |
| | | //穿梭车到提升机库位号 |
| | | String liftLocNoTo = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(shuttleLocNo)); |
| | | |
| | | //穿梭车出提升机库位号 |
| | | String liftLocNoFrom = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | //穿梭车到提升机待机位库位号 |
| | | String standbyLocNoTo = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(shuttleLocNo)); |
| | | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 提升机搬车 至 目标位置层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(locNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至目标位置 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | /** |
| | | * 生成提升机手动动作 |
| | | */ |
| | | public List<Motion> generateLiftManualMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | if (task.getTaskSts() != TaskStsType.NEW_MANUAL.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getLiftNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (device == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | if (task.getDestSite().equals("move")) { |
| | | //提升机升降楼层 |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getDestLoc())); |
| | | })) |
| | | )); |
| | | |
| | | } else if (task.getDestSite().equals("movePallet")) { |
| | | //移动托盘 |
| | | |
| | | // 提升机移动托盘 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getOriginLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getOriginSite())); |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getDestLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | })) |
| | | )); |
| | | |
| | | } |
| | | |
| | | return motionList; |
| | | } |
| | | |
| | | } |