From 2b152a1539268209e3f9b379e19ecd287eec6f6f Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期三, 18 十二月 2024 08:38:53 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/service/CommonService.java | 95 ++++++++++++++++++----------------------------- 1 files changed, 37 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java index 2a10d14..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; //鍫嗗灈鏈哄彿 @@ -239,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; } } @@ -264,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; @@ -275,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; @@ -441,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) { @@ -464,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; //鍫嗗灈鏈哄彿 @@ -517,6 +504,7 @@ 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; } @@ -529,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){ @@ -578,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; @@ -661,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; } } @@ -685,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; @@ -696,7 +684,7 @@ } } }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) { @@ -904,7 +892,7 @@ // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊 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); } log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times); throw new CoolException("娌℃湁绌哄簱浣�"); @@ -920,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; //鍫嗗灈鏈哄彿 @@ -1025,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