From cc4e0bd14edeeb43268216f18c70be62e482b8f0 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期四, 05 二月 2026 14:31:17 +0800
Subject: [PATCH] 初始化未完成

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

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index cf5f7e8..f53be7b 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -172,6 +172,11 @@
 //            }
             int rowCount = params[0];
             int nearRow = params[3];
+            int MIN_SPARE_SLOTS = 0;
+
+            if (rowLastno.getTypeId() == 1){
+                MIN_SPARE_SLOTS = 2;
+            }
 
             // 鍙彇鏁伴噺鍒ゆ柇锛岄伩鍏嶆媺鏁� list
             int availableLocCount = locMastService.selectCount(new EntityWrapper<LocMast>()
@@ -180,7 +185,7 @@
                     .eq("whs_type", rowLastnoType.getType().longValue()));
             int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>()
                     .eq("crn_no", crnNo).le("io_type", 100));
-            if (availableLocCount - crnCountO <= 2) { // 鍙互鎻愭垚甯搁噺锛屾瘮濡� MIN_SPARE_SLOTS = 2
+            if (availableLocCount - crnCountO <= MIN_SPARE_SLOTS) { // 鍙互鎻愭垚甯搁噺锛屾瘮濡� MIN_SPARE_SLOTS = 2
                 log.error("{}鍙峰爢鍨涙満娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", crnNo, JSON.toJSONString(locTypeDto), attempt);
                 attempt++;
                 continue;
@@ -242,15 +247,21 @@
 
         //姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿
         Optional<CrnRowInfo> infoOpt = findAvailableCrnAndNearRow(rowLastno, curRow, crnNumber, times, findLocNoAttributeVo, locTypeDto, rowLastnoType);
-        if (!infoOpt.isPresent()) {
-            throw new CoolException("鏃犲彲鐢ㄥ爢鍨涙満");
+        if (infoOpt.isPresent()) {
+//            throw new CoolException("鏃犲彲鐢ㄥ爢鍨涙満");
+            CrnRowInfo info = infoOpt.get();
+            crnNo = info.getCrnNo();
+            nearRow = info.getNearRow();
+            curRow = info.getCurRow();
+            rowCount = info.getRowCount();
+            times = info.getTimes();
         }
-        CrnRowInfo info = infoOpt.get();
-        crnNo = info.getCrnNo();
-        nearRow = info.getNearRow();
-        curRow = info.getCurRow();
-        rowCount = info.getRowCount();
-        times = info.getTimes();
+//        CrnRowInfo info = infoOpt.get();
+//        crnNo = info.getCrnNo();
+//        nearRow = info.getNearRow();
+//        curRow = info.getCurRow();
+//        rowCount = info.getRowCount();
+//        times = info.getTimes();
 
 
         boolean signRule1 = false;
@@ -440,19 +451,26 @@
             List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
                     .eq("row1", nearRow)
                     .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())
-                    .orderBy("lev1", true).orderBy("bay1", false));
+                    .orderBy("lev1", true).orderBy("bay1", true));
             for (LocMast locMast1 : locMasts) {
                 if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
                     continue;
                 }
                 if (Utils.BooleanWhsTypeStaIoType(rowLastno)) {
-                    String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
-                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
-                            .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()));
-                    if (!Cools.isEmpty(locMast2)) {
-                        locMast = locMast2;
+
+                    if (locMast1.getCrnNo() == 2) {
+                        String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
+                        LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()));
+                        if (!Cools.isEmpty(locMast2)) {
+                            locMast = locMast2;
+                            break;
+                        }
+                    } else if (locMast1.getCrnNo() == 1) {
+                        locMast = locMast1;
                         break;
                     }
+
                 } else {
                     if (!Cools.isEmpty(locMast1)) {
                         locMast = locMast1;
@@ -505,9 +523,10 @@
         // 閫掑綊鏌ヨ
         if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) {
             // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
-            if (times < rowCount * 2) {
+            if (times <= rowCount * 2) {
                 times = times + 1;
-                return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, times);
+//                return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, times);
+                return getLocNoRun(5, staDescId, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, times);
             }
 //            // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
 //            if (locTypeDto.getLocType1() < 2) {

--
Gitblit v1.9.1