| | |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | curRow = curRow + 1; |
| | | if (curRow == 4) { |
| | | curRow = 1; |
| | | } |
| | | if (basCrnpService.checkSiteError(1, true)) { |
| | | crnNo = 1; |
| | | } |
| | | } |
| | | if (crnNo == 0) { |
| | | throw new CoolException("没有可用的堆垛机"); |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 |
| | | if (!Cools.isEmpty(matNos)) { |
| | | List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow); |
| | | for (String locNo : locNos) { |
| | | if (Utils.isShallowLoc(slaveProperties, locNo)) { |
| | | continue; |
| | | // 是浅库位 的跳走 |
| | | //if (Utils.isShallowLoc(slaveProperties, locNo)) { |
| | | // continue; |
| | | //} |
| | | int row = Integer.parseInt(locNo.substring(0, 2)); |
| | | if (row == 2) continue; |
| | | String shallowLocNo = ""; |
| | | if (row == 1) { |
| | | shallowLocNo = locNo; |
| | | } else { |
| | | shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo); |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | |
| | | 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; |
| | | //if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | // continue; |
| | | //} |
| | | |
| | | int row = Integer.parseInt(loc.getLocNo().substring(0, 2)); |
| | | //如果为浅库位则判断深库位是否使用 |
| | | |
| | | |
| | | String shallowLocNo = ""; |
| | | if (row == 1) { |
| | | shallowLocNo = loc.getLocNo(); |
| | | } else if (row == 2){ |
| | | LocMast deepLoc = locMastService.selectById(zerofill(String.valueOf(3), 2) + locMast.getLocNo().substring(2)); |
| | | if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { |
| | | continue; |
| | | } |
| | | shallowLocNo = loc.getLocNo(); |
| | | } else { |
| | | LocMast deepLoc = locMastService.selectById(zerofill(String.valueOf(2), 2) + locMast.getLocNo().substring(2)); |
| | | if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { |
| | | continue; |
| | | } |
| | | shallowLocNo = loc.getLocNo(); |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | |
| | | |
| | | |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | int divides = (int) Arith.divides(1, curRow - 1, 4); |
| | | curRow = (int) Arith.remainder(curRow, 4); |
| | | if (curRow == 0) { |
| | | curRow = 4; |
| | | } |
| | | for (int i = 0; i < shelves.group; i ++) { |
| | | curRow = shelves.start(curRow); |
| | | if (curRow < 0) { |
| | | throw new CoolException("检索库位失败,请联系管理员"); |
| | | } |
| | | Integer crnNo1 = shelves.get(curRow); |
| | | crnNo1 = crnNo1 + divides*1; |
| | | if (basCrnpService.checkSiteError(crnNo1, true)) { |
| | | crnNo = crnNo1; |
| | | curRow = curRow + divides*4; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (crnNo == 0) { |
| | | throw new CoolException("没有可用的堆垛机"); |
| | | } |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | |
| | | |
| | | // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排 |
| | | if (locMast == null) { |
| | | if (Utils.isShallowLoc(slaveProperties, curRow)) { |
| | | Integer deepRow = Utils.getDeepRow(slaveProperties, curRow); |
| | | if (curRow == 2) { |
| | | Integer deepRow = 3; |
| | | locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1()); |
| | | // todo:luxiaotao 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D) |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(locMast)) { |
| | | 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; |
| | | // } |
| | | //} |
| | | if (Cools.isEmpty(locMast)) { |
| | | locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); |
| | | // 因库位移转、需预留空库位 |
| | |
| | | locMast = null; |
| | | } |
| | | // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X |
| | | if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo())); |
| | | if (null != locMast && Integer.parseInt(locMast.getLocNo().substring(0, 2)) == 2) { |
| | | LocMast deepLoc = locMastService.selectById(zerofill(String.valueOf(3), 2) + locMast.getLocNo().substring(2)); |
| | | if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | //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 (null != locMast && Integer.parseInt(locMast.getLocNo().substring(0, 2)) == 3) { |
| | | LocMast shallowLoc = locMastService.selectById(zerofill(String.valueOf(2), 2) + locMast.getLocNo().substring(2)); |
| | | if (!Cools.isEmpty(shallowLoc)) { |
| | | if (!shallowLoc.getLocSts().equals("O")) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | //if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) { |
| | | // LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo())); |
| | | // if (!Cools.isEmpty(shallowLoc)) { |
| | | // if (!shallowLoc.getLocSts().equals("O")) { |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | //} |
| | | } |
| | | } |
| | | |