| | |
| | | public static final List<Integer> SECOND_GROUP_ROW_LIST = new ArrayList<Integer>() {{ |
| | | add(5);add(6);add(7);add(8);add(9);add(10);add(11); |
| | | }}; |
| | | public static final List<Integer> FIRST_GROUP_ROW_LIST2 = new ArrayList<Integer>() {{ |
| | | add(2);add(3);add(4); |
| | | }}; |
| | | public static final List<Integer> SECOND_GROUP_ROW_LIST10 = new ArrayList<Integer>() {{ |
| | | add(5);add(6);add(7);add(8);add(9);add(10); |
| | | }}; |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | if (whsType == 1) { |
| | | if (curRow == 2) { |
| | | curRow = 30; |
| | | } else if (curRow == 30) { |
| | | curRow = 2; |
| | | } |
| | | if (curRow == 1) { |
| | | curRow = 11; |
| | | } else { |
| | | curRow = 1; |
| | | } |
| | | if (basCrnpService.checkSiteError(dualCrnNo, true)) { |
| | | crnNo = dualCrnNo; |
| | | if (basCrnpService.checkSiteError(1, true)) { |
| | | crnNo = 1; |
| | | } |
| | | } |
| | | |
| | | if (crnNo == 0) { |
| | | throw new CoolException("没有可用的堆垛机"); |
| | | } |
| | | |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | |
| | | |
| | | // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排 |
| | | if (locMast == null) { |
| | | if (whsType == 1) { |
| | | List<Integer> rows = Utils.getGroupLoc(curRow); |
| | | List<Integer> rows = Utils.getGroupLoc(curRow); |
| | | |
| | | // Iterator<Integer> iterator = rows.iterator(); |
| | | // while (iterator.hasNext()) { |
| | | // Integer next = iterator.next(); |
| | | // if (next.equals(17) || next.equals(18)) { |
| | | // iterator.remove(); |
| | | // } |
| | | // } |
| | | |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast(rows, rows.size(), locTypeDto.getLocType1()); |
| | | if (!Cools.isEmpty(locMasts)) { |
| | | Integer innermostRow = Utils.getOutLayerRow(locMasts.get(0).getLocNo(), false); |
| | | for (LocMast one : locMasts) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast(rows, rows.size(), locTypeDto.getLocType1()); |
| | | 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 (Cools.isEmpty(locMast)){ |
| | | if (rows.equals(FIRST_GROUP_ROW_LIST)){ |
| | | rows=FIRST_GROUP_ROW_LIST2; |
| | | }else if (rows.equals(SECOND_GROUP_ROW_LIST)){ |
| | | rows=SECOND_GROUP_ROW_LIST10; |
| | | } |
| | | List<LocMast> locMasts1 = locMastService.queryFreeLocMast2(rows, rows.size(), locTypeDto.getLocType1()); |
| | | if (!Cools.isEmpty(locMasts1)) { |
| | | Integer innermostRow = Utils.getInnermostRow(locMasts1.get(0).getLocNo()); |
| | | if (rows.equals(FIRST_GROUP_ROW_LIST2)){ |
| | | innermostRow=innermostRow+1; |
| | | }else if (rows.equals(SECOND_GROUP_ROW_LIST10)){ |
| | | innermostRow=innermostRow-1; |
| | | } |
| | | for (LocMast one : locMasts1) { |
| | | if (one.getRow1().equals(innermostRow)) { |
| | | locMast = one; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 todo:luxiaotao |
| | | // if (!locMastService.checkEmptyCount(locMast)) { |
| | | // locMast = null; |
| | | // } |
| | | } else { |
| | | if (Utils.isShallowLoc(slaveProperties, curRow)) { |
| | | Integer deepRow = Utils.getDeepRow(slaveProperties, curRow); |
| | | locMast = locMastService.queryFreeLocMast0(deepRow, locTypeDto.getLocType1()); |
| | | // 因库位移转、需预留空库位 |
| | | if (locMast !=null && !locMastService.checkEmptyCount(locMast)) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | |
| | | if (Cools.isEmpty(locMast)) { |
| | | locMast = locMastService.queryFreeLocMast0(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; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(locMast, 10)) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | |
| | |
| | | times = 0; |
| | | } |
| | | // 货物检索低库位仓失败,兼容高库位仓后继续执行 |
| | | if (locTypeDto.getLocType1() == 1) { |
| | | locTypeDto.setLocType1((short) 2); |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times); |
| | | } |
| | | // if (locTypeDto.getLocType1() == 1) { |
| | | // locTypeDto.setLocType1((short) 2); |
| | | // return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times); |
| | | // } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | | } |