| | |
| | | package com.zy.asrs.wcs.core.kernel; |
| | | |
| | | 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.common.R; |
| | | 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 org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private BasConveyorPathService basConveyorPathService; |
| | | @Autowired |
| | | private BasConveyorStaService basConveyorStaService; |
| | | @Autowired |
| | | private BasConveyorService basConveyorService; |
| | | @Autowired |
| | | private TaskCtgService taskCtgService; |
| | | |
| | | public Integer getStaByLev(Integer lev) { |
| | | HashMap<Integer, Integer> map = new HashMap<>(); |
| | | map.put(1, 31006); |
| | | map.put(2, 31007); |
| | | map.put(3, 31008); |
| | | |
| | | return map.get(lev); |
| | | } |
| | | |
| | | public List<Motion> generateMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | |
| | | |
| | | /** |
| | | * 入库 |
| | | * 一、入库目标层有穿梭车 |
| | | * 1.提升机升降到源层 |
| | | * 2.货物从输送线到提升机 |
| | | * 3.提升机载货移动(非必需) |
| | | * 4.穿梭车走行至提升机 |
| | | * 5.穿梭车入库至目标库位 |
| | | */ |
| | | if (task.getTaskSts() == TaskStsType.NEW_INBOUND.sts) { |
| | | // locNo |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | BasConveyorSta basConveyorStaDest = basConveyorStaService.selectBySiteNo(task.getDestSite()); |
| | | if (basConveyorStaDest == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测提升机是否有任务绑定 |
| | | boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | if (liftResult) { |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = shuttleStandbyFrom.getLockPath$(); |
| | | |
| | | // 入库目标层有穿梭车 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) { |
| | | |
| | |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31004);//入库站点 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | dto.setSync(0); |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); |
| | | dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | 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.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 穿梭车入库顶升 |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车入库移动至提升机待机位 |
| | | 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.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | // 穿梭车载货走行至目标库位 |
| | | 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 |
| | | )); |
| | | |
| | | // 穿梭车入库托盘下降 |
| | |
| | | |
| | | /** |
| | | * 二、入库目标层没有穿梭车 |
| | | * 1.提升机升降到穿梭车层 |
| | | * 2.穿梭车走行至提升机待机位 |
| | | * 3.提升机搬运穿梭车至目标层 |
| | | * 4.货物从输送线到提升机 |
| | | * 5.提升机载车与货移动(非必需) |
| | | * 6.穿梭车入库至目标库位 |
| | | */ |
| | | } else { |
| | | |
| | | // 提升机载货移动 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31004);//入库站点 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); |
| | | dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | |
| | | 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.liftMoveGoods( |
| | | // 提升机搬车 至 目标位置层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | dto.setLev(Utils.getLev(destLoc)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车入库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 更新小车坐标 |
| | | motionList.addAll(kernelService.shuttleUpdateLocation( |
| | | null |
| | |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车入库移动至提升机待机位 |
| | | // 穿梭车移动至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | 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.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车载货走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | |
| | | // 穿梭车入库托盘下降 |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite()); |
| | | if (basConveyorStaOrigin == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测提升机是否有任务绑定 |
| | | boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | if (liftResult) { |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机后小车待机位 |
| | | String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc(); |
| | | //穿梭车出提升机后全部待机位 |
| | | String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//获取全部待机位 |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = shuttleStandbyFrom.getLockPath$(); |
| | | |
| | | //获取出库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | //分析出库路径待机库位 |
| | | String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, standbyLocNoTo, shuttleDevice); |
| | | if (lastPathStartLoc == null) { |
| | | return motionList;//未分析成功 |
| | | } |
| | | |
| | | /** |
| | | * 出库 |
| | | * 一、出库起始层有穿梭车 |
| | | * 1.穿梭车走行至出库库位 |
| | | * 2.提升机到出库起始层 |
| | | * 3.穿梭车出库至提升机 |
| | | * 4.穿梭车离开提升机 |
| | | * 5.提升机载货移动(非必需) |
| | | * 6.输送线运输至出库口 |
| | | */ |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(originLoc)) { |
| | | |
| | |
| | | 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.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | } |
| | | |
| | | // 穿梭车载货至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | 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 |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | 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.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | // 穿梭车离开提升机 - 到提升机待机位 |
| | | // 穿梭车提升机待机位 - 到待机位(自动选择合适待机位) |
| | | 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.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocs); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseShuttle(1);//执行完成后释放小车 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_STANDBY |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getOriginLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//起始站点 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | dto.setSync(0);//异步执行 |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31001);//出库站点 |
| | | 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 |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | | motionList.addAll(kernelService.conveyorOutbound( |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getDeviceStn()); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getStnNo()); |
| | | })), |
| | | MotionCtgType.CONVEYOR_OUTBOUND |
| | | )); |
| | | // motionList.addAll(kernelService.conveyorOutbound( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | // dto.setStaNo(basConveyorPath.getDeviceStn()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | // dto.setStaNo(basConveyorPath.getStnNo()); |
| | | // })), |
| | | // MotionCtgType.CONVEYOR_OUTBOUND |
| | | // )); |
| | | |
| | | /** |
| | | * 二、出库起始层没有穿梭车 |
| | | * |
| | | * 1.提升机到穿梭车层 |
| | | * 2.穿梭车走行至提升机 |
| | | * 3.提升机载车至出库起始层 |
| | | * 4.穿梭车走行至出库库位 |
| | | * 5.穿梭车出库至提升机 |
| | | * 6.穿梭车离开提升机 |
| | | * 7.提升机载货移动(非必需) |
| | | * 8.输送线运输至出库口 |
| | | * |
| | | */ |
| | | } else { |
| | | |
| | |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定换层路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | |
| | | 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)); |
| | | })) |
| | | )); |
| | | |
| | |
| | | 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.setLocNo(lastPathStartLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_TRANSPORT |
| | | )); |
| | | } |
| | | |
| | | // 穿梭车载货至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | 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 |
| | | )); |
| | | |
| | | // 提升机空载移动到目标层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(originLoc)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | 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(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | // 穿梭车离开提升机 - 到提升机待机位 |
| | | // 穿梭车提升机待机位 - 到待机位(自动选择合适待机位) |
| | | 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.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocs); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseShuttle(1);//执行完成后释放小车 |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_STANDBY |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getOriginLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//起始站点 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | dto.setSync(0);//异步执行 |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31001);//出库站点 |
| | | 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 |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | | motionList.addAll(kernelService.conveyorOutbound( |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getDeviceStn()); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getStnNo()); |
| | | })), |
| | | MotionCtgType.CONVEYOR_OUTBOUND |
| | | )); |
| | | // motionList.addAll(kernelService.conveyorOutbound( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | // dto.setStaNo(basConveyorPath.getDeviceStn()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | // dto.setStaNo(basConveyorPath.getStnNo()); |
| | | // })), |
| | | // MotionCtgType.CONVEYOR_OUTBOUND |
| | | // )); |
| | | |
| | | } |
| | | |
| | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //检测提升机是否有任务绑定 |
| | | boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | if (liftResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | task.setLiftNo(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | taskService.updateById(task); |
| | | } |
| | | |
| | | // 穿梭车开始充电 |
| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | //换层需要锁定的路径 |
| | | List<String> lockPath = liftDispatcher.getLockPathByLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定换层路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(JSON.toJSONString(lockPath)); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 向提升机发送小车已到位信号 |
| | | motionList.addAll(kernelService.liftShuttleArrival( |
| | | 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)); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至目标位置 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | |
| | | |
| | | String sourceLoc = task.getOriginLoc();//源库位 |
| | | String targetLoc = task.getDestLoc();//任务目标(借用字段) |
| | | String targetSite = task.getDestSite();//任务类型(借用字段) |
| | | String targetSite = task.getMemo();//任务类型(借用字段) |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | |
| | | 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 |
| | | )); |
| | | |
| | | //托盘下降 |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | if (task.getDestSite().equals("move")) { |
| | | String destSite = task.getMemo();//任务目标(借用字段) |
| | | if (destSite.equals("move")) { |
| | | //提升机升降楼层 |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | |
| | | })) |
| | | )); |
| | | |
| | | } else if (task.getDestSite().equals("movePallet")) { |
| | | } else if (destSite.equals("movePallet")) { |
| | | //移动托盘 |
| | | BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite()); |
| | | BasConveyorSta basConveyorStaDest = basConveyorStaService.selectBySiteNo(task.getDestSite()); |
| | | if(basConveyorStaOrigin == null || basConveyorStaDest == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | // 提升机移动托盘 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getOriginLoc())); |
| | | dto.setLev(Utils.getLev(basConveyorStaOrigin.getLocNo())); |
| | | dto.setStaNo(Integer.parseInt(task.getOriginSite())); |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getDestLoc())); |
| | | dto.setLev(Utils.getLev(basConveyorStaDest.getLocNo())); |
| | | dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); |
| | | dto.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | })) |
| | | )); |
| | | |
| | | } else if (destSite.equals("lock")) { |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | })) |
| | | )); |
| | | } else if (destSite.equals("unlock")) { |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | })) |
| | | )); |
| | | } |
| | | |
| | | return motionList; |