| | |
| | | package com.zy.asrs.wcs.core.kernel; |
| | | |
| | | 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 org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 1.充电任务,2.库位移转,3.小车迁移,4.手动任务 |
| | |
| | | @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<>(); |
| | |
| | | |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | BasConveyorSta basConveyorStaDest = basConveyorStaService.selectBySiteNo(task.getDestSite()); |
| | | if (basConveyorStaDest == null) { |
| | | return motionList; |
| | | } |
| | | |
| | |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); |
| | | dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); |
| | | // dto.setSync();//异步执行 |
| | | })) |
| | | )); |
| | | |
| | |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); |
| | | dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite()); |
| | | if (basConveyorStaOrigin == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getOriginLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getOriginSite()));//起始站点 |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//起始站点 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31004);//出库站点 |
| | | dto.setStaNo(31001);//出库站点 |
| | | dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | | 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 |
| | | // )); |
| | | |
| | | /** |
| | | * 二、出库起始层没有穿梭车 |
| | |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getOriginLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getOriginSite()));//起始站点 |
| | | dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//起始站点 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(1);//光泰1层是输送线层 |
| | | dto.setStaNo(31004);//出库站点 |
| | | dto.setStaNo(31001);//出库站点 |
| | | dto.setSync(0);//异步执行 |
| | | dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | | 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 |
| | | // )); |
| | | |
| | | } |
| | | |
| | |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定目标楼层穿梭车待机位路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | |
| | | |
| | | } 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(0); |
| | | dto.setLev(Utils.getLev(basConveyorStaOrigin.getLocNo())); |
| | | dto.setStaNo(Integer.parseInt(task.getOriginSite())); |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(0); |
| | | dto.setLev(Utils.getLev(basConveyorStaDest.getLocNo())); |
| | | dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); |
| | | dto.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | })) |
| | | )); |