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 | 103 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 68 insertions(+), 35 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index a5c41cf..bd83b19 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -10,12 +10,14 @@
import com.zy.asrs.utils.Utils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocTypeDto;
+import com.zy.common.model.Shelves;
import com.zy.common.model.StartupDto;
import com.zy.common.properties.SlaveProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -25,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;
@@ -102,7 +113,21 @@
*/
public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
StartupDto startupDto = new StartupDto();
- whsType = 1;
+ 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);
RowLastno rowLastno = rowLastnoService.selectById(whsType);
@@ -119,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);
@@ -140,7 +166,7 @@
// 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
if (staDescId == 10) {
- List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
+ 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());
@@ -161,32 +187,19 @@
// 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
if (null == locMast) {
- int t = 0;
- boolean execute = true;
- int crnNo1;
- 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;
+ 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("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
+ }
+ Integer crnNo1 = shelves.get(curRow) + 1;
+ if (whsType != 1) {
+ crnNo1 = whsType;
}
if (basCrnpService.checkSiteError(crnNo1, true)) {
crnNo = crnNo1;
- execute = false;
+ break;
}
}
}
@@ -219,11 +232,29 @@
// 1.褰撴绱㈠簱鎺掍负娴呭簱浣嶆帓鏃讹紝浼樺厛瀵绘壘褰撳墠搴撴帓鐨勬繁搴撲綅鎺�
if (locMast == null) {
- locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
- // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
- 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.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
@@ -232,12 +263,14 @@
if (times < rowCount) {
times = times + 1;
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