|  |  |  | 
|---|
|  |  |  | throw new CoolException("入库路径不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //找相同空托盘 | 
|---|
|  |  |  | LambdaQueryWrapper<LocMast> wrapper0 = new LambdaQueryWrapper<LocMast>() | 
|---|
|  |  |  | .eq(LocMast::getLocSts, "D") | 
|---|
|  |  |  | .eq(LocMast::getLocType1, locTypeDto.getLocType1()) | 
|---|
|  |  |  | .eq(LocMast::getCrnNo, staDesc.getDeviceNo()) | 
|---|
|  |  |  | .eq(LocMast::getHostId, hostId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LambdaQueryWrapper<LocMast> wrapper1 = new LambdaQueryWrapper<LocMast>() | 
|---|
|  |  |  | .eq(LocMast::getLocSts, "O") | 
|---|
|  |  |  | .eq(LocMast::getLocType1, 1) | 
|---|
|  |  |  | .eq(LocMast::getLocType1, locTypeDto.getLocType1()) | 
|---|
|  |  |  | .eq(LocMast::getCrnNo, staDesc.getDeviceNo()) | 
|---|
|  |  |  | .eq(LocMast::getHostId, hostId) | 
|---|
|  |  |  | .orderByAsc(LocMast::getLev1, LocMast::getBay1, LocMast::getRow1); | 
|---|
|  |  |  | .eq(LocMast::getHostId, hostId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //库位搜索范围 | 
|---|
|  |  |  | LocRangeDto locRangeDto = locTypeDto.getLocRangeDto(); | 
|---|
|  |  |  | 
|---|
|  |  |  | wrapper1.le(LocMast::getLev1, locRangeDto.getTargetLev()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocMast> locMasts = locMastService.list(wrapper1); | 
|---|
|  |  |  | if (!locMasts.isEmpty()) { | 
|---|
|  |  |  | for (LocMast loc : locMasts) { | 
|---|
|  |  |  | List<LocMast> locMasts0 = locMastService.list(wrapper0); | 
|---|
|  |  |  | if (!locMasts0.isEmpty()) { | 
|---|
|  |  |  | for (LocMast loc : locMasts0) { | 
|---|
|  |  |  | LocMast locMast0 = locMastService.findNearloc(loc.getLocNo(), hostId, locRangeDto); | 
|---|
|  |  |  | if (null != locMast0) { | 
|---|
|  |  |  | locMast = locMast0; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (locMast == null) { | 
|---|
|  |  |  | List<LocMast> locMasts = locMastService.list(wrapper1); | 
|---|
|  |  |  | if (!locMasts.isEmpty()) { | 
|---|
|  |  |  | for (LocMast loc : locMasts) { | 
|---|
|  |  |  | LocMast locMast0 = locMastService.findNearloc(loc.getLocNo(), hostId, locRangeDto); | 
|---|
|  |  |  | if (null != locMast0) { | 
|---|
|  |  |  | locMast = locMast0; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | startupDto.setSourceStaNo(sourceStaNo); | 
|---|
|  |  |  | startupDto.setStaNo(staNo.getDevNo()); | 
|---|
|  |  |  | startupDto.setLocNo(locMast.getLocNo()); | 
|---|
|  |  |  | startupDto.setCrnNo(locMast.getCrnNo()); | 
|---|
|  |  |  | return startupDto; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|