From 20a1449f65a9d577c2c9c0af62f3c4af3dd8d172 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期一, 04 十二月 2023 15:02:10 +0800
Subject: [PATCH] 库位规则、库位编码规则bug修改

---
 src/main/java/com/zy/asrs/controller/LocRuleController.java |    2 
 src/main/java/com/zy/common/web/param/SearchLocParam.java   |    2 
 src/main/java/com/zy/asrs/utils/Utils.java                  |    2 
 src/main/java/com/zy/common/service/CommonService.java      |   86 ++++++++++++++++++++++++++++++------------
 src/main/resources/application.yml                          |   20 +++++-----
 5 files changed, 74 insertions(+), 38 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocRuleController.java b/src/main/java/com/zy/asrs/controller/LocRuleController.java
index 234fed0..4d75e61 100644
--- a/src/main/java/com/zy/asrs/controller/LocRuleController.java
+++ b/src/main/java/com/zy/asrs/controller/LocRuleController.java
@@ -121,7 +121,7 @@
         locRule.setUpdateTime(new Date());
         locRuleService.updateById(locRule);
         Integer locType2 = 1;//鍗曞搧鍖哄煙
-        if (locRule.getMixed() == 0) {
+        if (Cools.isEmpty(locRule.getMixed()) || locRule.getMixed() == 0) {
             locRuleService.updateKeepGoByMatnr(locRule.getMatnr(), locRule.getKeepGo());
         }else {//娣疯浇
             locRuleService.updateKeepGoByMixed(locRule.getKeepGo());
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 2050e35..e03dc0e 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -256,7 +256,7 @@
     }
 
     public static void main(String[] args) {
-        System.out.println(JSON.toJSONString(getGroupDeepLoc("1505908")));
+        System.out.println(JSON.toJSONString(getGroupInnerLoc("1505908")));
     }
 
     /**
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index e322c8c..1388298 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -202,18 +202,8 @@
                 }
 
                 List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
-                for (LocMast locMast0 : locMasts) {
-                    List<String> locNos = locDetlService.getSameDetl(locMast0.getLocNo());
-                    for (String locNo : locNos) {
-                        LocMast locMast1 = locMastService.findInnerLoc(locNo);
-                        if (null != locMast1) {
-                            //棰勭暀绌哄簱浣�
-                            if (locMastService.checkEmptyCount(locMast1, 10)) {
-                                return locMast1;
-                            }
-                        }
-                    }
-                }
+                locMast = locFilter(locMasts, matNos,locTypeDto);
+
             }
 
             if (locRules.get(0).getKeepGo() == 0) {
@@ -253,20 +243,8 @@
             if (locRule == null) {
                 continue;
             }
-
             List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
-            for (LocMast locMast0 : locMasts) {
-                List<String> locNos = locDetlService.getSameDetl(locMast0.getLocNo());
-                for (String locNo : locNos) {
-                    LocMast locMast1 = locMastService.findInnerLoc(locNo);
-                    if (null != locMast1) {
-                        //棰勭暀绌哄簱浣�
-                        if (locMastService.checkEmptyCount(locMast1, 10)) {
-                            return locMast1;
-                        }
-                    }
-                }
-            }
+            locMast = locFilter(locMasts, matNos,locTypeDto);
         }
 
 //            if (locRules.get(0).getKeepGo() == 0) {
@@ -427,6 +405,64 @@
         return locMast;
     }
 
+    /*
+    搴撳瓨瑙勫垯鎼滅储鍒扮殑搴撲綅纭
+     */
+    private LocMast locFilter(List<LocMast> locMasts,List<String> matNos,LocTypeDto locTypeDto){
+        for (LocMast locMast0 : locMasts) {
+            if(!VersionUtils.checkLocType(locMast0,locTypeDto)){
+                continue;
+            }
+            if (matNos.size() == 1) {
+                //鍗曞搧鐗╂枡
+                if(Cools.isEmpty(Utils.getGroupDeepLoc(locMast0.getLocNo()))){
+                    return locMast0;
+                }else{
+                    List<String> groupInnerLoc = Utils.getGroupInnerLoc(locMast0.getLocNo());
+                    if (Cools.isEmpty(groupInnerLoc)) {
+                        return locMast0;
+                    }else {
+                        //鑾峰彇鏈�娣辩殑搴撲綅
+                        String loc = groupInnerLoc.get(groupInnerLoc.size() - 1);
+                        LocMast locMast1 = locMastService.selectByLoc(loc);
+                        if("O".equals(locMast1.getLocSts())){
+                            return locMast1;
+                        }else {
+                            if(!"F".equals(locMast1.getLocSts())){
+                                continue;
+                            }
+                            List<LocDetl> locDetls = locDetlService.selectByLocNo(loc);
+                            if(!Cools.eq(locDetls.get(0).getMatnr(),matNos.get(0))){
+                                continue;
+                            }
+                            for (int i=groupInnerLoc.size()-1; i>=0 ;i--){
+                                LocMast locMast2 = locMastService.selectByLoc(groupInnerLoc.get(i));
+                                if("O".equals(locMast2.getLocSts())){
+                                    return locMast2;
+                                }else if("F".equals(locMast2.getLocSts())){
+                                    if(i==0){
+                                        return locMast1;
+                                    }else {
+                                        continue;
+                                    }
+                                }else {
+                                    break;
+                                }
+                            }
+                        }
+
+                    }
+                }
+            }else {
+                if(Cools.isEmpty(Utils.getGroupDeepLoc(locMast0.getLocNo()))){
+                    return locMast0;
+                }
+            }
+
+        }
+        return null;
+    }
+
     //杩斿洖dto
     private StartupDto getLocNoStep6(Integer staDescId, Integer sourceStaNo, LocMast locMast) {
         StartupDto startupDto = new StartupDto();
diff --git a/src/main/java/com/zy/common/web/param/SearchLocParam.java b/src/main/java/com/zy/common/web/param/SearchLocParam.java
index df746f0..c3db41c 100644
--- a/src/main/java/com/zy/common/web/param/SearchLocParam.java
+++ b/src/main/java/com/zy/common/web/param/SearchLocParam.java
@@ -16,7 +16,7 @@
 
     private String barcode;
 
-    // 搴撲綅瑙勬牸锛� 0:鏈煡, 1:浣庡簱浣�, 2:楂樺簱浣嶏級
+    // 搴撲綅瑙勬牸锛� 1浣庯紝2涓紝3楂橈級
     private Short locType1;
 
 }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index c0ffce8..74c7ea8 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -73,16 +73,16 @@
     password: Wlzh44338
 
 agv:
-  url: localhost:8080
-  taskCreatePath: /agv/task/create
-  containerMoveInPath: /agv/container/moveIn
-  containerMoveOutPath: /agv/container/moveOut
-  containerArrivedPath: /agv/containerArrived
-#  url: 10.10.10.182:9046
-#  taskCreatePath: /task/create
-#  containerMoveInPath: /expand/api/moveIn/container
-#  containerMoveOutPath: /expand/api/moveOut/container
-#  containerArrivedPath: /conveyor/containerArrived
+#  url: localhost:8080
+#  taskCreatePath: /agv/task/create
+#  containerMoveInPath: /agv/container/moveIn
+#  containerMoveOutPath: /agv/container/moveOut
+#  containerArrivedPath: /agv/containerArrived
+  url: 10.10.10.182:9046
+  taskCreatePath: /task/create
+  containerMoveInPath: /expand/api/moveIn/container
+  containerMoveOutPath: /expand/api/moveOut/container
+  containerArrivedPath: /conveyor/containerArrived
 
 u8:
   url: http://192.168.1.55:8010

--
Gitblit v1.9.1