| | |
| | | } |
| | | |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | for (LocMast locMast0 : locMasts) { |
| | | List<String> locNos = locDetlService.getSameDetl(locMast0.getLocNo()); |
| | | for (String locNo : locNos) { |
| | | LocMast locMast1 = locMastService.findInnerLoc(locNo); |
| | | if (null != locMast1) { |
| | | //预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast1, 10)) { |
| | | return locMast1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | locMast = locFilter(locMasts, matNos,locTypeDto); |
| | | |
| | | } |
| | | |
| | | if (locRules.get(0).getKeepGo() == 0) { |
| | |
| | | if (locRule == null) { |
| | | continue; |
| | | } |
| | | |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | for (LocMast locMast0 : locMasts) { |
| | | List<String> locNos = locDetlService.getSameDetl(locMast0.getLocNo()); |
| | | for (String locNo : locNos) { |
| | | LocMast locMast1 = locMastService.findInnerLoc(locNo); |
| | | if (null != locMast1) { |
| | | //预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast1, 10)) { |
| | | return locMast1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | locMast = locFilter(locMasts, matNos,locTypeDto); |
| | | } |
| | | |
| | | // if (locRules.get(0).getKeepGo() == 0) { |
| | |
| | | return locMast; |
| | | } |
| | | |
| | | /* |
| | | 库存规则搜索到的库位确认 |
| | | */ |
| | | private LocMast locFilter(List<LocMast> locMasts,List<String> matNos,LocTypeDto locTypeDto){ |
| | | for (LocMast locMast0 : locMasts) { |
| | | if(!VersionUtils.checkLocType(locMast0,locTypeDto)){ |
| | | continue; |
| | | } |
| | | if (matNos.size() == 1) { |
| | | //单品物料 |
| | | if(Cools.isEmpty(Utils.getGroupDeepLoc(locMast0.getLocNo()))){ |
| | | return locMast0; |
| | | }else{ |
| | | List<String> groupInnerLoc = Utils.getGroupInnerLoc(locMast0.getLocNo()); |
| | | if (Cools.isEmpty(groupInnerLoc)) { |
| | | return locMast0; |
| | | }else { |
| | | //获取最深的库位 |
| | | String loc = groupInnerLoc.get(groupInnerLoc.size() - 1); |
| | | LocMast locMast1 = locMastService.selectByLoc(loc); |
| | | if("O".equals(locMast1.getLocSts())){ |
| | | return locMast1; |
| | | }else { |
| | | if(!"F".equals(locMast1.getLocSts())){ |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = locDetlService.selectByLocNo(loc); |
| | | if(!Cools.eq(locDetls.get(0).getMatnr(),matNos.get(0))){ |
| | | continue; |
| | | } |
| | | for (int i=groupInnerLoc.size()-1; i>=0 ;i--){ |
| | | LocMast locMast2 = locMastService.selectByLoc(groupInnerLoc.get(i)); |
| | | if("O".equals(locMast2.getLocSts())){ |
| | | return locMast2; |
| | | }else if("F".equals(locMast2.getLocSts())){ |
| | | if(i==0){ |
| | | return locMast1; |
| | | }else { |
| | | continue; |
| | | } |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | }else { |
| | | if(Cools.isEmpty(Utils.getGroupDeepLoc(locMast0.getLocNo()))){ |
| | | return locMast0; |
| | | } |
| | | } |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //返回dto |
| | | private StartupDto getLocNoStep6(Integer staDescId, Integer sourceStaNo, LocMast locMast) { |
| | | StartupDto startupDto = new StartupDto(); |