From c6fae49294b74658ce258d7dbb8442124e54fef5 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期日, 11 五月 2025 12:11:36 +0800
Subject: [PATCH] #调试

---
 src/main/java/com/zy/common/service/CommonService.java |   95 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 78 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 bfa3529..0297a3e 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -7,6 +7,7 @@
 import com.core.common.Cools;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
+import com.zy.asrs.entity.result.KeyValueVo;
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.Utils;
 import com.zy.asrs.utils.VersionUtils;
@@ -19,6 +20,10 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -50,7 +55,6 @@
 
     /**
      * 鐢熸垚宸ヤ綔鍙�
-     *
      * @param wrkMk
      * @return workNo(宸ヤ綔鍙�)
      */
@@ -63,17 +67,17 @@
         int workNo = wrkLastno.getWrkNo();
         int sNo = wrkLastno.getSNo();
         int eNo = wrkLastno.getENo();
-        workNo = workNo >= eNo ? sNo : workNo + 1;
+        workNo = workNo>=eNo ? sNo : workNo+1;
         while (true) {
             WrkMast wrkMast = wrkMastService.selectById(workNo);
             if (null != wrkMast) {
-                workNo = workNo >= eNo ? sNo : workNo + 1;
+                workNo = workNo>=eNo ? sNo : workNo+1;
             } else {
                 break;
             }
         }
         // 淇敼搴忓彿璁板綍
-        if (workNo > 0) {
+        if (workNo > 0){
             wrkLastno.setWrkNo(workNo);
             wrkLastnoService.updateById(wrkLastno);
         }
@@ -81,11 +85,27 @@
         if (workNo == 0) {
             throw new CoolException("鐢熸垚宸ヤ綔鍙峰け璐ワ紝璇疯仈绯荤鐞嗗憳");
         } else {
-            if (wrkMastService.selectById(workNo) != null) {
+            if (wrkMastService.selectById(workNo)!=null) {
                 throw new CoolException("鐢熸垚宸ヤ綔鍙�" + workNo + "鍦ㄥ伐浣滄。涓凡瀛樺湪");
             }
         }
         return workNo;
+    }
+
+    //鎷嗙洏鏈哄绌烘澘鎵爜锛岄┍鍔ㄦ墭鐩樺悜鐮佸灈浣嶏紝涓嶅叆搴�
+    @Transactional
+    public StartupDto getScanBarcodeEmptyBoard(){
+        StartupDto startupDto = new StartupDto();
+        Integer staNo = 0;
+        if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 201).eq("staNo", 216))<2){
+            staNo=216;
+        }
+        if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 201).eq("staNo", 220))<2){
+            staNo=220;
+        }
+
+        startupDto.setStaNo(staNo);
+        return startupDto;
     }
 
     /**
@@ -146,9 +166,9 @@
         if (!Cools.isEmpty(moveCrnNo) && moveCrnNo!=0){
             crnNumber = moveCrnNo;
             if (times==0){
-                curRow = moveCrnNo*4-1;
+                curRow = moveCrnNo*2-1;
             }else {
-                curRow = moveCrnNo*4-2;
+                curRow = moveCrnNo*2-1;
             }
         }
 
@@ -162,7 +182,7 @@
                 nearRow = locNecessaryParameters[3];
                 List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
                 int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type",100));
-                if (locMasts.size()-crnCountO<=2){
+                if (locMasts.size()-crnCountO<=0){
                     times++;
                     continue;
                 }
@@ -171,9 +191,9 @@
                 times++;
             }
         }
-        if (nearRow == 0) {
-            throw new CoolException("鏃犲彲鐢ㄥ爢鍨涙満");
-        }
+//        if (nearRow == 0) {
+//            throw new CoolException("鏃犲彲鐢ㄥ爢鍨涙満");
+//        }
 
         boolean signRule1 = false;
         boolean signRule2 = false;
@@ -182,7 +202,7 @@
         if (Utils.BooleanWhsTypeStaIoType(whsType)){
             // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //鍒嗙鐗�
             if (!Cools.isEmpty(matnr) &&  staDescId == 1){
-                signRule1 = true;
+                signRule1 = false;
             }
             // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //浜掗�氱増
             if (!Cools.isEmpty(matnr) && staDescId == 1) {
@@ -291,6 +311,7 @@
             }else {
                 staNo = basDevpService.selectById(staDesc.getCrnStn());
                 if (!staNo.getAutoing().equals("Y")) {
+                    log.error("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
 //                throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
                     crnNo = 0;
                 }
@@ -308,22 +329,62 @@
 
         // 1.鎸夎鍒欐煡鎵惧簱浣�
         if (Cools.isEmpty(locMast) && crnNo != 0) {
-            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O").orderBy("lev1",true).orderBy("bay1",true));
+            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                    .eq("row1", nearRow)
+                    .eq("loc_sts", "O")
+                    .orderBy("lev1",true).orderBy("bay1",true));
             for (LocMast locMast1 : locMasts) {
                 if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
                     continue;
                 }
                 if (Utils.BooleanWhsTypeStaIoType(whsType)){
-                    String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
-                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc).eq("loc_sts", "O"));
+//                    String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
+                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                            .eq("loc_sts", "O"));
                     if (!Cools.isEmpty(locMast2)) {
                         locMast = locMast2;
                         break;
                     }
-                }else {
+                } else {
                     if (!Cools.isEmpty(locMast1)) {
                         locMast = locMast1;
                         break;
+                    }
+                }
+            }
+
+            if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(whsType)){
+                for (LocMast locMast1 : locMasts) {
+                    if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
+                        continue;
+                    }
+                    if (Utils.BooleanWhsTypeStaIoType(whsType)){
+                        String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
+                        LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                .eq("loc_no", shallowLoc).eq("loc_sts", "O"));
+                        if (!Cools.isEmpty(locMast2)) {
+                            locMast = locMast2;
+                            break;
+                        } else {
+                            locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                    .eq("loc_no", shallowLoc).eq("loc_sts", "F"));
+                            if (!Cools.isEmpty(locMast2)) {
+                                locMast = locMast2;
+                                break;
+                            } else {
+                                locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                        .eq("loc_no", shallowLoc).eq("loc_sts", "D"));
+                                if (!Cools.isEmpty(locMast2)) {
+                                    locMast = locMast2;
+                                    break;
+                                }
+                            }
+                        }
+                    } else {
+                        if (!Cools.isEmpty(locMast1)) {
+                            locMast = locMast1;
+                            break;
+                        }
                     }
                 }
             }
@@ -338,7 +399,7 @@
             // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
             if (times < rowCount*2) {
                 times = times + 1;
-                return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
+                return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo+1, locTypeDto, times);
             }
 //            // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
 //            if (locTypeDto.getLocType1() < 2) {

--
Gitblit v1.9.1