| | |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | long start = System.currentTimeMillis(); |
| | | int tagId = 0; |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | |
| | | } |
| | | } |
| | | |
| | | // // 靠近摆放规则 --- 空托 //分离版 |
| | | // if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | // for (LocMast locMast1:locMasts){ |
| | | // if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | // continue; |
| | | // } |
| | | // String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc)); |
| | | // if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("D")){ |
| | | // locMast = locMast1; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // 靠近摆放规则 --- 空托 //互通版 |
| | | if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { |
| | |
| | | .eq("loc_sts", "O") |
| | | .orderBy("lev1",true).orderBy("bay1",true)); |
| | | } |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("row1", nearRow) |
| | | // .eq("loc_sts", "O") |
| | | // .orderBy("lev1",true).orderBy("bay1",true)); |
| | | // for (LocMast locMast1 : locMasts) { |
| | | // if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | // continue; |
| | | // } |
| | | // if (Utils.BooleanWhsTypeStaIoType(whsType)){ |
| | | //// String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | // .eq("loc_sts", "O")); |
| | | // if (!Cools.isEmpty(locMast2)) { |
| | | // locMast = locMast2; |
| | | // break; |
| | | // } |
| | | // } else { |
| | | // if (!Cools.isEmpty(locMast1)) { |
| | | // locMast = locMast1; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(whsType)){ |
| | | if(tagId == 226){ |
| | |
| | | } |
| | | } |
| | | locMasts = filteredLocMasts; |
| | | }else{ |
| | | List<LocMast> filteredLocMasts = new ArrayList<>(); |
| | | for (LocMast loc : locMasts) { |
| | | Integer lev = loc.getLev1(); |
| | | if (lev != null && lev >= 1 && lev <= 5) { |
| | | filteredLocMasts.add(loc); |
| | | } |
| | | // if(tagId == 226){ //原材料毛胚等 |
| | | // List<LocMast> filteredLocMasts = new ArrayList<>(); |
| | | // for (LocMast loc : locMasts) { |
| | | // Integer lev = loc.getLev1(); |
| | | // if (lev != null && lev >= 1 && lev <= 5) { |
| | | // filteredLocMasts.add(loc); |
| | | // } |
| | | // } |
| | | // locMasts = filteredLocMasts; |
| | | // } |
| | | } |
| | | locMasts = filteredLocMasts; |
| | | } |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | |
| | | times = times + 1; |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo+1, locTypeDto, times); |
| | | } |
| | | // // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | // if (locTypeDto.getLocType1() < 2) { |
| | | // int i = locTypeDto.getLocType1() + 1; |
| | | // locTypeDto.setLocType1((short)i); |
| | | // return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, 0); |
| | | // } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位或堆垛机异常"); |
| | | } |
| | |
| | | startupDto.setCrnNo(crnNo); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | log.info("库位检索耗时: {} ms", System.currentTimeMillis() - start); |
| | | |
| | | return startupDto; |
| | | } |
| | | } |