From 30332e7ecfa65f8c419271aeb79641d432c872d7 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期三, 18 十二月 2024 14:39:45 +0800
Subject: [PATCH] 库区规则表
---
src/main/java/com/zy/common/service/CommonService.java | 337 +++++++++++++++++++++++++++++--------------------------
1 files changed, 176 insertions(+), 161 deletions(-)
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 3dd5b72..61c6d26 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -7,6 +7,7 @@
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
+import com.zy.asrs.entity.result.FindLocNoAttributeVo;
import com.zy.asrs.entity.result.KeyValueVo;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
@@ -117,11 +118,12 @@
*
* @param staDescId 璺緞ID
* @param sourceStaNo 婧愮珯
- * @param matnr 鐗╂枡鍙烽泦鍚�
+ * @param findLocNoAttributeVo 灞炴��
+ * @param locTypeDto 绫诲瀷
* @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
*/
@Transactional
- public StartupDto getLocNo( Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto) {
+ public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, LocTypeDto locTypeDto) {
try{
Integer whsType = Utils.GetWhsType(sourceStaNo);
RowLastno rowLastno = rowLastnoService.selectById(whsType);
@@ -131,7 +133,7 @@
*/
switch (rowLastnoType.getType()){
case 1:
- return getLocNoRun(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0);
+ return getLocNoRun(whsType,staDescId,sourceStaNo,findLocNoAttributeVo,0,locTypeDto,0);
case 2:
log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�",sourceStaNo);
break;
@@ -139,9 +141,9 @@
log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�",sourceStaNo);
break;
case 4:
- return getLocNoRun4(whsType,staDescId,sourceStaNo,matnr,batch,grade,4,locTypeDto,0);
+ return getLocNoRun4(whsType,staDescId,sourceStaNo,findLocNoAttributeVo,4,locTypeDto,0);
case 5:
- return getLocNoRun5(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0);
+ return getLocNoRun5(whsType,staDescId,sourceStaNo,findLocNoAttributeVo,0,locTypeDto,0);
default:
log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�",sourceStaNo);
break;
@@ -159,20 +161,14 @@
* @param whsType 绫诲瀷 1:鍙屾繁寮忚揣鏋�
* @param staDescId 璺緞ID
* @param sourceStaNo 婧愮珯
- * @param matnr 鐗╂枡鍙烽泦鍚�
+ * @param findLocNoAttributeVo 灞炴��
+ * @param moveCrnNo 婧�
+ * @param locTypeDto 绫诲瀷
+ * @param times 杞娆℃暟
* @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
*/
@Transactional
- public StartupDto getLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
- if (Cools.isEmpty(matnr)) { //鐗╂枡鍙�
- matnr = "";
- }
- if (Cools.isEmpty(batch)) { //鎵规
- batch = "";
- }
- if (Cools.isEmpty(grade)) { //澶囩敤
- grade = "";
- }
+ public StartupDto getLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
// 鍒濆鍖栧弬鏁�
int crnNo = 0; //鍫嗗灈鏈哄彿
@@ -219,6 +215,8 @@
.eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type",100));
if (locMasts.size()-crnCountO<=2){
+ log.error(crnNo+"鍙峰爢鍨涙満娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
+ nearRow = 0;
times++;
continue;
}
@@ -237,15 +235,15 @@
if (Utils.BooleanWhsTypeStaIoType(rowLastno)){
// 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //鍒嗙鐗�
- if (!Cools.isEmpty(matnr) && staDescId == 1){
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1){
signRule1 = true;
}
// 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //浜掗�氱増
- if (!Cools.isEmpty(matnr) && staDescId == 1) {
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1) {
signRule2 = true;
}
- if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) {
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && (staDescId == 11 || staDescId == 111)) {
signRule1 = true;
}
}
@@ -262,9 +260,9 @@
LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("F")){
LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMastF.getLocNo()));
- if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())
- && batch.equals(batch.isEmpty() ? "" : locDetl.getBatch())
- && grade.equals(grade.isEmpty() ? "" : locDetl.getBrand())) {
+ if (!Cools.isEmpty(locDetl) && findLocNoAttributeVo.getMatnr().equals(locDetl.getMatnr())
+ && findLocNoAttributeVo.getBatch().equals(locDetl.getBatch())
+ && findLocNoAttributeVo.getBrand().equals(locDetl.getBrand())) {
//鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娣辩┖搴撲綅
locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
break;
@@ -273,7 +271,7 @@
}
}
}else if (signRule2){
- List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow);
+ List<String> locNos = locDetlService.getSameDetlToday(findLocNoAttributeVo.getMatnr(), sRow, eRow);
for (String locNo : locNos) {
if (Utils.isShallowLoc(slaveProperties, locNo)) {
continue;
@@ -409,13 +407,13 @@
locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
.eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("whs_type",rowLastnoType.getType().longValue()));
if (!Cools.isEmpty(locMast2)) {
- locMast = locMast2;
+ locMast = locMast1;
break;
} else {
locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
.eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("whs_type",rowLastnoType.getType().longValue()));
if (!Cools.isEmpty(locMast2)) {
- locMast = locMast2;
+ locMast = locMast1;
break;
}
}
@@ -439,7 +437,7 @@
// 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
if (times < rowCount*2) {
times = times + 1;
- return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
+ return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo,moveCrnNo, locTypeDto, times);
}
// // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
// if (locTypeDto.getLocType1() < 2) {
@@ -462,16 +460,7 @@
return startupDto;
}
- public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
- if (Cools.isEmpty(matnr)) { //鐗╂枡鍙�
- matnr = "";
- }
- if (Cools.isEmpty(batch)) { //鎵规
- batch = "";
- }
- if (Cools.isEmpty(grade)) { //澶囩敤
- grade = "";
- }
+ public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo,FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
// 鍒濆鍖栧弬鏁�
int crnNo = 0; //鍫嗗灈鏈哄彿
@@ -508,21 +497,19 @@
//姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿
for (int i = times; i < crnNumber*2; i++) {
int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
+ rowCount = locNecessaryParameters[0];
curRow = locNecessaryParameters[1];
crnNo = locNecessaryParameters[2];
- if (basCrnpService.checkSiteError(crnNo, true)) {
- rowCount = locNecessaryParameters[0];
- nearRow = locNecessaryParameters[3];
- List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
- .eq("crn_no", crnNo).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
- if (locMasts.size()<=5){
- times++;
- continue;
- }
- break;
- } else {
+ nearRow = locNecessaryParameters[3];
+ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+ .eq("crn_no", crnNo).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
+ if (locMasts.size()<=5){
+ nearRow = 0;
times++;
+ continue;
}
+ break;
+
}
if (crnNo == 0) {
throw new CoolException("鏃犲彲鐢ㄥ簱浣�");
@@ -530,9 +517,9 @@
// 鐩镐技宸ヤ綔妗f --- 鍚屽ぉ鍚岃鏍肩墿鏂�
- if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111) ) {
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && (staDescId == 1 || staDescId == 11 || staDescId == 111) ) {
//鏌ヨ鐩镐技宸ヤ綔妗f
- List<WrkMast> wrkMasts = wrkMastService.selectWrkMastWrkDetlMatnrBatch(staDescId, matnr, batch,grade, crnNo);
+ List<WrkMast> wrkMasts = wrkMastService.selectWrkMastWrkDetlMatnrBatch(staDescId, findLocNoAttributeVo.getMatnr(), findLocNoAttributeVo.getBatch(),findLocNoAttributeVo.getBrand(), crnNo);
int nearbay = 0; //鐩镐技宸ヤ綔妗f 鐩爣搴撲綅鍒�
int nearlev = 0; //鐩镐技宸ヤ綔妗f 鐩爣搴撲綅灞�
for (WrkMast wrkMast:wrkMasts){
@@ -579,9 +566,9 @@
//鑾峰彇搴撳瓨鏄庣粏
WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
//鍒ゆ柇鍚岃鏍肩墿鏂�
- if (!Cools.isEmpty(wrkDetl) && matnr.equals(wrkDetl.getMatnr())
- && batch.equals(batch.isEmpty() ? "":wrkDetl.getBatch())
- && grade.equals(grade.isEmpty()? "":wrkDetl.getBrand())){
+ if (!Cools.isEmpty(wrkDetl) && findLocNoAttributeVo.getMatnr().equals(wrkDetl.getMatnr())
+ && findLocNoAttributeVo.getBatch().equals(wrkDetl.getBatch())
+ && findLocNoAttributeVo.getBrand().equals(wrkDetl.getBrand())){
int row2=0;
if (Utils.getRow(locMast2.getLocNo())>nearRowW){
row2=Utils.getRow(locMast2.getLocNo())-1;
@@ -606,6 +593,8 @@
int nearbay = 0;
int nearlev = 0;
for (WrkMast wrkMast:wrkMasts){
+ int curRowW = curRow; //鐩镐技宸ヤ綔妗f 鏈�娣卞簱浣嶆帓
+ int nearRowW = nearRow; //鐩镐技宸ヤ綔妗f 鏈�娴呭簱浣嶆帓
if (Cools.isEmpty(wrkMast.getLocNo())){
continue;
}
@@ -625,17 +614,30 @@
// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow);
LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo());
- LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMastGro,rowLastnoType.getType().longValue());
+ for (int i = 0; i < crnNumber*2; i++) {
+ if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){
+ int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
+ curRowW = locNecessaryParameters[1];
+ nearRowW = locNecessaryParameters[3];
+ }else {
+ break;
+ }
+ }
- if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRow && locMast2.getLocSts().equals("S")){
+ LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue());
+
+ if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){
int row2=0;
- if (Utils.getRow(locMast2.getLocNo())>nearRow){
+ if (Utils.getRow(locMast2.getLocNo())>nearRowW){
row2=Utils.getRow(locMast2.getLocNo())-1;
}else {
row2=Utils.getRow(locMast2.getLocNo())+1;
}
String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2);
- locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo));
+ locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O"));
+ if (Cools.isEmpty(locMast)){
+ continue;
+ }
break;
}
}
@@ -647,15 +649,15 @@
if (Utils.BooleanWhsTypeStaIoType(rowLastno)){
// 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //鍒嗙鐗�
- if (!Cools.isEmpty(matnr) && staDescId == 1){
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1){
// signRule1 = true;
}
// 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //浜掗�氱増
- if (!Cools.isEmpty(matnr) && staDescId == 1) {
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1) {
signRule2 = true;
}
- if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) {
+ if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && (staDescId == 11 || staDescId == 111)) {
signRule1 = true;
}
}
@@ -671,9 +673,9 @@
LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("F")){
LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMastF.getLocNo()));
- if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())
- && batch.equals(batch.isEmpty() ? "" : locDetl.getBatch())
- && grade.equals(grade.isEmpty() ? "" : locDetl.getBrand())) {
+ if (!Cools.isEmpty(locDetl) && findLocNoAttributeVo.getMatnr().equals(locDetl.getMatnr())
+ && findLocNoAttributeVo.getBatch().equals(locDetl.getBatch())
+ && findLocNoAttributeVo.getBrand().equals(locDetl.getBrand())) {
//鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娣辩┖搴撲綅
locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
break;
@@ -682,65 +684,123 @@
}
}
}else if (signRule2){
- List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow);
+ List<String> locNos = locDetlService.getSameDetlToday(findLocNoAttributeVo.getMatnr(), sRow, eRow);
+ int nearbay = 0;
+ int nearlev = 0;
for (String locNo : locNos) {
- if (Utils.isShallowLoc(slaveProperties, locNo)) {
+ int curRowW = curRow; //鐩镐技宸ヤ綔妗f 鏈�娣卞簱浣嶆帓
+ int nearRowW = nearRow; //鐩镐技宸ヤ綔妗f 鏈�娴呭簱浣嶆帓
+ if (Cools.isEmpty(locNo)){
continue;
}
- String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
- // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
- LocMast shallowLoc = locMastService.selectById(shallowLocNo);
- if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
- if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
- if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
- locMast = shallowLoc;
- crnNo = locMast.getCrnNo();
- break;
- }
+ if (Utils.getRow(locNo)==nearRow){
+ continue;
+ }
+ if (Utils.getBay(locNo)==nearbay && Utils.getLev(locNo)==nearlev){
+ continue;
+ }else {
+ nearbay=Utils.getBay(locNo);
+ nearlev=Utils.getLev(locNo);
+ }
+// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow);
+ LocMast locMastGro = locMastService.selectById(locNo);
+
+ for (int i = 0; i < crnNumber*2; i++) {
+ if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){
+ int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
+ curRowW = locNecessaryParameters[1];
+ nearRowW = locNecessaryParameters[3];
+ }else {
+ break;
}
}
- }
- }
- // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //鍒嗙鐗�
- if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
- List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
- for (LocMast locMast1:locMasts){
- //鑾峰彇宸烽亾
-// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow);
- //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
- LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
- if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){
- //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
- locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
+ LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue());
+
+ if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){
+ int row2=0;
+ if (Utils.getRow(locMast2.getLocNo())>nearRowW){
+ row2=Utils.getRow(locMast2.getLocNo())-1;
+ }else {
+ row2=Utils.getRow(locMast2.getLocNo())+1;
+ }
+ String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2);
+ locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O"));
+ if (Cools.isEmpty(locMast)){
+ continue;
+ }
break;
}
}
}
-// // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増
-// if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) {
-// List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
-// if (locMasts.size() > 0) {
-// for (LocMast loc : locMasts) {
-// if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
-// continue;
-// }
-// String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
-// // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
-// LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-// if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
-// if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
-// if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
-// locMast = shallowLoc;
-// crnNo = locMast.getCrnNo();
-// break;
-// }
-// }
-// }
+// // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //鍒嗙鐗�
+// if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+// List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
+// for (LocMast locMast1:locMasts){
+// //鑾峰彇宸烽亾
+//// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow);
+// //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
+// LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
+// if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){
+// //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
+// locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
+// break;
// }
// }
// }
+
+ // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増
+ if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
+ int nearbay = 0;
+ int nearlev = 0;
+ for (LocMast locMastSign:locMasts){
+ int curRowW = curRow; //鐩镐技宸ヤ綔妗f 鏈�娣卞簱浣嶆帓
+ int nearRowW = nearRow; //鐩镐技宸ヤ綔妗f 鏈�娴呭簱浣嶆帓
+ if (Cools.isEmpty(locMastSign.getLocNo())){
+ continue;
+ }
+ if (Utils.getRow(locMastSign.getLocNo())==nearRow){
+ continue;
+ }
+ if (Utils.getBay(locMastSign.getLocNo())==nearbay && Utils.getLev(locMastSign.getLocNo())==nearlev){
+ continue;
+ }else {
+ nearbay=Utils.getBay(locMastSign.getLocNo());
+ nearlev=Utils.getLev(locMastSign.getLocNo());
+ }
+// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow);
+ LocMast locMastGro = locMastService.selectById(locMastSign.getLocNo());
+
+ for (int i = 0; i < crnNumber*2; i++) {
+ if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){
+ int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
+ curRowW = locNecessaryParameters[1];
+ nearRowW = locNecessaryParameters[3];
+ }else {
+ break;
+ }
+ }
+
+ LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue());
+
+ if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){
+ int row2=0;
+ if (Utils.getRow(locMast2.getLocNo())>nearRowW){
+ row2=Utils.getRow(locMast2.getLocNo())-1;
+ }else {
+ row2=Utils.getRow(locMast2.getLocNo())+1;
+ }
+ String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2);
+ locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O"));
+ if (Cools.isEmpty(locMast)){
+ continue;
+ }
+ break;
+ }
+ }
+ }
Wrapper<StaDesc> wrapper = null;
StaDesc staDesc = null;
@@ -754,14 +814,12 @@
.eq("crn_no", crnNo);
staDesc = staDescService.selectOne(wrapper);
if (Cools.isEmpty(staDesc)) {
- log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
-// throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
+ log.error("鍏ュ簱璺緞涓嶅瓨鍦�:type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
crnNo = 0;
}else {
staNo = basDevpService.selectById(staDesc.getCrnStn());
if (!staNo.getAutoing().equals("Y")) {
log.error("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
-// throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
crnNo = 0;
}
startupDto.setStaNo(staNo.getDevNo());
@@ -787,9 +845,6 @@
continue;
}
if (Utils.BooleanWhsTypeStaIoType(rowLastno)){
-// String shallowLoc = Utils.getDeepLocYTl(slaveProperties, locMast1.getLocNo());
-// LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
-// .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
//鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娣辩┖搴撲綅
LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
if (!Cools.isEmpty(locMast2) && locMast2.getBay1()==curRow) {
@@ -830,21 +885,6 @@
}
}
}
-
-// //鏈壘鍒� 鎵剧涓�鎺�
-// if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)){
-// locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-// .eq("row1", 1)
-// .eq("loc_sts", "O")
-// .orderBy("lev1",true).orderBy("bay1",true));
-// for (LocMast locMast1 : locMasts) {
-// if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
-// continue;
-// }
-// locMast = locMast1;
-// break;
-// }
-// }
}
// 閫掑綊鏌ヨ
@@ -852,14 +892,8 @@
// 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
if (times < rowCount*2) {
times = times + 1;
- return getLocNoRun4(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
+ return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo,moveCrnNo, locTypeDto, times);
}
-// // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
-// if (locTypeDto.getLocType1() < 2) {
-// int i = locTypeDto.getLocType1() + 1;
-// locTypeDto.setLocType1((short)i);
-// return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, 0);
-// }
log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
throw new CoolException("娌℃湁绌哄簱浣�");
}
@@ -874,16 +908,7 @@
startupDto.setLocNo(locNo);
return startupDto;
}
- public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
- if (Cools.isEmpty(matnr)) { //鐗╂枡鍙�
- matnr = "";
- }
- if (Cools.isEmpty(batch)) { //鎵规
- batch = "";
- }
- if (Cools.isEmpty(grade)) { //澶囩敤
- grade = "";
- }
+ public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo,FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
// 鍒濆鍖栧弬鏁�
int crnNo = 0; //鍫嗗灈鏈哄彿
@@ -913,21 +938,11 @@
}
//姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿
- for (int i = times; i < crnNumber*2; i++) {
- int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
- curRow = locNecessaryParameters[1];
- crnNo = locNecessaryParameters[2];
- if (basCrnpService.checkSiteError(crnNo, true)) {
- rowCount = locNecessaryParameters[0];
- nearRow = locNecessaryParameters[3];
- break;
- } else {
- times++;
- }
- }
- if (crnNo == 0) {
- throw new CoolException("鏃犲彲鐢ㄥ簱浣�");
- }
+ int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
+ curRow = locNecessaryParameters[1];
+ crnNo = locNecessaryParameters[2];
+ rowCount = locNecessaryParameters[0];
+ nearRow = locNecessaryParameters[3];
Wrapper<StaDesc> wrapper = null;
StaDesc staDesc = null;
@@ -989,7 +1004,7 @@
// 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
if (times < rowCount*2) {
times = times + 1;
- return getLocNoRun5(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
+ return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo,moveCrnNo, locTypeDto, times);
}
log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
throw new CoolException("娌℃湁绌哄簱浣�");
--
Gitblit v1.9.1