src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/utils/Utils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/utils/VersionUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/common/service/CommonService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/service/impl/BasCrnpServiceImpl.java
@@ -41,7 +41,7 @@ public boolean checkSiteError(Integer crnNo, boolean pakin) { BasCrnp crnp = this.selectById(crnNo); if (Cools.isEmpty(crnp)) { log.error("{}号堆垛机不存在", crnNo); // log.error("{}号堆垛机不存在", crnNo); return false; } if (crnp.getCrnErr() != null && crnp.getCrnSts() != 3){ @@ -56,52 +56,8 @@ } if (pakin) { // //TODO控制入库暂存数,防止主干道堵塞,2022-5-24 ADD // int staNo = 0; // switch (crnNo){ // case 1: // staNo = 123; // break; // case 2: // staNo = 121; // break; // case 3: // staNo = 119; // break; // case 4: // staNo = 117; // break; // case 5: // staNo = 115; // break; // case 6: // staNo = 113; // break; // case 7: // staNo = 111; // break; // case 8: // staNo = 109; // break; // case 9: // staNo = 106; // break; // case 10: // staNo = 105; // break; // case 11: // staNo = 103; // break; // case 12: // staNo = 101; // break; // } //控制入库暂存数,防止主干道堵塞,2022-10-23 ADD 未实装 // int maxCount = 2; // BasDevp devp = basDevpService.selectById(staNo); // if(!Cools.isEmpty(devp)){ // maxCount = devp.getInQty(); // } // // int storeCount = wrkMastService.getStoreCount(crnNo); // // if(storeCount >= maxCount){ src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -91,7 +91,7 @@ // 检索库位 LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs, locTypeDto, 0); StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matnrs.get(0), null, null,locTypeDto,0); // 生成工作号 int workNo = dto.getWorkNo(); // 生成工作档 @@ -371,7 +371,7 @@ BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); // 检索库位 LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, locTypeDto, 0); StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null,null,null, locTypeDto, 0); int workNo = dto.getWorkNo(); Date now = new Date(); // 生成工作档 src/main/java/com/zy/asrs/utils/Utils.java
@@ -2,6 +2,7 @@ import com.core.common.Arith; import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.common.properties.SlaveProperties; import java.text.DecimalFormat; @@ -195,4 +196,71 @@ System.out.println(deepRow); } public static boolean BooleanWhsTypeSta(Integer whsType){ if (whsType==1){ return true; } return false; } public static boolean BooleanWhsTypeSta(Integer whsType, Integer staDescId){ if (whsType==1 && staDescId!=11 && staDescId!=111){ return true; } return false; } public static int RowCount(Integer whsType,Integer curRow,Integer crnNumber){ return LocNecessaryParameters(whsType, curRow,crnNumber)[0]; } public static int getCurRow(Integer whsType,Integer curRow,Integer crnNumber){ return LocNecessaryParameters(whsType, curRow,crnNumber)[1]; } public static int getCrnNo(Integer whsType,Integer curRow,Integer crnNumber){ return LocNecessaryParameters(whsType, curRow,crnNumber)[2]; } public static int getNearRow(Integer whsType,Integer curRow,Integer crnNumber){ return LocNecessaryParameters(whsType, curRow,crnNumber)[3]; } //库位排号分配 public static int[] LocNecessaryParameters(Integer whsType,Integer curRow,Integer crnNumber){ return LocNecessaryParametersDoubleExtension(whsType, curRow,crnNumber); } //经典双伸库位 public static int[] LocNecessaryParametersDoubleExtension(Integer whsType,Integer curRow,Integer crnNumber){ int[] necessaryParameters=new int[]{0,0,0,0}; if (BooleanWhsTypeSta(whsType)){ necessaryParameters[0] = crnNumber; //满板正常入库 if (curRow.equals(crnNumber*4)){ necessaryParameters[1] = 1; //curRow 最深库位排 necessaryParameters[2] = 1; //crnNo 堆垛机号 necessaryParameters[3] = 2; //nearRow 最浅库位排 }else if (curRow.equals(crnNumber*4-3)){ necessaryParameters[1] = 4; //curRow 最深库位排 necessaryParameters[2] = 1; //crnNo 堆垛机号 necessaryParameters[3] = 3; //nearRow 最浅库位排 }else { curRow=curRow+4; if (curRow<1 || curRow > (crnNumber*4)){ throw new CoolException("库位排号异常:排号:"+curRow); } if ((curRow-1)%4==0){ necessaryParameters[1] = curRow; //curRow 最深库位排 necessaryParameters[2] = (curRow+3)/4; //crnNo 堆垛机号 necessaryParameters[3] = curRow+1; //nearRow 最浅库位排 }else if (curRow%4==0){ necessaryParameters[1] = curRow; //curRow 最深库位排 necessaryParameters[2] = curRow/4; //crnNo 堆垛机号 necessaryParameters[3] = curRow-1; //nearRow 最浅库位排 }else { throw new CoolException("库位排号异常:排号:"+curRow); } } } return necessaryParameters; } } src/main/java/com/zy/asrs/utils/VersionUtils.java
@@ -10,124 +10,9 @@ */ public class VersionUtils { // 业务 ---------------------------------------------------------------------- // public static void setWrkDetl(WrkDetl wrkDetl, Mat mat) { // wrkDetl.setMatnr(matCode.getMatNo()); // 物料编号 // wrkDetl.setMaktx(matCode.getMatName()); // 物料描述 // wrkDetl.setLgnum(matCode.getStr2()); // 规格 // wrkDetl.setType(matCode.getStr5()); // 型号 // wrkDetl.setColor(matCode.getBarcode()); // 条码 // wrkDetl.setSupplier(matCode.getStr6()); // 序列码 // wrkDetl.setWarehouse(matCode.getStr7()); // 单据编号 // wrkDetl.setBrand(matCode.getStr3()); // 品项数 // wrkDetl.setAltme(matCode.getStr1()); // 单位 // wrkDetl.setBname(matCode.getStr4()); // 客户名称 // } // // public static void setWrkDetl(WrkDetl wrkDetl, LocDetl locDetl) { // wrkDetl.setMatnr(locDetl.getMatnr()); // 物料编号 // wrkDetl.setMaktx(locDetl.getMaktx()); // 物料描述w // wrkDetl.setBatch(locDetl.getBatch()); // wrkDetl.setOrderNo(locDetl.getOrderNo()); // wrkDetl.setLgnum(locDetl.getLgnum()); // 规格 // wrkDetl.setType(locDetl.getType()); // 型号 // wrkDetl.setColor(locDetl.getColor()); // 条码 // wrkDetl.setSupplier(locDetl.getSupplier()); // 序列码 // wrkDetl.setWarehouse(locDetl.getWarehouse()); // 单据编号 // wrkDetl.setBrand(locDetl.getBrand()); // 品项数 // wrkDetl.setAltme(locDetl.getAltme()); // 单位 // wrkDetl.setBname(locDetl.getBname()); // 客户名称 // wrkDetl.setZpallet(locDetl.getZpallet()); // 托盘条码 // } // // public static void setLocDetl(LocDetl locDetl, MatCode matCode) { // locDetl.setMatnr(matCode.getMatNo()); // 物料编号 // locDetl.setMaktx(matCode.getMatName()); // 物料描述 // locDetl.setLgnum(matCode.getStr2()); // 规格 // locDetl.setType(matCode.getStr5()); // 型号 // locDetl.setColor(matCode.getBarcode()); // 条码 // locDetl.setSupplier(matCode.getStr6()); // 序列码 // locDetl.setWarehouse(matCode.getStr7()); // 单据编号 // locDetl.setBrand(matCode.getStr3()); // 品项数 // locDetl.setAltme(matCode.getStr1()); // 单位 // locDetl.setBname(matCode.getStr4()); // 客户名称 // } // // public static void setLocDetl(LocDetl locDetl, WrkDetl wrkDetl) { // locDetl.setMatnr(wrkDetl.getMatnr()); // 物料编号 // locDetl.setMaktx(wrkDetl.getMaktx()); // 物料描述 // locDetl.setBatch(wrkDetl.getBatch()); // locDetl.setOrderNo(wrkDetl.getOrderNo()); // locDetl.setLgnum(wrkDetl.getLgnum()); // 规格 // locDetl.setType(wrkDetl.getType()); // 型号 // locDetl.setColor(wrkDetl.getColor()); // 条码 // locDetl.setSupplier(wrkDetl.getSupplier()); // 序列码 // locDetl.setWarehouse(wrkDetl.getWarehouse()); // 单据编号 // locDetl.setBrand(wrkDetl.getBrand()); // 品项数 // locDetl.setAltme(wrkDetl.getAltme()); // 单位 // locDetl.setBname(wrkDetl.getBname()); // 客户名称 // locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 // } // // public static void setWaitPakIn(WaitPakin waitPakIn, MatCode matCode) { // waitPakIn.setMatnr(matCode.getMatNo()); // 物料编号 // waitPakIn.setMaktx(matCode.getMatName()); // 物料描述 // waitPakIn.setLgnum(matCode.getStr2()); // 规格 // waitPakIn.setType(matCode.getStr5()); // 型号 // waitPakIn.setColor(matCode.getBarcode()); // 条码 // waitPakIn.setSupplier(matCode.getStr6()); // 序列码 // waitPakIn.setWarehouse(matCode.getStr7()); // 单据编号 // waitPakIn.setBrand(matCode.getStr3()); // 品项数 // waitPakIn.setAltme(matCode.getStr1()); // 单位 // waitPakIn.setBname(matCode.getStr4()); // 客户名称 // } // // public static void setOrderDetl(OrderDetl orderDetl, MatCode matCode) { // orderDetl.setMatnr(matCode.getMatNo()); // 物料编号 // orderDetl.setMaktx(matCode.getMatName()); // 物料描述 // orderDetl.setSpecs(matCode.getStr2()); // 规格 // orderDetl.setSupplier(matCode.getStr6()); // 序列码 // } // // public static void setWaitPakIn(WaitPakin waitPakIn, OrderDetl orderDetl) { // waitPakIn.setMatnr(orderDetl.getMatnr()); // 物料编号 // waitPakIn.setMaktx(orderDetl.getMaktx()); // 物料描述 // waitPakIn.setBatch(orderDetl.getBatch()); // waitPakIn.setOrderNo(orderDetl.getOrderNo()); // waitPakIn.setLgnum(orderDetl.getSpecs()); // 规格 // waitPakIn.setType(orderDetl.getModel()); // 型号 // waitPakIn.setSupplier(orderDetl.getSupplier()); // 序列码 // waitPakIn.setAltme(orderDetl.getUnit()); // 单位 // } // // public static void setWrkDetl(WrkDetl wrkDetl, OrderDetl orderDetl) { // wrkDetl.setMatnr(orderDetl.getMatnr()); // 物料编号 // wrkDetl.setMaktx(orderDetl.getMaktx()); // 物料描述 // wrkDetl.setBatch(orderDetl.getBatch()); // wrkDetl.setOrderNo(orderDetl.getOrderNo()); // wrkDetl.setLgnum(orderDetl.getSpecs()); // 规格 // wrkDetl.setType(orderDetl.getModel()); // 型号 // wrkDetl.setSupplier(orderDetl.getSupplier()); // 序列码 // wrkDetl.setAltme(orderDetl.getUnit()); // 单位 // } public static void setPakin(Pakin pakin, Mat mat) { pakin.setMatnr(mat.getMatnr()); pakin.setMaktx(mat.getMaktx()); pakin.setName(mat.getName()); pakin.setSpecs(mat.getSpecs()); pakin.setModel(mat.getModel()); pakin.setUnit(mat.getUnit()); pakin.setBarcode(mat.getBarcode()); pakin.setItemNum(Integer.valueOf(mat.getItemNum())); pakin.setPrice(mat.getPrice()); pakin.setWeight(mat.getWeight()); } /** * 库位移转时类型检测 * 兼容版 **/ public static boolean locMoveCheckLocType(LocMast loc, LocTypeDto dto) { // 如果源库位是高库位,目标库位是低库位 @@ -137,4 +22,13 @@ return true; } /** * 类型检测 * 完全检测 **/ public static boolean locMoveCheckLocTypeComplete(LocMast loc, LocTypeDto dto) { // 如果源库位是高库位,目标库位是低库位 return dto.getLocType1().equals(loc.getLocType1()); } } src/main/java/com/zy/common/service/CommonService.java
@@ -90,47 +90,88 @@ /** * 检索库位号 * @param whsType 类型 1:双深式货架 * @param staDescId 路径工作类型 * @param staDescId 路径ID * @param sourceStaNo 源站 * @param matNos 商品编号集合 * @param matnr 物料号集合 * @return locNo 检索到的库位号 */ @Transactional public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch,String grade,LocTypeDto locTypeDto, int times) { if (Cools.isEmpty(matnr)){ //物料号 matnr=""; } if (Cools.isEmpty(batch)){ //箱号 batch=""; } if (Cools.isEmpty(grade)){ //备用 grade=""; } if (sourceStaNo < 200){ whsType = 1; } else if (sourceStaNo > 199 && sourceStaNo < 300){ whsType = 2; } else if (sourceStaNo > 299){ whsType = 3; } // 目标堆垛机号 int crnNo = whsType; if (!basCrnpService.checkSiteError(crnNo, true)){ throw new CoolException("没有可用的堆垛机"); } // 初始化参数 int crnNo = 0; //堆垛机号 int nearRow = 0; //最浅库位排 int curRow = 0; //最深库位排 int rowCount = 0; //轮询轮次 LocMast locMast = null; // 目标库位 StartupDto startupDto = new StartupDto(); RowLastno rowLastno = rowLastnoService.selectById(whsType); int sRow = rowLastno.getsRow(); int eRow = rowLastno.geteRow(); int crnNumber = rowLastno.getCrnQty(); if (Cools.isEmpty(rowLastno)) { throw new CoolException("数据异常,请联系管理员"); } // ===============>>>> 开始执行 int curRow = rowLastno.getCurrentRow(); int sRow = rowLastno.getsRow(); int eRow = rowLastno.geteRow(); int crn_qty = rowLastno.getCrnQty(); int rowCount = eRow - sRow + 1; curRow = rowLastno.getCurrentRow(); // 目标库位 LocMast locMast = null; int[] locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow,crnNumber); rowCount=locNecessaryParameters[0]; curRow=locNecessaryParameters[1]; crnNo=locNecessaryParameters[2]; nearRow=locNecessaryParameters[3]; if (!basCrnpService.checkSiteError(crnNo,true)){ //此程序用于优化堆垛机异常时的运行时间 times++; for (int i=times;i<Utils.RowCount(whsType,curRow,crnNumber);i++){ locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow,crnNumber); rowCount=locNecessaryParameters[0]; curRow=locNecessaryParameters[1]; crnNo=locNecessaryParameters[2]; nearRow=locNecessaryParameters[3]; if (basCrnpService.checkSiteError(crnNo,true)){ break; }else { times++; } } if (times==Utils.RowCount(whsType,curRow,crnNumber)){ throw new CoolException("无可用堆垛机"); } } // 靠近摆放规则 --- 同天同规格物料 if (!Cools.isEmpty(matNos)) { List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow); // // 靠近摆放规则 --- 同天同规格物料 //分离版 // if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111)) { // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); // for (LocMast locMast1:locMasts){ // if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { // continue; // } // String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc)); // if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ // LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); // if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { // locMast = locMast1; // break; // } // } // } // } // 靠近摆放规则 --- 同天同规格物料 //互通版 if (!Cools.isEmpty(matnr) && (staDescId == 1 || staDescId == 11 || staDescId == 111)) { List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow); for (String locNo : locNos) { if (Utils.isShallowLoc(slaveProperties, locNo)) { continue; @@ -139,9 +180,10 @@ // 检测目标库位是否为空库位 LocMast shallowLoc = locMastService.selectById(shallowLocNo); if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) { if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { locMast = shallowLoc; crnNo = locMast.getCrnNo(); break; } } @@ -149,7 +191,23 @@ } } // 靠近摆放规则 --- 空托 // // 靠近摆放规则 --- 空托 //分离版 // if (staDescId == 10) { // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); // for (LocMast locMast1:locMasts){ // if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { // continue; // } // String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc)); // if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("D")){ // locMast = locMast1; // break; // } // } // } // 靠近摆放规则 --- 空托 //互通版 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) { @@ -161,88 +219,83 @@ // 检测目标库位是否为空库位 LocMast shallowLoc = locMastService.selectById(shallowLocNo); if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { locMast = shallowLoc; break; if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { locMast = shallowLoc; crnNo = locMast.getCrnNo(); break; } } } } } } // 如果没有相近物料,则按规则轮询货架 if (null == locMast){ curRow = getCurRow(curRow); } Wrapper<StaDesc> wrapper = null; StaDesc staDesc = null; BasDevp staNo = null; // 获取目标站 Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() .eq("type_no", staDescId) .eq("stn_no", sourceStaNo) .eq("crn_no", crnNo); StaDesc staDesc = staDescService.selectOne(wrapper); if (Cools.isEmpty(staDesc)) { log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); throw new CoolException("入库路径不存在"); } BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn()); if (!staNo.getAutoing().equals("Y")) { throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); if (Utils.BooleanWhsTypeSta(whsType,staDescId)){ // 获取目标站 wrapper = new EntityWrapper<StaDesc>() .eq("type_no", staDescId) .eq("stn_no", sourceStaNo) .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("入库路径不存在"); crnNo=0; } staNo = basDevpService.selectById(staDesc.getCrnStn()); if (!staNo.getAutoing().equals("Y")) { // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); crnNo=0; } startupDto.setStaNo(staNo.getDevNo()); } // 更新库位排号 rowLastno.setCurrentRow(curRow); rowLastnoService.updateById(rowLastno); if (Utils.BooleanWhsTypeSta(whsType,staDescId)){ rowLastno.setCurrentRow(curRow); 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 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D) // 因库位移转、需预留空库位 if (!locMastService.checkEmptyCount(locMast)) { locMast = null; // 1.按规则查找库位 if (Cools.isEmpty(locMast) && crnNo!=0){ List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); for (LocMast locMast1:locMasts){ if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { continue; } } if (Cools.isEmpty(locMast)) { locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); // 因库位移转、需预留空库位 if (!locMastService.checkEmptyCount(locMast)) { locMast = null; } // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo())); if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { locMast = null; } } // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) { LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo())); if (!shallowLoc.getLocSts().equals("O")) { locMast = null; } String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc).eq("loc_sts","O")); if (!Cools.isEmpty(locMast2)){ locMast = locMast2; break; } } } // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 if (Cools.isEmpty(locMast)) { if (!Cools.isEmpty(locMast) && !basCrnpService.checkSiteError(crnNo,true)){ locMast = null; } // 递归查询 if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 if (times < rowCount) { times = times + 1; return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, times); } // 轻货物找轻库位为空时,可以去找重库位仓 if (locTypeDto.getLocType1() == 1) { locTypeDto.setLocType1((short) 2); return getLocNo(1, staDescId, sourceStaNo, matNos, 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, times); // } log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); throw new CoolException("没有空库位"); } @@ -254,37 +307,7 @@ startupDto.setWorkNo(workNo); startupDto.setCrnNo(crnNo); startupDto.setSourceStaNo(sourceStaNo); startupDto.setStaNo(staNo.getDevNo()); startupDto.setLocNo(locNo); 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"); } return msgBuilder.toString(); } } /** * 根据入库站获取库位排号分配 */ private Integer getCurRow(Integer curRow) { if (Utils.isDeepLocLeft(slaveProperties,curRow)){ curRow=curRow+3; }else if (Utils.isDeepLocLeft(slaveProperties,curRow-1)){ curRow=curRow+1; }else { curRow=curRow-2; } return curRow; } } src/main/resources/application.yml
@@ -50,7 +50,6 @@ # 双深 doubleDeep: true # 双深库位排号 # doubleLocs: 1,4,11,14,21,24 doubleLocs: 1,4,5,8,9,12,13,16 # 一个堆垛机负责的货架排数 groupCount: 4 @@ -67,7 +66,7 @@ # 开关 switch: #获取单据开关 InboundOrderSwitch: false InboundOrderSwitch: true #登录接口开关 LoginAuthenticationSwitch: false #上报、审核单据开关