From 50435a81915932eda06b7f1afd48f9ff1ae84f19 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期四, 10 四月 2025 17:50:28 +0800
Subject: [PATCH] 1
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java | 102 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 92 insertions(+), 10 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..678014a 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());
}
@@ -71,7 +85,7 @@
/**
* 鎻愬崌鏈鸿浇璐хЩ鍔�
*/
- public List<Motion> liftMoveGoods(MotionDto origin, MotionDto target) {
+ public List<Motion> liftMoveGoods(MotionDto origin, MotionDto target, MotionCtgType type) {
List<Motion> motionList = new ArrayList<>();
motionList.add(Motion.build(motion -> {
@@ -79,13 +93,18 @@
motion.setDevice(String.valueOf(target.getLiftNo()));
motion.setMotionCtg(MotionCtgType.LIFT_WITH_GOODS.val());
+ if (type != null) {
+ motion.setMotionCtg(type.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 +317,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 +486,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