From 8f227a0901d120f6f364712800e7a5d5d985e908 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期一, 06 二月 2023 11:11:21 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/service/CommonService.java | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 165 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index d1705b5..423aee2 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -55,6 +55,10 @@
private LocDetlService locDetlService;
@Autowired
private SlaveProperties slaveProperties;
+ @Autowired
+ private MatService matService;
+ @Autowired
+ private LocRuleService locRuleService;
/**
* 鐢熸垚宸ヤ綔鍙�
@@ -113,16 +117,25 @@
StartupDto startupDto = new StartupDto();
int start;
int end;
+ Integer theCrnNo = null;
switch (sourceStaNo) {
case 103:
whsType = 1;
start = 1;
end = 14;
+// if (null != wrkMastService.selectPakoutOfStaNo(104)) {
+// start = 8;
+// theCrnNo = 2;
+// }
break;
case 203:
whsType = 2;
start = 8;
end = 21;
+// if (null != wrkMastService.selectPakoutOfStaNo(204)) {
+// end = 14;
+// theCrnNo = 2;
+// }
break;
default:
throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
@@ -143,8 +156,19 @@
// 鐩爣搴撲綅
LocMast locMast = null;
- // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂�
+ boolean inoutEveryday = false;
if (!Cools.isEmpty(matNos)) {
+ for (String matNo : matNos) {
+ Mat mat = matService.selectByMatnr(matNo);
+ if (mat.getInoutEveryday() != null && mat.getInoutEveryday()) {
+ inoutEveryday = true;
+ break;
+ }
+ }
+ }
+
+ // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂�
+ if (!Cools.isEmpty(matNos) && matNos.size() == 1) {
List<String> locNos = locDetlService.getSameDetl(matNos.get(0), start, end);
for (String locNo : locNos) {
List<String> groupLoc = Utils.getGroupLoc(locNo);
@@ -186,8 +210,31 @@
}
}
- // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
+ // 搴撳尯閿佸畾
+ if (Cools.isEmpty(locMast)) {
+ LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null, start, end);
+ 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) {
+ List<String> groupLoc = Utils.getGroupLoc(one.getLocNo());
+ LocMast locMast0 = locMastService.findOutMost(groupLoc);
+ if (null != locMast0) {
+ // 娴呭簱浣嶇鍚堝昂瀵告娴�
+ if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+ // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父
+ if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) {
+ crnNo = locMast0.getCrnNo();
+ locMast = locMast0;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
int currentRow = 1;
if (null == locMast) {
Shelves shelves = new Shelves(rowCount, crn_qty);
@@ -205,9 +252,17 @@
switch (curRow) {
case 1:
curRow = 1;
+ if (null != theCrnNo) {
+ curRow = 8;
+ crnNo1 = crnNo1 + 1;
+ }
break;
case 2:
curRow = 7;
+ if (null != theCrnNo) {
+ curRow = 14;
+ crnNo1 = crnNo1 + 1;
+ }
break;
case 3:
curRow = 8;
@@ -228,9 +283,17 @@
break;
case 3:
curRow = 15;
+ if (null != theCrnNo) {
+ curRow = 8;
+ crnNo1 = crnNo1 - 1;
+ }
break;
case 4:
curRow = 21;
+ if (null != theCrnNo) {
+ curRow = 14;
+ crnNo1 = crnNo1 - 1;
+ }
break;
default:
throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
@@ -273,8 +336,7 @@
// 1.褰撴绱㈠簱鎺掍负娴呭簱浣嶆帓鏃讹紝浼樺厛瀵绘壘褰撳墠搴撴帓鐨勬繁搴撲綅鎺�
if (locMast == null) {
List<Integer> rows = Utils.getGroupLoc(curRow);
-
- List<LocMast> locMasts = locMastService.queryFreeLocMast(rows, rows.size(), locTypeDto.getLocType1());
+ List<LocMast> locMasts = locMastService.queryFreeLocMast0(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday);
if (!Cools.isEmpty(locMasts)) {
Integer innermostRow = Utils.getInnermostRow(locMasts.get(0).getLocNo());
for (LocMast one : locMasts) {
@@ -284,13 +346,84 @@
}
}
}
+
// 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
-// if (!locMastService.checkEmptyCount(locMast)) {
-// locMast = null;
-// }
+ if (!locMastService.checkEmptyCount(locMast, 10)) { locMast = null; }
}
- // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
+ // 2.鏃犲簱浣嶆椂锛屾棤瑙嗗尯鍩熼攣瀹氾紝閲嶆柊鏌ユ壘搴撲綅
+ if (Cools.isEmpty(locMast)) {
+ int sign = curRow;
+ while (sign != 0 && Cools.isEmpty(locMast)) {
+ List<LocMast> locMasts = locMastService.queryFreeLocMastEnd(sign, locTypeDto.getLocType1());
+ for (LocMast loc : locMasts) {
+ // 鍚屽簱浣嶇粍瀵瑰簲鍏堕挶搴撲綅鏄惁涓� O.绌哄簱浣�
+ boolean success = true;
+ // 娴呭簱浣�
+ List<String> outerLocList = Utils.getGroupOuterLoc(loc.getLocNo());
+ for (String outerLocNo : outerLocList) {
+ LocMast outerLoc = locMastService.selectById(outerLocNo);
+ if (Cools.isEmpty(outerLoc)) {
+ continue;
+ }
+ if (!outerLoc.getLocSts().equals("O")) {
+ success = false; break;
+ }
+ }
+ // 娣卞簱浣�
+ List<String> insideLocList = Utils.getGroupInsideLoc(loc.getLocNo());
+ for (String insideLocNo : insideLocList) {
+ LocMast insideLoc = locMastService.selectById(insideLocNo);
+ if (Cools.isEmpty(insideLoc)) {
+ continue;
+ }
+ if (insideLoc.getLocSts().equals("R") || insideLoc.getLocSts().equals("P")) {
+ success = false; break;
+ }
+ }
+ if (success) {
+ locMast = loc;
+ break;
+ }
+ }
+ sign = getCurRow(sign);
+ }
+ }
+
+
+// if (Cools.isEmpty(locMast)){
+// List<LocMast> locMasts = locMastService.queryFreeLocMastEnd(curRow, locTypeDto.getLocType1());
+// int sign=curRow;
+// while (true){
+// if (locMasts.size()==0){
+// sign = getCurRow(sign);
+// if (sign != 0){
+// locMasts = locMastService.queryFreeLocMastEnd(sign, locTypeDto.getLocType1());
+// }else {
+// break;
+// }
+// }else {
+// break;
+// }
+// }
+// for (LocMast locMast1 : locMasts){
+// List<LocMast> locMasts1 = locMastService.queryFreeLocMastEnd0(locMast1.getBay1(), locMast1.getLev1(),locMast1.getRow1(), locTypeDto.getLocType1());
+// Integer innermostRow = Utils.getInnermostRow(locMasts1.get(0).getLocNo());
+// for (LocMast locMast2:locMasts1){
+// if (locMast2.getLocSts().equals("O")){
+// locMast = locMast2;
+// break;
+// }else if (!locMast2.getLocSts().equals("F")){
+// break;
+// }
+// }
+// if (!Cools.isEmpty(locMast)){
+// break;
+// }
+// }
+// }
+
+ // 3.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
if (Cools.isEmpty(locMast)) {
// 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
if (times < rowCount) {
@@ -332,4 +465,28 @@
}
}
+ public int getCurRow(int curRow){
+ switch (curRow){
+ case 1:
+ case 2:
+ case 8:
+ case 9:
+ case 10:
+ case 15:
+ case 16:
+ case 17:
+ return curRow+1;
+ case 5:
+ case 6:
+ case 7:
+ case 13:
+ case 14:
+ case 20:
+ case 21:
+ return curRow-1;
+ default:
+ return 0;
+ }
+ }
+
}
--
Gitblit v1.9.1