From 288e45a990a5abf4ab50f820ed4e870e8314468e Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期六, 21 六月 2025 15:14:10 +0800 Subject: [PATCH] 完善 --- src/main/java/com/zy/common/service/CommonService.java | 114 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 71 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java index 1528742..6437d04 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.exception.CoolException; import com.zy.asrs.entity.*; import com.zy.asrs.service.*; +import com.zy.asrs.utils.Utils; import com.zy.common.entity.Parameter; import com.zy.common.model.LocTypeDto; import com.zy.common.model.StartupDto; @@ -102,14 +103,8 @@ @Transactional public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { - if (sourceStaNo.equals(202)) { - whsType = 1; - locTypeDto.setLocType1((short) 1); - } else if (sourceStaNo.equals(209)) { - whsType = 2; - locTypeDto.setLocType1((short) 2); - } - + whsType = 1; + locTypeDto.setLocType1((short) 1); StartupDto startupDto = new StartupDto(); RowLastno rowLastno = rowLastnoService.selectById(whsType); if (Cools.isEmpty(rowLastno)) { @@ -126,16 +121,6 @@ int crnNo = crn_qty; // 鐩爣搴撲綅 LocMast locMast = null; - - crnNo=2; - if (curRow == 3) { - curRow = 4; - } else if (curRow == 4) { - curRow = 3; - } else { - rowCount = 0; - crnNo=1; - } if (crnNo == 0) { throw new CoolException("娌℃湁鍙敤鐨勫爢鍨涙満"); @@ -160,38 +145,81 @@ rowLastnoService.updateById(rowLastno); if (crnNo==1){ - LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").eq("loc_type2", (short) 3)); - if (!Cools.isEmpty(locMast1)){ - locMast = locMastService.queryFreeLocMast(2,(short)3); - if (Cools.isEmpty(locMast)){ - locMast = locMastService.queryFreeLocMast(1,(short)3); + LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() + .eq("loc_sts", "F") + .eq("loc_type1", (short) 3));//寰呮祴搴撲綅 + LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() + .eq("loc_sts", "O") + .eq("loc_type1", (short) 1));//娴嬭瘯搴撲綅 + if (!Cools.isEmpty(locMast1)||Cools.isEmpty(locMast2)){ + List<LocMast> locMasts=locMastService.selectList(new EntityWrapper<LocMast>() + .eq("loc_sts", "O").eq("loc_type1", (short) 3) + .orderBy("row1",false).orderBy("bay1",true)); + if(!Cools.isEmpty(locMasts)){ + locMast = locMasts.get(0); + }else{ + throw new CoolException("娌℃湁寰呮祴搴撲綅鏃犳硶鍏ュ簱锛侊紒锛�"); + } + } + } + // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 + if (staDescId == 10) { + 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 (shallowLoc.getLocType1()<locTypeDto.getLocType1()){ + continue; + } + if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { + locMast = shallowLoc; + crnNo = locMast.getCrnNo(); + break; + } + } + } + } + if (Cools.isEmpty(locMast)) { + List<LocMast> locMastList3 = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("loc_sts", "O") + .eq("row1",3) + .notIn("loc_type1",1)); + if (!Cools.isEmpty(locMastList3)) { + locMast = locMastList3.get(0); + }else { + List<LocMast> locMastList1 = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("loc_sts", "O") + .eq("row1",1) + .notIn("loc_type1",1)); + if (!Cools.isEmpty(locMastList1)) { + locMast = locMastList1.get(0); + } } } } if (Cools.isEmpty(locMast)){ - // 寮�濮嬫煡鎵惧簱浣� ==============================> - int ruleId = Integer.parseInt(Parameter.get().getFindLocRule()); - if (whsType != 1) { - locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); - } else if (ruleId == 1) { //鎸夋祴璇曡澶囨帓搴忥紝浼樺厛鎺掓弧鍗曞彴璁惧 - locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1(), channelMax + 1); - } else if (ruleId == 2) { //鎸夐�氶亾鎺掑簭锛屽潎鍖�鍒嗛厤姣忓彴璁惧 - Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1()); - locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(), locType2); - } else { //榛樿瑙勫垯 - locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); - } + locMast = locMastService.queryFreeLocMast(1, locTypeDto.getLocType1()); +// // 寮�濮嬫煡鎵惧簱浣� ==============================> +// int ruleId = Integer.parseInt(Parameter.get().getFindLocRule()); +// if (whsType != 1) { +// locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); +// } else if (ruleId == 1) { //鎸夋祴璇曡澶囨帓搴忥紝浼樺厛鎺掓弧鍗曞彴璁惧 +// locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1(), channelMax + 1); +// } else if (ruleId == 2) { //鎸夐�氶亾鎺掑簭锛屽潎鍖�鍒嗛厤姣忓彴璁惧 +// Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1()); +// locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(), locType2); +// } else { //榛樿瑙勫垯 +// locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); +// } } - - // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣� if (Cools.isEmpty(locMast)) { - // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊 - if (times < rowCount) { - times = times + 1; - return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); - } - log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times); throw new CoolException("娌℃湁绌哄簱浣�"); } String locNo = locMast.getLocNo(); -- Gitblit v1.9.1