From 24654f1681b8f00a75a867730449858affc3f59e Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期二, 08 六月 2021 09:56:21 +0800
Subject: [PATCH] 单据列显示优化
---
src/main/java/com/zy/common/service/CommonService.java | 72 +++++++++++++++++++++++++----------
1 files changed, 51 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 883f320..da0aba3 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,36 +243,55 @@
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) {
+ times = times + 1;
+ 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);
}
- // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
- if (times >= rowCount) {
- log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
- throw new CoolException("娌℃湁绌哄簱浣�");
- }
- times = times + 1;
- return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, times);
+ log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
+ throw new CoolException("娌℃湁绌哄簱浣�");
}
String locNo = locMast.getLocNo();
--
Gitblit v1.9.1