| | |
| | | } |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | // 库区锁定 |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null, start, end); |
| | | if (!Cools.isEmpty(locRule)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1() |
| | | , locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | for (LocMast one : locMasts) { |
| | | List<String> groupLoc = Utils.getGroupLoc(one.getLocNo()); |
| | | LocMast locMast0 = locMastService.findOutMost(groupLoc); |
| | | if (null != locMast0) { |
| | | // 浅库位符合尺寸检测 |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | int currentRow = 1; |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | |
| | | |
| | | // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排 |
| | | if (locMast == null) { |
| | | |
| | | // 库区锁定 |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null, start, end); |
| | | if (!Cools.isEmpty(locRule)) { |
| | | // plan first |
| | | // List<Integer> rows = Utils.getGroupLoc(locRule.getRowBeg()); |
| | | // List<LocMast> locMasts = locMastService.queryFreeLocMast1(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday |
| | | // , locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | // if (!Cools.isEmpty(locMasts)) { |
| | | // Integer innermostRow = Utils.getInnermostRow(locMasts.get(0).getLocNo()); |
| | | // for (LocMast one : locMasts) { |
| | | // if (one.getRow1().equals(innermostRow)) { |
| | | // locMast = one; |
| | | // crnNo = locMast.getCrnNo(); |
| | | // 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("入库路径不存在, staDescId={}, sourceStaNo={}, crnNo={}", staDescId, sourceStaNo, crnNo); |
| | | // throw new CoolException("入库路径不存在"); |
| | | // } |
| | | // // 检测目标站 |
| | | // staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | // if (!staNo.getAutoing().equals("Y")) { |
| | | // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | // } |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // plan second |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1() |
| | | , locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | List<Integer> rows = Utils.getGroupLoc(curRow); |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast0(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday); |
| | | if (!Cools.isEmpty(locMasts)) { |
| | | Integer innermostRow = Utils.getInnermostRow(locMasts.get(0).getLocNo()); |
| | | for (LocMast one : locMasts) { |
| | | |
| | | } |
| | | } |
| | | |
| | | if (locMast == null) { |
| | | List<Integer> rows = Utils.getGroupLoc(curRow); |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast0(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday); |
| | | if (!Cools.isEmpty(locMasts)) { |
| | | Integer innermostRow = Utils.getInnermostRow(locMasts.get(0).getLocNo()); |
| | | for (LocMast one : locMasts) { |
| | | if (one.getRow1().equals(innermostRow)) { |
| | | locMast = one; |
| | | break; |
| | | } |
| | | if (one.getRow1().equals(innermostRow)) { |
| | | locMast = one; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // LocMast locMast0 = locMastService.findOutMost(locMasts.stream().map(LocMast::getLocNo).distinct().collect(Collectors.toList())); |
| | | // if (!Cools.isEmpty(locMast0)) { |
| | | // locMast = locMast0; |
| | | // } |
| | | |
| | | // 因库位移转、需预留空库位 todo:luxiaotao |
| | | // if (!locMastService.checkEmptyCount(locMast)) { |
| | | // locMast = null; |
| | |
| | | } |
| | | |
| | | // 2.无库位时,无视区域锁定,重新查找库位 |
| | | |
| | | |
| | | if (Cools.isEmpty(locMast)) { |
| | | int sign = curRow; |
| | | while (sign != 0 && Cools.isEmpty(locMast)) { |
| | |
| | | for (LocMast loc : locMasts) { |
| | | // 同库位组对应其钱库位是否为 O.空库位 |
| | | boolean success = true; |
| | | List<String> outerLoc = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLoc) { |
| | | if (!locMastService.selectById(outerLocNo).getLocSts().equals("O")) { |
| | | // 浅库位 |
| | | List<String> outerLocList = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLocList) { |
| | | LocMast outerLoc = locMastService.selectById(outerLocNo); |
| | | if (Cools.isEmpty(outerLoc)) { |
| | | continue; |
| | | } |
| | | if (!outerLoc.getLocSts().equals("O")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 深库位 |
| | | List<String> insideLocList = Utils.getGroupInsideLoc(loc.getLocNo()); |
| | | for (String insideLocNo : insideLocList) { |
| | | LocMast insideLoc = locMastService.selectById(insideLocNo); |
| | | if (Cools.isEmpty(insideLoc)) { |
| | | continue; |
| | | } |
| | | if (insideLoc.getLocSts().equals("R") || insideLoc.getLocSts().equals("P")) { |
| | | success = false; break; |
| | | } |
| | | } |