| | |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { |
| | | // whsType = getWhsType(sourceStaNo, times); |
| | | switch (sourceStaNo){ |
| | | case 101: |
| | | case 109: |
| | | case 117: |
| | | whsType=1; |
| | | break; |
| | | case 201: |
| | | whsType=2; |
| | | break; |
| | | case 207: |
| | | whsType=3; |
| | | break; |
| | | case 213: |
| | | whsType=4; |
| | | break; |
| | | |
| | | 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("没有可用的堆垛机"); |
| | | } |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | |
| | | |
| | | |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | |
| | | int eRow = rowLastno.geteRow(); |
| | | int crn_qty = rowLastno.getCrnQty(); |
| | | int rowCount = eRow - sRow + 1; |
| | | // 目标堆垛机号 |
| | | int crnNo = 0; |
| | | |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | |
| | | if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) { |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | 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 (null == locMast){ |
| | | curRow = getCurRow(curRow); |
| | | } |
| | | |
| | | 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)) { |
| | | if ((whsType==2 || whsType==4) && Utils.isShallowLoc(slaveProperties, curRow)) { |
| | | Integer deepRow = Utils.getDeepRow(slaveProperties, curRow); |
| | | locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1()); |
| | | // todo:luxiaotao 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D) |
| | |
| | | locMast = null; |
| | | } |
| | | // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X |
| | | if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { |
| | | if ((whsType==2 || whsType==4) && 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())) { |
| | | if ((whsType==2 || whsType==4) && null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!shallowLoc.getLocSts().equals("O")) { |
| | | locMast = null; |
| | |
| | | /** |
| | | * 根据入库站获取库位排号分配 |
| | | */ |
| | | private Integer getWhsType(Integer sourceStaNo, int times) { |
| | | if (times >= 16) { |
| | | return 4; |
| | | 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; |
| | | } |
| | | switch (sourceStaNo) { |
| | | case 173: |
| | | case 176: |
| | | case 180: |
| | | case 185: |
| | | return 1; |
| | | case 189: |
| | | case 194: |
| | | case 198: |
| | | case 202: |
| | | return 2; |
| | | case 206: |
| | | // case 211: |
| | | // case 215: |
| | | // case 219: |
| | | // case 223: |
| | | case 227: |
| | | return 3; |
| | | case 305: |
| | | case 303: |
| | | case 301: |
| | | return 4; |
| | | default: |
| | | throw new CoolException("根据入库站获取库位排号分配失败,入库站:" + sourceStaNo); |
| | | } |
| | | return curRow; |
| | | } |
| | | |
| | | } |