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 | 60 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java index bc4020f..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); @@ -133,11 +138,14 @@ if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { // 娴呭簱浣嶇鍚堝昂瀵告娴� if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) { - // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父 - if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { - locMast = shallowLoc; - crnNo = locMast.getCrnNo(); - break; + // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣� + if (locMastService.checkEmptyCount(shallowLoc)) { + // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父 + if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { + locMast = shallowLoc; + crnNo = locMast.getCrnNo(); + break; + } } } } @@ -155,11 +163,14 @@ // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣� LocMast shallowLoc = locMastService.selectById(shallowLocNo); if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { - // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父 - if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { - locMast = shallowLoc; - crnNo = locMast.getCrnNo(); - break; + // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣� + if (locMastService.checkEmptyCount(shallowLoc)) { + // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父 + if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { + locMast = shallowLoc; + crnNo = locMast.getCrnNo(); + break; + } } } } @@ -232,35 +243,52 @@ if (Utils.isShallowLoc(slaveProperties, curRow)) { Integer deepRow = Utils.getDeepRow(slaveProperties, curRow); locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1(), locTypeDto.getLocType2(), locTypeDto.getLocType3()); + // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣� + if (!locMastService.checkEmptyCount(locMast)) { + locMast = null; + } } if (Cools.isEmpty(locMast)) { locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1(), locTypeDto.getLocType2(), locTypeDto.getLocType3()); + // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣� + if (!locMastService.checkEmptyCount(locMast)) { + locMast = null; + } } } // 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