From ac09ee9c9f39cb9d452b57504e5c79321e0371eb Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期四, 03 四月 2025 15:34:34 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java | 97 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 88 insertions(+), 9 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java index f5e1c54..ef67e16 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java @@ -1,11 +1,21 @@ 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; @@ -22,6 +32,10 @@ private MotionService motionService; @Autowired private LiftDispatcher liftDispatcher; + @Autowired + private NavigateUtils navigateUtils; + @Autowired + private DeviceService deviceService; // agv ----------------------------------------------------------------------------- @Deprecated @@ -51,11 +65,11 @@ motion.setMotionCtg(MotionCtgType.LIFT_MOVE.val()); - if (null != origin) { - motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); - } - motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); - +// if (null != origin) { +// motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); +// } +// motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); + motion.setTarget(target.getLev().toString()); if (target.getSync() != null) { motion.setSync(target.getSync()); } @@ -81,11 +95,13 @@ motion.setMotionCtg(MotionCtgType.LIFT_WITH_GOODS.val()); if (null != origin) { - motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); - motion.setOriDrt(origin.getStaNo());//婧愮珯 +// motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); +// motion.setOriDrt(origin.getStaNo());//婧愮珯 + motion.setOrigin(String.valueOf(origin.getStaNo())); } - motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); - motion.setTarDrt(target.getStaNo());//鐩爣绔� +// motion.setTarget(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), target.getLev()))); +// motion.setTarDrt(target.getStaNo());//鐩爣绔� + motion.setTarget(String.valueOf(target.getStaNo())); if (target.getDevpNo() != null) { motion.setDockNo(String.valueOf(target.getDevpNo()));//杈撻�佺嚎ID @@ -298,8 +314,35 @@ 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)); } })); @@ -440,4 +483,40 @@ 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; + } + + /** + * 鍦板浘璺緞瑙i攣 + */ + 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; + } + } -- Gitblit v1.9.1