From d7b8a1165db6ba6beafde9cb98b7a08afa57ed70 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期一, 11 十一月 2024 15:48:56 +0800
Subject: [PATCH] 自动移库功能更新

---
 src/main/java/com/zy/common/service/CommonService.java |   53 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index d60e71b..00ae205 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -475,7 +475,7 @@
                     if (Cools.isEmpty(locMast1)) {
                         continue;
                     }
-                    if (locMast1.getLev1() != lev && locMast1.getLev1() !=2) {
+                    if (locMast1.getLev1() != lev && locMast1.getLev1() !=3) {
                         List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
                                 .eq("lev1", locMast1.getLev1())
                                 .orderBy("bay1",false));
@@ -484,20 +484,47 @@
                         }
                         for (LocMast locMast2 : locMasts) {
                             if (locMast2.getLocSts().equals("O") ) {
-                                locMast = locMast2;
+                                if (locMast == null){
+                                    locMast = locMast2;
+                                }
                             }else if (locMast2.getLocSts().equals("F")){
                                 locMast = null;
                             }
                         }
                     }
                 }
+                if(Cools.isEmpty(locMast)){
+                    List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                            .eq("lev1", 1)
+                            .orderBy("bay1",false));
+                    for (LocMast locMast2 : locMasts) {
+                        if (locMast2.getLocSts().equals("O") ) {
+                            if (locMast == null){
+                                locMast = locMast2;
+                            }
+                        }else if (locMast2.getLocSts().equals("F")){
+                            locMast = null;
+                        }
+                    }
+                }
+                if(Cools.isEmpty(locMast)){
+                    List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                            .eq("lev1", 2)
+                            .orderBy("bay1",false));
+                    for (LocMast locMast2 : locMasts) {
+                        if (locMast2.getLocSts().equals("O") ) {
+                            if (locMast == null){
+                                locMast = locMast2;
+                            }
+                        }else if (locMast2.getLocSts().equals("F")){
+                            locMast = null;
+                        }
+                    }
+                }
             }else {
-                for (int i = 1; i<=4;i++){
+                for (int i = 1; i<=2;i++){
                     if (locMast != null){
                         break;
-                    }
-                    if (i == 2){
-                        continue;
                     }
                     List<LocMast> locMastsF = locMastService.selectList(new EntityWrapper<LocMast>()
                             .eq("lev1", i)
@@ -526,25 +553,27 @@
                     }
                     for (LocMast locmast3 : locMasts) {
                         if (locmast3.getLocSts().equals("O")){
-                            locMast = locmast3;
+                            if (locMast == null){
+                                locMast = locmast3;
+                            }
                         }else if (locmast3.getLocSts().equals("F")){
                             locMast = null;
                         }
                     }
                 }
-
             }
-
         }else {
             List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-                    .eq("lev1", 2)
-                    .orderBy("bay1",false));
+                    .eq("lev1", 3)
+                    .orderBy("bay1",true));
             if (Cools.isEmpty(locMasts)){
                 throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�===銆嬪簱浣嶆湭鐭�");
             }
             for (LocMast locmast : locMasts) {
                 if (locmast.getLocSts().equals("O") ) {
-                    locMast = locmast;
+                    if (locMast == null){
+                        locMast = locmast;
+                    }
                 }else if (locmast.getLocSts().equals("D")){
                     locMast = null;
                 }

--
Gitblit v1.9.1