From 2f8dcd296b25a93b6dd2e5f98d1455883db1f57c Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 16 十月 2025 09:27:01 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/service/CommonService.java | 137 ++++++++++++++++++++++++++++++++-------------
1 files changed, 98 insertions(+), 39 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index c3ccb4a..27f3b06 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -16,6 +16,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Collections;
import java.util.List;
/**
@@ -170,10 +171,14 @@
List<String> locNos = locDetlService.getSameDetlList(findLocNoAttributeVo.getMatnr());
for (String locNo : locNos) {
//鑾峰彇閫氶亾缁�
- List<Integer> locRowGroupDesc = Utils.getLocRowGroupDesc(slaveProperties, Utils.getRow(locNo));
+ List<Integer> locRowGroupDesc = Utils.getLocGroupDesc(slaveProperties, locNo);
for (Integer row : locRowGroupDesc) {
String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
LocMast deepLoc = locMastService.selectById(deepLocNo);
+ if (deepLoc == null) {
+ continue;
+ }
+
if (deepLoc.getLocSts().equals("F")) {
continue;
} else if (deepLoc.getLocSts().equals("O")) {
@@ -188,30 +193,54 @@
if(targetLocMast == null) {
//鐩歌繎鐗╂枡鍖归厤澶辫触锛屾悳绱㈠彲鐢ㄧ┖搴撲綅缁�
- List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
- .eq("loc_sts", "O")
- .orderBy("lev1", true)
- .orderBy("bay1", true));
- for (LocMast locMast : locMasts) {
- String locNo = locMast.getLocNo();
- //鑾峰彇閫氶亾缁�
- List<Integer> locRowGroupDesc = Utils.getLocRowGroupDesc(slaveProperties, Utils.getRow(locNo));
- boolean flag = true;
- for (Integer row : locRowGroupDesc) {
- String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
- LocMast deepLoc = locMastService.selectById(deepLocNo);
- if (!deepLoc.getLocSts().equals("O")) {
- flag = false;
+ //鑾峰彇璁惧妤煎眰
+ List<Integer> levList = basCrnpService.getLevList();
+ Collections.shuffle(levList);
+
+ List<Integer> locLevList = locMastService.getLevList();
+ levList.addAll(locLevList);
+
+ for (Integer lev : levList) {
+ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+ .eq("loc_sts", "O")
+ .eq("lev1", lev)
+ .orderBy("bay1", true));
+ for (LocMast locMast : locMasts) {
+ String locNo = locMast.getLocNo();
+ //鑾峰彇閫氶亾缁�
+ List<Integer> locRowGroupDesc = Utils.getLocGroupDesc(slaveProperties, locNo);
+
+ boolean flag = true;
+ for (Integer row : locRowGroupDesc) {
+ String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
+ LocMast deepLoc = locMastService.selectById(deepLocNo);
+ if (deepLoc == null) {
+ continue;
+ }
+
+ if (!deepLoc.getLocSts().equals("O")) {
+ flag = false;
+ break;
+ }
+ }
+
+ if (flag) {
+ for (Integer row : locRowGroupDesc) {
+ String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
+ LocMast deepLoc = locMastService.selectById(deepLocNo);
+ if (deepLoc == null) {
+ continue;
+ }
+
+ targetLocMast = deepLoc;
+ break;
+ }
break;
}
}
- if (flag) {
- Integer firstRow = locRowGroupDesc.get(0);
- String deepLocNo = Utils.getLocNo(firstRow, Utils.getBay(locNo), Utils.getLev(locNo));
- LocMast deepLoc = locMastService.selectById(deepLocNo);
- targetLocMast = deepLoc;
+ if (targetLocMast != null) {
break;
}
}
@@ -229,10 +258,14 @@
for (LocMast locMast : locMastsD) {
String locNo = locMast.getLocNo();
//鑾峰彇閫氶亾缁�
- List<Integer> locRowGroupDesc = Utils.getLocRowGroupDesc(slaveProperties, Utils.getRow(locNo));
+ List<Integer> locRowGroupDesc = Utils.getLocGroupDesc(slaveProperties, locNo);
for (Integer row : locRowGroupDesc) {
String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
LocMast deepLoc = locMastService.selectById(deepLocNo);
+ if (deepLoc == null) {
+ continue;
+ }
+
if (deepLoc.getLocSts().equals("F")) {
continue;
} else if (deepLoc.getLocSts().equals("O")) {
@@ -246,32 +279,58 @@
}
if(targetLocMast == null) {
- //鐩歌繎鐗╂枡鍖归厤澶辫触锛屾悳绱㈠彲鐢ㄧ┖搴撲綅缁�
- List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
- .eq("loc_sts", "O")
- .orderBy("lev1", true)
- .orderBy("bay1", true));
- for (LocMast locMast : locMasts) {
- String locNo = locMast.getLocNo();
- //鑾峰彇閫氶亾缁�
- List<Integer> locRowGroupDesc = Utils.getLocRowGroupDesc(slaveProperties, Utils.getRow(locNo));
- boolean flag = true;
- for (Integer row : locRowGroupDesc) {
- String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
- LocMast deepLoc = locMastService.selectById(deepLocNo);
- if (!deepLoc.getLocSts().equals("O")) {
- flag = false;
+ //鑾峰彇璁惧妤煎眰
+ List<Integer> levList = basCrnpService.getLevList();
+ Collections.shuffle(levList);
+
+ List<Integer> locLevList = locMastService.getLevList();
+ levList.addAll(locLevList);
+
+ for (Integer lev : levList) {
+ //鐩歌繎鐗╂枡鍖归厤澶辫触锛屾悳绱㈠彲鐢ㄧ┖搴撲綅缁�
+ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+ .eq("loc_sts", "O")
+ .eq("lev1", lev)
+ .orderBy("bay1", true));
+ for (LocMast locMast : locMasts) {
+ String locNo = locMast.getLocNo();
+ //鑾峰彇閫氶亾缁�
+ List<Integer> locRowGroupDesc = Utils.getLocGroupDesc(slaveProperties, locNo);
+
+ boolean flag = true;
+ for (Integer row : locRowGroupDesc) {
+ String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
+ LocMast deepLoc = locMastService.selectById(deepLocNo);
+ if (deepLoc == null) {
+ continue;
+ }
+
+ if (!deepLoc.getLocSts().equals("O")) {
+ flag = false;
+ break;
+ }
+ }
+
+ if (flag) {
+ for (Integer row : locRowGroupDesc) {
+ String deepLocNo = Utils.getLocNo(row, Utils.getBay(locNo), Utils.getLev(locNo));
+ LocMast deepLoc = locMastService.selectById(deepLocNo);
+ if (deepLoc == null) {
+ continue;
+ }
+
+ targetLocMast = deepLoc;
+ break;
+ }
break;
}
}
- if (flag) {
- targetLocMast = locMast;
+ if (targetLocMast != null) {
break;
}
}
-
}
return targetLocMast;
}
--
Gitblit v1.9.1