From 031caa5cb14a709702f942aede37f6403d436650 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期四, 27 十一月 2025 08:10:23 +0800
Subject: [PATCH] #1
---
src/main/java/com/zy/common/service/CommonService.java | 142 +++++++++++++++++++++++++++++++++-------------
1 files changed, 101 insertions(+), 41 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..45d913c 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -1,6 +1,7 @@
package com.zy.common.service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
@@ -16,6 +17,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Collections;
import java.util.List;
/**
@@ -139,7 +141,7 @@
StartupDto startupDto = new StartupDto();
-// // 鑾峰彇鐩爣绔�
+ // 鑾峰彇鐩爣绔�
// Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>().eq("type_no", staDescId).eq("stn_no", sourceStaNo).eq("crn_no", locMast.getCrnNo());
// StaDesc staDesc = staDescService.selectOne(wrapper);
// if (Cools.isEmpty(staDesc)) {
@@ -159,7 +161,7 @@
// 杩斿洖dto
startupDto.setWorkNo(workNo);
startupDto.setCrnNo(locMast.getCrnNo());
- startupDto.setSourceStaNo(sourceStaNo);
+// startupDto.setSourceStaNo(sourceStaNo);
startupDto.setLocNo(locNo);
return startupDto;
}
@@ -170,10 +172,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 +194,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 +259,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 +280,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