From 035c1e94569a2c043f232f3452d25ad2e51bcf23 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 17 四月 2025 08:22:02 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 106 insertions(+), 5 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 126fd3d..0ed9518 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
@@ -1,8 +1,6 @@
 package com.zy.asrs.wcs.core.kernel;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zy.asrs.framework.common.Cools;
-import com.zy.asrs.framework.common.R;
 import com.zy.asrs.wcs.core.domain.dto.MotionDto;
 import com.zy.asrs.wcs.core.entity.*;
 import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
@@ -480,7 +478,9 @@
             String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc();
 
             //绌挎杞﹀嚭鎻愬崌鏈哄悗灏忚溅寰呮満浣�
-            String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc();
+            List<String> standbyLocs = shuttleStandbyFrom.getStandbyLoc$();//鑾峰彇鍏ㄩ儴寰呮満浣�
+            //鑾峰彇鍙敤寰呮満浣�
+            String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs);
 
             //鑾峰彇鍑哄簱浠诲姟绫诲瀷
             TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
@@ -680,6 +680,15 @@
                             dto.setLocNo(standbyLocNoTo);
                         })),
                         MotionCtgType.SHUTTLE_MOVE
+                ));
+
+                // 閿佸畾鐩爣妤煎眰绌挎杞﹀緟鏈轰綅璺緞
+                motionList.addAll(kernelService.mapLockPath(
+                        null,
+                        MotionDto.build((dto -> {
+                            dto.setShuttleNo(shuttleDevice.getId().intValue());
+                            dto.setLocNo(standbyLocNoFrom);
+                        }))
                 ));
 
                 // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
@@ -1133,8 +1142,6 @@
                     MotionCtgType.SHUTTLE_MOVE
             ));
 
-            task.setLiftNo(Integer.parseInt(transferLiftDevice.getDeviceNo()));
-            taskService.updateById(task);
         }
 
         // 绌挎杞﹀紑濮嬪厖鐢�
@@ -1295,6 +1302,15 @@
                     MotionCtgType.SHUTTLE_MOVE
             ));
 
+            // 閿佸畾鐩爣妤煎眰绌挎杞﹀緟鏈轰綅璺緞
+            motionList.addAll(kernelService.mapLockPath(
+                    null,
+                    MotionDto.build((dto -> {
+                        dto.setShuttleNo(shuttleDevice.getId().intValue());
+                        dto.setLocNo(standbyLocNoFrom);
+                    }))
+            ));
+
             // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
             motionList.addAll(kernelService.liftMove(
                     null
@@ -1410,6 +1426,91 @@
         }
         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