From acdc4b3427cbd2a6dc811aed202fbd3e9c309d69 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期五, 05 十一月 2021 10:57:12 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 3488d53..18363a8 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -89,6 +89,11 @@
         return workNo;
     }
 
+    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, int times) {
+        LocTypeDto oldLocType = locTypeDto.clone();
+        return getLocNo(whsType, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
+    }
+
     /**
      * 妫�绱㈠簱浣嶅彿
      * @param whsType 绫诲瀷 1:鍙屾繁寮忚揣鏋�
@@ -97,7 +102,7 @@
      * @param matNos 鐗╂枡鍙烽泦鍚�
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
-    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, int times) {
+    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
         StartupDto startupDto = new StartupDto();
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = getWorkNo(0);
@@ -249,6 +254,20 @@
                 if (!locMastService.checkEmptyCount(locMast)) {
                     locMast = null;
                 }
+                // 鐩爣搴撲綅 ===>> 娴呭簱浣嶏紝 鍒欐牎楠屽叾娣卞簱浣嶆槸鍚︿负 F D X
+                if (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())) {
+                    LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
+                    if (!shallowLoc.getLocSts().equals("O")) {
+                        locMast = null;
+                    }
+                }
             }
         }
 
@@ -257,24 +276,33 @@
             // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
             if (times < rowCount) {
                 times = times + 1;
-                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
+                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
             } else {
                 times = 0;
             }
             // 璐х墿妫�绱綆搴撲綅浠撳け璐ワ紝鍏煎楂樺簱浣嶄粨鍚庣户缁墽琛�
             if (locTypeDto.getLocType1() == 1) {
                 locTypeDto.setLocType1((short) 2);
-                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
+                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
             }
             // 璐х墿妫�绱㈢獎搴撲綅浠撳け璐ワ紝鍏煎瀹藉簱浣嶄粨鍚庣户缁墽琛�
             if (locTypeDto.getLocType2() == 1) {
                 locTypeDto.setLocType2((short) 2);
-                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
+                if (oldLocType.getLocType1() == 1) {
+                    locTypeDto.setLocType1((short) 1);
+                }
+                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
             }
             // 璐х墿妫�绱㈣交搴撲綅浠撳け璐ワ紝鍏煎閲嶅簱浣嶄粨鍚庣户缁墽琛�
             if (locTypeDto.getLocType3() == 1) {
                 locTypeDto.setLocType3((short) 2);
-                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
+                if (oldLocType.getLocType1() == 1) {
+                    locTypeDto.setLocType1((short) 1);
+                }
+                if (oldLocType.getLocType2() == 1) {
+                    locTypeDto.setLocType2((short) 1);
+                }
+                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
             }
             log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
             throw new CoolException("娌℃湁绌哄簱浣�");

--
Gitblit v1.9.1