From 54b4f53323d0833cbac86fd18932c5fa5a5447a8 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 17 二月 2025 14:19:17 +0800
Subject: [PATCH] #移库任务

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java |   85 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
index e645221..a04b0ba 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -1605,4 +1605,89 @@
         return motionList;
     }
 
+    /**
+     * 鐢熸垚灏忚溅杞借揣杩佺Щ鍔ㄤ綔
+     */
+    public List<Motion> generateShuttleLadenMoveMotion(Task task) {
+        List<Motion> motionList = new ArrayList<>();
+        if (task.getTaskSts() != TaskStsType.NEW_LADEN_MOVE.sts) {
+            return motionList;
+        }
+        //originLoc 婧愬簱浣�
+        String originLoc =  task.getOriginLoc();
+        // locNo 鐩爣搴撲綅
+        String locNo = task.getDestLoc();
+
+        Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>()
+                .eq(Device::getDeviceNo, task.getShuttleNo())
+                .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
+                .eq(Device::getHostId, task.getHostId())
+                .eq(Device::getStatus, 1));
+        if (shuttleDevice == null) {
+            return motionList;
+        }
+
+        ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue());
+        if (shuttleThread == null) {
+            return motionList;
+        }
+
+        ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+        if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+            return motionList;
+        }
+
+        String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+
+        // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞�
+        if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) {
+
+            if (!shuttleLocNo.equals(locNo)) {//灏忚溅涓嶅湪鐩爣搴撲綅
+                // 绌挎杞﹁蛋琛岃嚦婧愬簱浣�
+                motionList.addAll(kernelService.shuttleMove(
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setLocNo(shuttleLocNo);
+                        })),
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setLocNo(originLoc);
+                        })),
+                        MotionCtgType.SHUTTLE_MOVE
+                ));
+
+                // 绌挎杞﹂《鍗�
+                motionList.add(Motion.build(motion -> {
+                    motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
+                    motion.setDevice(String.valueOf(shuttleDevice.getId()));
+                    motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val());
+                }));
+
+                // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
+                motionList.addAll(kernelService.shuttleMove(
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setLocNo(originLoc);
+                        })),
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setLocNo(locNo);
+                        })),
+                        MotionCtgType.SHUTTLE_MOVE
+                ));
+
+                //绌挎杞︽墭鐩樹笅闄�
+                motionList.add(Motion.build(motion -> {
+                    motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
+                    motion.setDevice(String.valueOf(shuttleDevice.getId()));
+                    motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val());
+                }));
+
+            }
+
+        } else {
+            //灏忚溅璺ㄥ眰
+        }
+        return motionList;
+    }
 }

--
Gitblit v1.9.1