From d56b8093dc9e3e75f8efe1a0f1aa6d821c9c3dfb Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 15 四月 2025 13:30:35 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 101 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 db4c697..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,22 @@
             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
+            }
 
             if (target.getSync() != null) {
                 motion.setSync(target.getSync());
@@ -114,6 +137,11 @@
             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())));
         }));
 
@@ -289,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));
             }
 
         }));
@@ -431,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