From 48278d6051b6e58d648178964585d35ae000ec91 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 30 八月 2024 15:36:56 +0800
Subject: [PATCH] #

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java |   45 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java
index 1312609..210b416 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java
@@ -6,6 +6,8 @@
 import com.zy.asrs.wms.asrs.entity.*;
 import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
 import com.zy.asrs.wms.asrs.entity.enums.LocTypeHeightType;
+import com.zy.asrs.wms.asrs.entity.enums.ShelvesRuleType;
+import com.zy.asrs.wms.asrs.entity.param.FieldParam;
 import com.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper;
 import com.zy.asrs.wms.asrs.mapper.ViewTaskDetlMapper;
 import com.zy.asrs.wms.asrs.service.*;
@@ -35,22 +37,29 @@
     private ViewLocDetlMapper viewLocDetlMapper;
     @Autowired
     private ViewTaskDetlMapper viewTaskDetlMapper;
+    @Autowired
+    private MatService matService;
 
     //浠庡簱瀛樻垨浠诲姟涓尮閰嶇浉閭诲簱浣�(婊℃墭鐩�)
-    public Loc getNeighborLoc(Long taskType, OrderDetl orderDetl, Integer locTypeHeight) {
+    public Loc getNeighborLoc(Long taskType, Long matId, String batch, List<FieldParam> uniqueFields, Integer locTypeHeight) {
         //婊℃墭鐩�
+        Mat mat = matService.getById(matId);
+        if (mat == null) {
+            return null;
+        }
+
         //浠庝换鍔′腑杩涜鍖归厤
         List<Loc> locs = new ArrayList<>();
-        List<Map<String, Object>> list = viewTaskDetlMapper.getList(orderDetl.getMat$().getMatnr(), orderDetl.getBatch(), orderDetl.getUniqueField());
+        List<Map<String, Object>> list = viewTaskDetlMapper.getList(mat.getMatnr(), batch, uniqueFields);
         for (Map<String, Object> map : list) {
             Task task = taskService.getById(map.get("taskId").toString());
-            if(task == null) {
+            if (task == null) {
                 continue;
             }
 
             String targetLoc = task.getTargetLoc();
             Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, targetLoc));
-            if(one == null) {
+            if (one == null) {
                 continue;
             }
             locs.add(one);
@@ -63,10 +72,10 @@
 
         //浠庡簱瀛樹腑杩涜鍖归厤
         List<Loc> locs2 = new ArrayList<>();
-        List<Map<String, Object>> list2 = viewLocDetlMapper.getList(orderDetl.getMat$().getMatnr(), orderDetl.getBatch(), orderDetl.getUniqueField());
+        List<Map<String, Object>> list2 = viewLocDetlMapper.getList(mat.getMatnr(), batch, uniqueFields);
         for (Map<String, Object> map : list2) {
             Loc one = locService.getById(map.get("locId").toString());
-            if(one == null) {
+            if (one == null) {
                 continue;
             }
             locs2.add(one);
@@ -80,7 +89,7 @@
     }
 
     //鑾峰彇鎺ㄨ崘搴撲綅(婊℃墭鐩�)
-    public List<Loc> getSuggestLoc(Long taskType, Long matId, String batch, Integer locTypeHeight, List<Integer> laneRowList) {
+    public List<Loc> getSuggestLoc(Long taskType, Long matId, String batch, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) {
         //婊℃墭鐩�
         List<Loc> locs = new ArrayList<>();
         LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locTypeHeight);
@@ -114,6 +123,10 @@
                 queryWrapper.in(Loc::getRow1, laneRowList);
             }
 
+            if (currentLev != null) {
+                queryWrapper.eq(Loc::getLev1, currentLev);
+            }
+
             List<Loc> list = locService.list(queryWrapper);
             if (!list.isEmpty()) {
                 locs.addAll(list);
@@ -123,7 +136,7 @@
     }
 
     //鑾峰彇鍏ㄥ眬搴撲綅(瀹屾暣宸烽亾)
-    public List<Loc> getGlobalLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList) {
+    public List<Loc> getGlobalLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) {
         List<Loc> locs = new ArrayList<>();
         LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locTypeHeight);
         if (locTypeHeightType == null) {
@@ -140,6 +153,10 @@
 
         if (laneRowList != null && !laneRowList.isEmpty()) {
             queryWrapper.in(Loc::getRow1, laneRowList);
+        }
+
+        if (currentLev != null) {
+            queryWrapper.eq(Loc::getLev1, currentLev);
         }
 
         List<Loc> list = locService.list(queryWrapper);
@@ -280,7 +297,7 @@
     }
 
     //鑾峰彇鎺ㄨ崘搴撲綅(绌烘墭鐩�)
-    public List<Loc> getSuggestEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList) {
+    public List<Loc> getSuggestEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) {
         List<Loc> locs = new ArrayList<>();
         //绌烘墭鐩�
         List<SuggestLocRule> suggestLocRules = suggestLocRuleService.list(new LambdaQueryWrapper<SuggestLocRule>().eq(SuggestLocRule::getLocType, 0));
@@ -298,6 +315,10 @@
                 queryWrapper.in(Loc::getRow1, laneRowList);
             }
 
+            if (currentLev != null) {
+                queryWrapper.eq(Loc::getLev1, currentLev);
+            }
+
             List<Loc> list = locService.list(queryWrapper);
             if (!list.isEmpty()) {
                 locs.addAll(list);
@@ -307,7 +328,7 @@
     }
 
     //鑾峰彇鍏ㄥ眬搴撲綅(瀹屾暣宸烽亾)
-    public List<Loc> getGlobalEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList) {
+    public List<Loc> getGlobalEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) {
         List<Loc> locs = new ArrayList<>();
         LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locTypeHeight);
         if (locTypeHeightType == null) {
@@ -326,6 +347,10 @@
             queryWrapper.in(Loc::getRow1, laneRowList);
         }
 
+        if (currentLev != null) {
+            queryWrapper.eq(Loc::getLev1, currentLev);
+        }
+
         List<Loc> list = locService.list(queryWrapper);
         if (!list.isEmpty()) {
             locs.addAll(list);

--
Gitblit v1.9.1