From 8e7ccc76d83f0bb2be1cbaf3d8d50dff4d15b6ba Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期六, 03 四月 2021 14:42:57 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 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..4de91a3 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);
@@ -255,26 +260,35 @@
         // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
         if (Cools.isEmpty(locMast)) {
             // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
-            if (times < rowCount) {
+            if (times < crn_qty) {
                 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