From d3234825d804a6a205dba1c6092acc8e29981b81 Mon Sep 17 00:00:00 2001
From: lfd <1>
Date: 星期四, 06 三月 2025 10:11:23 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 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 f92cbe4..189bc19 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -146,7 +146,7 @@
         LocMast locMast = null;
 
         // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂�
-        if (!Cools.isEmpty(matNos)) {
+        if (!Cools.isEmpty(matNos) && (whsType==2 || whsType==4)) {
             List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow);
             for (String locNo : locNos) {
                 if (Utils.isShallowLoc(slaveProperties, locNo)) {
@@ -168,7 +168,7 @@
         }
 
         // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
-        if (staDescId == 10) {
+        if (staDescId == 10  && (whsType==2 || whsType==4)) {
             List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
             if (locMasts.size() > 0) {
                 for (LocMast loc : locMasts) {
@@ -257,7 +257,7 @@
 
         // 1.褰撴绱㈠簱鎺掍负娴呭簱浣嶆帓鏃讹紝浼樺厛瀵绘壘褰撳墠搴撴帓鐨勬繁搴撲綅鎺�
         if (locMast == null) {
-            if (Utils.isShallowLoc(slaveProperties, curRow)) {
+            if ((whsType==2 || whsType==4) && Utils.isShallowLoc(slaveProperties, curRow)) {
                 Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
                 locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1());
                 // todo:luxiaotao 濡傛灉鐢ㄦ祬鎺掓壘鍒扮殑娣卞簱浣嶏紝閭d箞鍒欓渶瑕佸垽鏂繖涓繁搴撲綅瀵瑰簲鐨勬祬搴撲綅鏄惁鏈夎揣锛團銆乆銆丏锛�
@@ -273,14 +273,14 @@
                     locMast = null;
                 }
                 // 鐩爣搴撲綅 ===>> 娴呭簱浣嶏紝 鍒欐牎楠屽叾娣卞簱浣嶆槸鍚︿负 F D X
-                if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
+                if ((whsType==2 || whsType==4) && null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
                     LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo()));
                     if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
                         locMast = null;
                     }
                 }
                 // 鐩爣搴撲綅 ===>> 娣卞簱浣嶏紝 鍒欐牎楠屽叾娴呭簱浣嶆槸鍚︿负 O
-                if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
+                if ((whsType==2 || whsType==4) && null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
                     LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
                     if (!shallowLoc.getLocSts().equals("O")) {
                         locMast = null;
@@ -292,16 +292,18 @@
         if (!Cools.isEmpty(locMast) && locMast.getCrnNo()<5){
             int wrkMastsC0 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", locMast.getCrnNo()).eq("io_type",1));
             if (wrkMastsC0>3 && times < rowCount){
+                int locO1 = locMastService.selectCount(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", 1));
                 BasCrnp basCrnp1 = basCrnpService.selectById(1);
-                if (basCrnp1.getInEnable().equals("Y") && basCrnp1.getCrnSts().equals(3)){
+                if (!Cools.isEmpty(locO1) && basCrnp1.getInEnable().equals("Y") && basCrnp1.getCrnSts().equals(3)){
                     int wrkMastsC1 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", 1).eq("io_type",1));
                     if (wrkMastsC0>wrkMastsC1){
                         locMast=null;
                     }
                 }
                 if (!Cools.isEmpty(locMast)){
+                    locO1=locMastService.selectCount(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", 2));
                     BasCrnp basCrnp2 = basCrnpService.selectById(2);
-                    if (basCrnp2.getInEnable().equals("Y") && basCrnp2.getCrnSts().equals(3)){
+                    if (!Cools.isEmpty(locO1) && basCrnp2.getInEnable().equals("Y") && basCrnp2.getCrnSts().equals(3)){
                         int wrkMastsC2 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", 2).eq("io_type",1));
                         if (wrkMastsC0>wrkMastsC2){
                             locMast=null;
@@ -309,8 +311,9 @@
                     }
                 }
                 if (!Cools.isEmpty(locMast)){
+                    locO1=locMastService.selectCount(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", 2));
                     BasCrnp basCrnp3 = basCrnpService.selectById(3);
-                    if (basCrnp3.getInEnable().equals("Y") && basCrnp3.getCrnSts().equals(3)){
+                    if (!Cools.isEmpty(locO1) && basCrnp3.getInEnable().equals("Y") && basCrnp3.getCrnSts().equals(3)){
                         int wrkMastsC3 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", 3).eq("io_type",1));
                         if (wrkMastsC0>wrkMastsC3){
                             locMast=null;
@@ -318,8 +321,9 @@
                     }
                 }
                 if (!Cools.isEmpty(locMast)){
+                    locO1=locMastService.selectCount(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", 2));
                     BasCrnp basCrnp4 = basCrnpService.selectById(4);
-                    if (basCrnp4.getInEnable().equals("Y") && basCrnp4.getCrnSts().equals(3)){
+                    if (!Cools.isEmpty(locO1) && basCrnp4.getInEnable().equals("Y") && basCrnp4.getCrnSts().equals(3)){
                         int wrkMastsC4 = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", 4).eq("io_type",1));
                         if (wrkMastsC0>wrkMastsC4){
                             locMast=null;
@@ -337,15 +341,25 @@
                 return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
             }
 
-            // 杞昏揣鐗╂壘杞诲簱浣嶄负绌烘椂锛屽彲浠ュ幓鎵鹃噸搴撲綅浠�
-            if (locTypeDto.getLocType1() == 1) {
-                locTypeDto.setLocType1((short) 2);
+//            // 杞昏揣鐗╂壘杞诲簱浣嶄负绌烘椂锛屽彲浠ュ幓鎵鹃噸搴撲綅浠�
+//            if (locTypeDto.getLocType1() == 1) {
+//                locTypeDto.setLocType1((short) 2);
+//                return getLocNo(1, staDescId, source2StaNo, matNos, locTypeDto, times);
+//            }
+            if ((times < rowCount+2) && (whsType==2 || whsType==4)) {
+                times = times + 1;
                 return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
             }
             log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
             throw new CoolException("娌℃湁绌哄簱浣�");
         }
         String locNo = locMast.getLocNo();
+        if (crnNo==5 || crnNo==7){
+            int i = locMastService.selectCount(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("crn_no", crnNo));
+            if (i<=10){
+                throw new CoolException("绌哄簱浣嶆暟灏忎簬绛変簬10涓紝绂佹鍏ュ簱");
+            }
+        }
 
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = getWorkNo(0);

--
Gitblit v1.9.1