diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java index cd44a88..2f365a2 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java @@ -46,6 +46,7 @@ import lombok.extern.slf4j.Slf4j; @RequestMapping("/config/location") @Slf4j public class LocationController extends JeecgController<Location, ILocationService> { + @Autowired private ILocationService locationService; @@ -93,6 +94,16 @@ public class LocationController extends JeecgController<Location, ILocationServi return Result.OK(pageList); } + @ApiOperation(value = "库位管理-分页查询有货的库位", notes = "分页查询有货的库位") + @GetMapping(value = "/listSomeContainerInLocation") + public Result<IPage<Location>> listSomeContainerInLocation(Location location, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { + Page<Location> page = new Page<Location>(pageNo, pageSize); + HuahengJwtUtil.setWarehouseCode(req, location); + IPage<Location> pageList = locationService.listSomeContainerInLocation(page, location); + return Result.OK(pageList); + } + /** * 添加 * @param location diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java index 0b508d6..3f2d5a0 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java @@ -55,6 +55,8 @@ public interface ILocationService extends IService<Location> { IPage<Location> listEmptyContainerInLocation(Page<Location> page, Location location); + IPage<Location> listSomeContainerInLocation(Page<Location> page, Location location); + /** * 判断系统是否已经有同样的托盘号,如果有证明数据混乱了 */ diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java index ff6cb18..feaa822 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java @@ -396,6 +396,26 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i } @Override + public IPage<Location> listSomeContainerInLocation(Page<Location> page, Location location) { + List<Location> locationList = + locationService.getContainerInLocation(null, QuantityConstant.STATUS_CONTAINER_FILL_SOME, null, QuantityConstant.DEFAULT_WAREHOUSE); + List<String> locationCode = + locationList.stream().filter(i -> i.getZoneCode().equals(location.getZoneCode())).map(Location::getCode).collect(Collectors.toList()); + // 最多返回2000条数据 + List<List<String>> partition = ListUtils.partition(locationCode, 2000); + for (List<String> strings : partition) { + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.eq(Location::getZoneCode, location.getZoneCode()).in(Location::getCode, strings); + Page<Location> locationPage = locationService.page(page, locationLambdaQueryWrapper); + if (CollectionUtils.isEmpty(Collections.singleton(locationPage))) { + return null; + } + return locationPage; + } + return null; + } + + @Override public boolean havaContainerCodeInLocation(String containerCode, String locationCode, String warehouseCode) { LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.eq(Location::getContainerCode, containerCode).ne(Location::getCode, locationCode).eq(Location::getWarehouseCode, warehouseCode);