From cc490f6c02f994cfec1028de342e410f3aa2bc82 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 17 八月 2022 17:02:40 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/service/CommonService.java | 149 ++++++++++++++++++++++++-------------------------
1 files changed, 73 insertions(+), 76 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index b5f1c6f..bd83b19 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -3,7 +3,6 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.common.Arith;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
@@ -18,6 +17,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -27,6 +27,15 @@
@Slf4j
@Service
public class CommonService {
+
+ public static final List<Integer> FIRST_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(2);add(3);add(4);add(5);add(6);add(7);add(8);add(9);add(10);
+ add(11);add(12);add(13);add(14);add(15);add(16);add(17);
+ }};
+ public static final List<Integer> SECOND_GROUP_ROW_LIST = new ArrayList<Integer>() {{
+ add(18);add(19);add(20);
+ add(21);add(22);add(23);add(24);add(25);add(26);add(27);add(28);add(29);add(30);
+ }};
@Autowired
private WrkMastService wrkMastService;
@@ -89,9 +98,9 @@
return workNo;
}
- 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, List<String> matNos, LocTypeDto locTypeDto, int times) {
LocTypeDto oldLocType = locTypeDto.clone();
- return getLocNo(whsType, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
+ return getLocNo(whsType, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times);
}
/**
@@ -102,12 +111,22 @@
* @param matNos 鐗╂枡鍙烽泦鍚�
* @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
*/
- public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
+ public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
StartupDto startupDto = new StartupDto();
- if (sourceStaNo == 100) { // 杞昏揣淇″彿
- whsType = 1; // 1 - 11 宸�
- } else if (sourceStaNo == 200) { // 閲嶈揣淇″彿
- whsType = 2; // 12 - 21 鍙�
+ int start = 2;
+ int end = 30;
+ switch (sourceStaNo) {
+ case 107:
+ whsType = 2;
+ end = 17;
+ break;
+ case 118:
+ whsType = 3;
+ start = 18;
+ break;
+ default:
+ whsType = 1;
+ break;
}
// 鐢熸垚宸ヤ綔鍙�
int workNo = getWorkNo(0);
@@ -125,9 +144,10 @@
// 鐩爣搴撲綅
LocMast locMast = null;
+
// 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂�
if (!Cools.isEmpty(matNos)) {
- List<String> locNos = locDetlService.getSameDetl(matNos.get(0), sRow, eRow);
+ List<String> locNos = locDetlService.getSameDetl(matNos.get(0), start, end);
for (String locNo : locNos) {
List<String> groupLoc = Utils.getGroupLoc(locNo);
locMast = locMastService.findOutMost(groupLoc);
@@ -145,8 +165,8 @@
}
// 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
- if (emptyMk) {
- List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
+ if (staDescId == 10) {
+ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", start).le("row1", end));
if (locMasts.size() > 0) {
for (LocMast loc : locMasts) {
List<String> groupLoc = Utils.getGroupLoc(loc.getLocNo());
@@ -167,62 +187,19 @@
// 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
if (null == locMast) {
- int t = 0;
- boolean execute = true;
- int crnNo1;
- // 1 - 11鎺�
- if (whsType == 1) {
- while (execute && t < 4) {
- t++;
- switch (curRow) {
- case 3:
- curRow = 11;
- crnNo1 = 2;
- break;
- case 11:
- curRow = 4;
- crnNo1 = 1;
- break;
- case 4:
- curRow = 12;
- crnNo1 = 2;
- break;
- default:
- curRow = 3;
- crnNo1 = 1;
- break;
- }
- if (basCrnpService.checkSiteError(crnNo1, true)) {
- crnNo = crnNo1;
- execute = false;
- }
+ Shelves shelves = new Shelves(rowCount, crn_qty);
+ for (int i = 0; i < shelves.group; i ++) {
+ curRow = shelves.start(curRow);
+ if (curRow < 0) {
+ throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
}
- // 12 - 21鎺�
- } else {
- while (execute && t < 4) {
- t++;
- switch (curRow) {
- case 11:
- curRow = 18;
- crnNo1 = 3;
- break;
- case 18:
- curRow = 12;
- crnNo1 = 2;
- break;
- case 12:
- curRow = 19;
- crnNo1 = 3;
- break;
- default:
- curRow = 11;
- crnNo1 = 2;
- break;
- }
- if (basCrnpService.checkSiteError(crnNo1, true)) {
- crnNo = crnNo1;
- execute = false;
- }
+ Integer crnNo1 = shelves.get(curRow) + 1;
+ if (whsType != 1) {
+ crnNo1 = whsType;
+ }
+ if (basCrnpService.checkSiteError(crnNo1, true)) {
+ crnNo = crnNo1;
+ break;
}
}
}
@@ -255,11 +232,29 @@
// 1.褰撴绱㈠簱鎺掍负娴呭簱浣嶆帓鏃讹紝浼樺厛瀵绘壘褰撳墠搴撴帓鐨勬繁搴撲綅鎺�
if (locMast == null) {
- locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1(), locTypeDto.getLocType2(), locTypeDto.getLocType3());
- // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
- if (!locMastService.checkEmptyCount(locMast)) {
- locMast = null;
+ List<Integer> rows;
+ if (whsType == 2) {
+ rows = FIRST_GROUP_ROW_LIST;
+ } else if (whsType == 3) {
+ rows = SECOND_GROUP_ROW_LIST;
+ } else {
+ switch (curRow) {
+ case 1:
+ rows = FIRST_GROUP_ROW_LIST;
+ break;
+ case 2:
+ rows = SECOND_GROUP_ROW_LIST;
+ break;
+ default:
+ throw new CoolException("鍏ュ簱閫昏緫鏁呴殰銆�" + curRow + "銆�");
+ }
}
+
+ locMast = locMastService.queryFreeLocMast(null, rows, locTypeDto.getLocType1());
+ // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
+// if (!locMastService.checkEmptyCount(locMast)) {
+// locMast = null;
+// }
}
// 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
@@ -267,13 +262,15 @@
// 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
if (times < rowCount) {
times = times + 1;
- return getLocNo(whsType, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
+ return getLocNo(whsType, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times);
+ } else {
+ times = 0;
}
-// // 璐х墿妫�绱綆搴撲綅浠撳け璐ワ紝鍏煎楂樺簱浣嶄粨鍚庣户缁墽琛�
-// if (locTypeDto.getLocType1() == 1) {
-// locTypeDto.setLocType1((short) 2);
-// return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
-// }
+ // 璐х墿妫�绱綆搴撲綅浠撳け璐ワ紝鍏煎楂樺簱浣嶄粨鍚庣户缁墽琛�
+ if (locTypeDto.getLocType1() == 1) {
+ locTypeDto.setLocType1((short) 2);
+ return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times);
+ }
log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
throw new CoolException("娌℃湁绌哄簱浣�");
}
--
Gitblit v1.9.1