From a23b44f21f596c5500bda617050aa72125e2e701 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期六, 07 十月 2023 12:49:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/tzskasrs' into tzskasrs
---
src/main/java/com/zy/common/service/CommonService.java | 214 +++++++++++++++++++++++++++-------------------------
1 files changed, 111 insertions(+), 103 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index d62cd45..0f568d3 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -28,16 +28,28 @@
public class CommonService {
public static final List<Integer> FIRST_GROUP_ROW_LIST = new ArrayList<Integer>() {{
- add(1);add(2);add(3);add(4);add(5);add(6);add(7);add(8);add(9);add(10);
- }};
- public static final List<Integer> FIRST_GROUP_ROW_LIST_SHORT = new ArrayList<Integer>() {{
- add(8);add(9);add(10);
+ add(1);
}};
public static final List<Integer> SECOND_GROUP_ROW_LIST = new ArrayList<Integer>() {{
- add(12);add(13);add(14);add(15);add(16);add(17);add(18);
+ add(3);add(4);
}};
public static final List<Integer> THIRD_GROUP_ROW_LIST = new ArrayList<Integer>() {{
- add(20);add(21);add(22);add(23);
+ add(6);add(7);
+ }};
+ public static final List<Integer> FOURTH_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(8);
+ }};
+ public static final List<Integer> FIFTH_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(10);add(11);
+ }};
+ public static final List<Integer> SIXTH_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(13);add(14);add(15);add(16);
+ }};
+ public static final List<Integer> SEVENTH_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(13);add(14);
+ }};
+ public static final List<Integer> EIGHTH_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(16);
}};
@@ -117,15 +129,15 @@
// 鐩爣搴撲綅
LocMast locMast = null;
- //娣疯浇鎵惧簱浣�
- locMast = getLocNoStep1(matNos, locTypeDto);
+ // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
+ locMast = getLocNoStep4(staDescId, locTypeDto);
if (locMast != null) {
//鎵惧埌搴撲綅锛岃繑鍥瀌to
return getLocNoStep6(staDescId, sourceStaNo, locMast);//杩斿洖dto
}
//搴撲綅瑙勫垯
- locMast = getLocNoStep2(matNos, locTypeDto);
+ locMast = getLocNoStepRule(matNos, locTypeDto);
if (locMast != null) {
//鎵惧埌搴撲綅锛岃繑鍥瀌to
return getLocNoStep6(staDescId, sourceStaNo, locMast);//杩斿洖dto
@@ -138,16 +150,15 @@
return getLocNoStep6(staDescId, sourceStaNo, locMast);//杩斿洖dto
}
- // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
- locMast = getLocNoStep4(staDescId, locTypeDto);
+ //鎼滅储鍗曞搧
+ locMast = getLocNoStepSingle(matNos, locTypeDto);
if (locMast != null) {
//鎵惧埌搴撲綅锛岃繑鍥瀌to
return getLocNoStep6(staDescId, sourceStaNo, locMast);//杩斿洖dto
}
- // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
- // 寮�濮嬫煡鎵惧簱浣� ==============================>>
- locMast = getLocNoStep5(locTypeDto, times);
+ //鎼滅储娣锋斁
+ locMast = getLocNoStepMixed(matNos, locTypeDto, times);
if (locMast != null) {
//鎵惧埌搴撲綅锛岃繑鍥瀌to
return getLocNoStep6(staDescId, sourceStaNo, locMast);//杩斿洖dto
@@ -158,82 +169,40 @@
}
/**
- * 娣疯浇鎵惧簱浣�
- */
- private LocMast getLocNoStep1(List<String> matNos, LocTypeDto locTypeDto) {
- LocMast locMast = null;
-
- //鍒ゆ柇褰撳墠璐х墿鏄惁涓烘贩杞借揣鐗�
- String firstMatNos = matNos.get(0);
- boolean mixed = false;//榛樿涓嶆槸娣疯浇璐х墿
- for (String matNo : matNos) {
- if (!firstMatNos.equals(matNo)) {
- mixed = true;//娣疯浇璐х墿
- break;
- }
- }
-
- if (!mixed) {
- return locMast;//涓嶆槸娣疯浇璐х墿锛岀洿鎺ヨ烦鍑哄綋鍓嶄换鍔�
- }
-
- // 鎵炬贩杞藉簱浣嶈鍒�
- LocRule locRule = locRuleService.findMixed();
- if (locRule == null) {
- return locMast;//娌℃湁娣疯浇瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
- }
-
- //灏嗗簱浣嶈鍒欑粍杞崲涓哄簱浣嶇粍
- List<LocMast> locMasts = locRuleService.locRuleToLocNos(locRule);
- if (locMasts == null || locMasts.size() == 0) {
- if (locRule.getKeepGo() == 0) {
- //鎵句笉鍒扮┖搴撲綅锛屼笖绂佹缁х画瀵绘壘鍏朵粬闈炴贩杞藉尯鍩熷簱浣�
- //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父
- throw new CoolException("娣疯浇鍖哄煙娌℃湁绌哄簱浣�");
- }
- return locMast;//娌℃湁娣疯浇瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
- }
-
- for (LocMast one : locMasts) {
- LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
- if (null != locMast0) {
- // 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
- // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
- if (locMastService.checkEmptyCount(locMast0, 10)) {
- locMast = locMast0;
- break;
- }
- }
- }
- }
-
- return locMast;
- }
-
- /**
* 搴撲綅瑙勫垯
*/
- private LocMast getLocNoStep2(List<String> matNos, LocTypeDto locTypeDto) {
+ private LocMast getLocNoStepRule(List<String> matNos, LocTypeDto locTypeDto) {
LocMast locMast = null;
- // 搴撳尯閿佸畾
- LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0));
- if (!Cools.isEmpty(locRule)) {
- List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
- for (LocMast one : locMasts) {
- LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
- if (null != locMast0) {
- // 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
- // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
- if (locMastService.checkEmptyCount(locMast0, 10)) {
- locMast = locMast0;
- break;
- }
+
+ //搴撲綅瑙勫垯鍙兘鍦ㄥ崟鍝佽揣鐗╀腑鐢熸晥
+ if (matNos.size() == 1) {
+ // 搴撳尯閿佸畾
+ List<LocRule> locRules = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0));
+ if (locRules == null || locRules.isEmpty()) {
+ return null;//娌℃湁搴撲綅瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
+ }
+
+ for (LocRule locRule : locRules) {
+ if (locRule == null) {
+ continue;
+ }
+
+ List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
+ for (LocMast locMast0 : locMasts) {
+ //棰勭暀绌哄簱浣�
+ if (locMastService.checkEmptyCount(locMast0, 10)) {
+ return locMast0;
}
}
}
+
+ if (locRules.get(0).getKeepGo() == 0) {
+ //鎵句笉鍒扮┖搴撲綅锛屼笖绂佹缁х画瀵绘壘鍏朵粬闈炴贩杞藉尯鍩熷簱浣�
+ //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父
+ throw new CoolException("瑙勫垯鍖哄煙娌℃湁绌哄簱浣�");
+ }
}
+
return locMast;
}
@@ -247,7 +216,7 @@
LocMast locMast0 = locMastService.findNearloc(wrkMast.getLocNo());
if (null != locMast0) {
// 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+ if (VersionUtils.checkLocType(locMast0, locTypeDto)) {
locMast = locMast0;
}
}
@@ -259,7 +228,7 @@
LocMast locMast0 = locMastService.findNearloc(locNo);
if (null != locMast0) {
// 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+ if (VersionUtils.checkLocType(locMast0, locTypeDto)) {
locMast = locMast0;
break;
}
@@ -282,7 +251,7 @@
LocMast locMast0 = locMastService.findNearloc(wrkMast.getLocNo());
if (null != locMast0) {
// 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+ if (VersionUtils.checkLocType(locMast0, locTypeDto)) {
locMast = locMast0;
break;
}
@@ -290,13 +259,13 @@
}
if (Cools.isEmpty(locMast)){
List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
- .eq("loc_sts", "D"));
+ .eq("loc_sts", "O"));
if (locMasts.size() > 0) {
for (LocMast loc : locMasts) {
LocMast locMast0 = locMastService.findNearloc(loc.getLocNo());
if (null != locMast0) {
// 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+ if (VersionUtils.checkLocType(locMast0, locTypeDto)) {
locMast = locMast0;
break;
}
@@ -309,20 +278,19 @@
return locMast;
}
- // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
- private LocMast getLocNoStep5(LocTypeDto locTypeDto, int times) {
+ // 鎼滅储娣锋斁
+ private LocMast getLocNoStepMixed(List<String> matNos, LocTypeDto locTypeDto, int times) {
LocMast locMast = null;
- // 1.褰撴绱㈠簱鎺掍负娴呭簱浣嶆帓鏃讹紝浼樺厛瀵绘壘褰撳墠搴撴帓鐨勬繁搴撲綅鎺�
- List<LocMast> peakLocs = locMastService.selectAllPeakLoc();
- for (LocMast peakLoc : peakLocs) {
- List<String> groupInsideLoc = Utils.getGroupInsideLoc(peakLoc.getLocNo());
- if (!Cools.isEmpty(groupInsideLoc)) {
- if (!locMastService.checkAllLocEmpty(groupInsideLoc)) continue;
- locMast = peakLoc;
- break;
- } else {
- locMast = peakLoc;
- break;
+
+ if (matNos.size() > 1) {
+ List<LocMast> locMasts = locMastService.selectAreaEmpty(locTypeDto.getLocType1(), 1);//鎼滅储娣锋斁搴撲綅
+ //娣锋斁鍖哄煙鐩存帴鍙栫涓�涓嵆鍙�
+ for (LocMast mast : locMasts) {
+ //棰勭暀绌哄簱浣�
+ if (locMastService.checkEmptyCount(mast, 10)) {
+ locMast = mast;
+ break;
+ }
}
}
@@ -334,14 +302,54 @@
return locMast;
}
+ // 鎼滅储鍗曞搧
+ private LocMast getLocNoStepSingle(List<String> matNos, LocTypeDto locTypeDto) {
+ LocMast locMast = null;
+ // 1.鍏堟悳绱㈠崟鍝�
+ if (matNos.size() == 1) {
+ //鍗曞搧
+ List<LocMast> locMasts = locMastService.selectAreaEmpty(locTypeDto.getLocType1(), 2);//鎼滅储鍗曞搧搴撲綅
+ for (LocMast mast : locMasts) {
+ List<String> groupLoc = Utils.getGroupLoc(mast.getLocNo());
+ if (!locMastService.checkAllLocEmpty(groupLoc)) {
+ continue;
+ }
+
+ LocMast tmp = null;
+ for (String loc : groupLoc) {
+ LocMast locMast1 = locMastService.selectByLoc(loc);
+ if (locMast1 == null) {
+ continue;
+ }
+
+ if (!locMast1.getLocSts().equals("O")) {
+ continue;
+ }
+
+ tmp = locMast1;
+ break;
+ }
+
+ //棰勭暀绌哄簱浣�
+ if (tmp != null && locMastService.checkEmptyCount(mast, 10)) {
+ locMast = tmp;
+ break;
+ }
+ }
+ }
+
+ return locMast;
+ }
+
//杩斿洖dto
private StartupDto getLocNoStep6(Integer staDescId, Integer sourceStaNo, LocMast locMast) {
StartupDto startupDto = new StartupDto();
-
+ String locNo = locMast.getLocNo();
// 鑾峰彇鐩爣绔�
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
.eq("type_no", staDescId)
- .eq("stn_no", sourceStaNo);
+ .eq("stn_no", sourceStaNo)
+ .eq("crn_no",Utils.stnNoToLiftNo(sourceStaNo));//鍊熺敤鍫嗗灈鏈哄彿瀛楁鍏呭綋鎻愬崌鏈哄彿
StaDesc staDesc = staDescService.selectOne(wrapper);
if (Cools.isEmpty(staDesc)) {
log.error("鍏ュ簱璺緞涓嶅瓨鍦�, staDescId={}, sourceStaNo={}", staDescId, sourceStaNo);
--
Gitblit v1.9.1