From be14e23722db5053f2ac9048629d72abd05dea08 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 24 三月 2025 13:38:57 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index f8f4146..78b8010 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -19,6 +19,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -123,7 +124,7 @@
         }
 
         //鎼滅储鏁翠釜绌哄簱浣嶇粍
-        locMast = getLocNoStepSingle(locTypeDto,sourceStaNo);
+        locMast = getLocNoStepSingle(locTypeDto, sourceStaNo);
         if (locMast != null) {
             //鎵惧埌搴撲綅锛岃繑鍥瀌to
             return getLocNoStep6(staDescId, sourceStaNo, locMast);//杩斿洖dto
@@ -139,38 +140,54 @@
         LocMast locMast = null;
 
         List<StaDesc> staDescs = staDescService.selectList(new EntityWrapper<StaDesc>().eq("type_no", 1).eq("stn_no", sourceStaNo));
-
+        int num = 0;
+        int crn_no = 1;
         for (StaDesc staDesc : staDescs) {
-            //鍗曞搧
             List<LocMast> locMasts = locMastService.selectAreaEmpty(locTypeDto.getLocType1(), staDesc.getCrnNo());//鎼滅储璐х墿
+            int temp = locMast == null ? 0 : locMasts.size();
+            if (num <= temp) {
+                num = temp;
+                crn_no = staDesc.getCrnNo();
+            }
+        }
+        //for (StaDesc staDesc : staDescs) {
+        //鍗曞搧
+        List<LocMast> locMasts = locMastService.selectAreaEmpty(locTypeDto.getLocType1(), crn_no);//鎼滅储璐х墿
 
-            for (LocMast mast : locMasts) {
-                LocMast tmp = null;
-                boolean groupLoc = Utils.isShallowLoc(slaveProperties, mast.getLocNo());
-                if (groupLoc) {
-                    String shallowLoc = Utils.getDeepLoc(slaveProperties, mast.getLocNo());
-                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
-                            .eq("loc_no", shallowLoc));
-                    if (!Cools.isEmpty(locMast2)) {
-                        if (locMast2.getLocSts().equals("F") || locMast2.getLocSts().equals("D")) {
-                            tmp = mast;
-                            if (!Cools.isEmpty(mast)) {
-                                if (mast.getLocSts().equals("O")) {
-                                    tmp = mast;
-                                }
+        for (LocMast mast : locMasts) {
+            LocMast tmp = null;
+            boolean groupLoc = Utils.isShallowLoc(slaveProperties, mast.getLocNo());
+            if (groupLoc) {
+                String shallowLoc = Utils.getDeepLoc(slaveProperties, mast.getLocNo());
+                LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                        .eq("loc_no", shallowLoc));
+                if (!Cools.isEmpty(locMast2)) {
+                    if (locMast2.getLocSts().equals("F") || locMast2.getLocSts().equals("D")) {
+                        tmp = mast;
+                        if (!Cools.isEmpty(mast)) {
+                            if (mast.getLocSts().equals("O")) {
+                                tmp = mast;
                             }
                         }
-                        //棰勭暀绌哄簱浣�
-                        if (tmp != null && locMastService.checkEmptyCount(mast, 10)) {
-                            locMast = tmp;
-                            break;
-                        }
                     }
-
+                    //棰勭暀绌哄簱浣�
+                    if (tmp != null && locMastService.checkEmptyCount(mast, 10)) {
+                        locMast = tmp;
+                        return locMast;
+                    }
                 }
 
-                return locMast;
+            } else {
+                tmp = mast;
+                //棰勭暀绌哄簱浣�
+                if (tmp != null && locMastService.checkEmptyCount(mast, 10)) {
+                    locMast = tmp;
+                    return locMast;
+                }
             }
+
+
+            // }
         }
         return locMast;
     }

--
Gitblit v1.9.1