| | |
| | | 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.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.domain.dto.MotionDto; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.core.model.enums.NavigationMapType; |
| | | import com.zy.asrs.wcs.core.service.MotionService; |
| | | import com.zy.asrs.wcs.core.utils.LiftDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.NavigateUtils; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | private MotionService motionService; |
| | | @Autowired |
| | | private LiftDispatcher liftDispatcher; |
| | | @Autowired |
| | | private NavigateUtils navigateUtils; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | // agv ----------------------------------------------------------------------------- |
| | | @Deprecated |
| | |
| | | motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); |
| | | motion.setTarDrt(target.getStaNo());//目标站 |
| | | |
| | | if (target.getDevpNo() != null) { |
| | | motion.setDockNo(String.valueOf(target.getDevpNo()));//输送线ID |
| | | } |
| | | |
| | | if (target.getSync() != null) { |
| | | motion.setSync(target.getSync()); |
| | | } |
| | |
| | | if (null != origin) { |
| | | motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); |
| | | } |
| | | |
| | | if (target.getTaskNo() != null) { |
| | | motion.setTaskNo(target.getTaskNo()); |
| | | } |
| | | |
| | | motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); |
| | | })); |
| | | |
| | |
| | | motion.setTemp(String.valueOf(origin.getLiftNo()));//保存提升机号 |
| | | motion.setDockNo(String.valueOf(target.getStaNo())); |
| | | break; |
| | | case SHUTTLE_TRANSPORT_TO_CONVEYOR://穿梭车载货进输送线 |
| | | motion.setDockNo(String.valueOf(target.getStaNo())); |
| | | break; |
| | | case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 |
| | | motion.setTarget(null);//等待自动搜索 |
| | | motion.setTemp(target.getLocNo());//全部待机位 |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | if (target.getSync() != null) { |
| | | motion.setSync(target.getSync()); |
| | | } |
| | | |
| | | if (target.getReleaseShuttle() != null) { |
| | | motion.setReleaseShuttle(target.getReleaseShuttle()); |
| | | } |
| | | |
| | | if (target.getReleaseLift() != null) { |
| | | motion.setReleaseLift(target.getReleaseLift()); |
| | | } |
| | | |
| | | if (motion.getOrigin() != null && motion.getTarget() != null) { |
| | | List<NavigateNode> nodeList = navigateUtils.calc(motion.getOrigin(), motion.getTarget(), NavigationMapType.NONE_LOCK.id, Utils.getShuttlePoints(Integer.parseInt(target.getShuttleDevice().getDeviceNo()), Utils.getLev(motion.getTarget()))); |
| | | if (nodeList == null) { |
| | | throw new CoolException(motion.getOrigin() + " dash " + motion.getTarget() + " can't find navigate path!"); |
| | | } |
| | | motion.setMovePath(JSON.toJSONString(nodeList)); |
| | | } |
| | | |
| | | })); |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | // Map ----------------------------------------------------------------------------- |
| | | |
| | | /** |
| | | * 地图路径锁定 |
| | | */ |
| | | public List<Motion> mapLockPath(MotionDto origin, MotionDto target) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.MAP.val()); |
| | | motion.setDevice(String.valueOf(target.getShuttleNo())); |
| | | motion.setMotionCtg(MotionCtgType.MAP_LOCK_PATH.val()); |
| | | |
| | | motion.setTarget(target.getLocNo()); |
| | | })); |
| | | |
| | | return motionList; |
| | | } |
| | | |
| | | /** |
| | | * 地图路径解锁 |
| | | */ |
| | | public List<Motion> mapUnlockPath(MotionDto origin, MotionDto target) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.MAP.val()); |
| | | motion.setDevice(String.valueOf(target.getShuttleNo())); |
| | | motion.setMotionCtg(MotionCtgType.MAP_UNLOCK_PATH.val()); |
| | | |
| | | motion.setTarget(target.getLocNo()); |
| | | })); |
| | | |
| | | return motionList; |
| | | } |
| | | |
| | | } |