From 0e370ca374b0d0b15c0f4c92aff576c9e7de0fa1 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期六, 11 二月 2023 11:18:31 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/service/CommonService.java | 124 +++++++++++++---------------------------- 1 files changed, 40 insertions(+), 84 deletions(-) diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java index e87acc2..d27601c 100644 --- a/src/main/java/com/zy/common/service/CommonService.java +++ b/src/main/java/com/zy/common/service/CommonService.java @@ -3,20 +3,17 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; -import com.core.common.Arith; import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.asrs.entity.*; import com.zy.asrs.service.*; -import com.zy.asrs.utils.Utils; -import com.zy.asrs.utils.VersionUtils; import com.zy.common.entity.Parameter; import com.zy.common.model.LocTypeDto; -import com.zy.common.model.Shelves; import com.zy.common.model.StartupDto; import com.zy.common.properties.SlaveProperties; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -48,6 +45,10 @@ private LocDetlService locDetlService; @Autowired private SlaveProperties slaveProperties; + @Value("${channel.channelMax}") + private Integer channelMax; + @Value("${channel.equipmentCount}") + private Integer equipmentCount; /** * 鐢熸垚宸ヤ綔鍙� @@ -98,9 +99,13 @@ */ @Transactional public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { -// whsType = getWhsType(sourceStaNo, times); - StartupDto startupDto = new StartupDto(); + if (sourceStaNo.equals(100)){ + whsType=1; + }else if (sourceStaNo.equals(200)){ + whsType=2; + } + StartupDto startupDto = new StartupDto(); RowLastno rowLastno = rowLastnoService.selectById(whsType); if (Cools.isEmpty(rowLastno)) { throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�"); @@ -111,52 +116,18 @@ int sRow = rowLastno.getsRow(); int eRow = rowLastno.geteRow(); int crn_qty = rowLastno.getCrnQty(); - int rowCount = eRow - sRow + 1; + int rowCount = eRow - sRow; // 鐩爣鍫嗗灈鏈哄彿 int crnNo = crn_qty; // 鐩爣搴撲綅 LocMast locMast = null; - // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋� - if (null == locMast) { - switch (curRow){ - case 2: - curRow = 4; - break; - case 4: - curRow = 6; - break; - case 6: - curRow = 8; - break; - case 8: - curRow = 10; - break; - case 10: - curRow = 12; - break; - case 12: - curRow = 3; - break; - case 3: - curRow = 5; - break; - case 5: - curRow = 7; - break; - case 7: - curRow = 9; - break; - case 9: - curRow = 11; - break; - case 11: - curRow = 13; - break; - case 13: - curRow = 2; - break; - } + if (curRow==3){ + curRow=4; + }else if (curRow==4){ + curRow=3; + }else { + rowCount=0; } if (crnNo == 0) { @@ -182,33 +153,19 @@ rowLastnoService.updateById(rowLastno); // 寮�濮嬫煡鎵惧簱浣� ==============================>> - - // 1.褰撴绱㈠簱鎺掍负娴呭簱浣嶆帓鏃讹紝浼樺厛瀵绘壘褰撳墠搴撴帓鐨勬繁搴撲綅鎺� -// if (locMast == null) { -// if (Utils.isShallowLoc(slaveProperties, curRow)) { -// Integer deepRow = Utils.getDeepRow(slaveProperties, curRow); -// locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1()); -// // todo:luxiaotao 濡傛灉鐢ㄦ祬鎺掓壘鍒扮殑娣卞簱浣嶏紝閭d箞鍒欓渶瑕佸垽鏂繖涓繁搴撲綅瀵瑰簲鐨勬祬搴撲綅鏄惁鏈夎揣锛團銆乆銆丏锛� -// // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣� -// if (!locMastService.checkEmptyCount(locMast)) { -// locMast = null; -// } -// } - if (Cools.isEmpty(locMast)) { - - Integer ruleId = Integer.parseInt(Parameter.get().getFindLocRule()); - if (ruleId == 0){//榛樿瑙勫垯 - locMast = locMastService.queryFreeLocMast(1, locTypeDto.getLocType1()); - } else if (ruleId == 1){ //鎸夋祴璇曡澶囨帓搴忥紝浼樺厛鎺掓弧鍗曞彴璁惧 - locMast = locMastService.queryFreeLocMast1(1, locTypeDto.getLocType1()); - } else if (ruleId == 2){//鎸夐�氶亾鎺掑簭锛屽潎鍖�鍒嗛厤姣忓彴璁惧 - locMast = locMastService.queryFreeLocMast2(1, locTypeDto.getLocType1(), curRow); - } else { - locMast = locMastService.queryFreeLocMast(1, locTypeDto.getLocType1()); - } - + if (Cools.isEmpty(locMast)) { + Integer 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.queryFreeLocMast2(curRow, locTypeDto.getLocType1(),(short)0); } -// } + } // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣� if (Cools.isEmpty(locMast)) { @@ -234,19 +191,18 @@ return startupDto; } - - public static String zerofill(String msg, Integer count) { - if (msg.length() == count) { - return msg; - } else if (msg.length() > count) { - return msg.substring(0, 16); - } else { - StringBuilder msgBuilder = new StringBuilder(msg); - for(int i = 0; i < count - msg.length(); ++i) { - msgBuilder.insert(0, "0"); + public Short getLocType2Small(Integer curRow,short locType1){ + Integer OCount = locMastService.queryFreeLocMastCount(curRow, locType1, (short)1); + Short locType2=1; + for (int i=2;i<equipmentCount+1;i++){ + Integer integer =locMastService.queryFreeLocMastCount(curRow, locType1, (short)i); + if (OCount<integer){ + OCount=integer; + locType2=(short)i; } - return msgBuilder.toString(); } + + return locType2; } } -- Gitblit v1.9.1