diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java index 8c9d38a..e936e06 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java @@ -10,6 +10,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import cn.hutool.core.util.ObjectUtil; + +import org.apache.commons.collections4.ListUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; @@ -64,32 +66,35 @@ public class LocationMonitorController { map.put("emptyLocation", 0); map.put("haveContainLocation", 0); map.put("haveInventoryLocation", 0); - return Result.ok(map); + return Result.OK(map); } - List<String> locationCodeList = locationList.stream().map(Location::getCode).collect(Collectors.toList()); // 换stream进行数据拣选速度更快 List<Location> emptyLocationList = locationList.stream().filter(t -> QuantityConstant.STATUS_LOCATION_EMPTY.equals(t.getStatus())).collect(Collectors.toList()); - emptyLocationList = emptyLocationList.stream().filter(t -> t.getContainerCode().isEmpty()).collect(Collectors.toList()); + emptyLocationList = emptyLocationList.stream().filter(t -> t.getContainerCode() == null || t.getContainerCode().isEmpty()).collect(Collectors.toList()); map.put("emptyLocation", emptyLocationList.size()); + List<String> locationCodeList = locationList.stream().map(Location::getCode).collect(Collectors.toList()); + List<List<String>> locationCodePartitionList = ListUtils.partition(locationCodeList, 2000); // 查询库位上的托盘信息 - LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); - HuahengJwtUtil.setWarehouseCode(containerLambdaQueryWrapper, Container.class, req); - containerLambdaQueryWrapper.select(Container::getCode, Container::getStatus, Container::getFillStatus).in(Container::getLocationCode, locationCodeList); - List<Container> containerList = containerService.list(containerLambdaQueryWrapper); + List<Container> containerList = new ArrayList<Container>(); + for (List<String> partitionList : locationCodePartitionList) { + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + HuahengJwtUtil.setWarehouseCode(containerLambdaQueryWrapper, Container.class, req); + containerLambdaQueryWrapper.select(Container::getCode, Container::getStatus, Container::getFillStatus).in(Container::getLocationCode, partitionList); + List<Container> containerPartitionList = containerService.list(containerLambdaQueryWrapper); + containerList.addAll(containerPartitionList); + } List<String> containerCodeList = containerList.stream() - .filter( - t -> QuantityConstant.STATUS_CONTAINER_FILL_EMPTY.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_MANY.equals(t.getFillStatus())) + .filter(t -> QuantityConstant.STATUS_CONTAINER_FILL_EMPTY.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_MANY.equals(t.getFillStatus())) .map(Container::getCode).collect(Collectors.toList()); List<Location> haveEmptyContainLocation = locationList.stream().filter(t -> containerCodeList.contains(t.getContainerCode())).collect(Collectors.toList()); map.put("haveContainLocation", haveEmptyContainLocation.size()); List<String> containerCodeList1 = containerList.stream() - .filter( - t -> QuantityConstant.STATUS_CONTAINER_FILL_SOME.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_FULL.equals(t.getFillStatus())) + .filter(t -> QuantityConstant.STATUS_CONTAINER_FILL_SOME.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_FULL.equals(t.getFillStatus())) .map(Container::getCode).collect(Collectors.toList()); List<Location> haveInventoryLocationList = locationList.stream().filter(t -> containerCodeList1.contains(t.getContainerCode())).collect(Collectors.toList()); map.put("haveInventoryLocation", haveInventoryLocationList.size()); - return Result.ok(map); + return Result.OK(map); } /** @@ -164,7 +169,7 @@ public class LocationMonitorController { location.setLocationAttribute(String.valueOf(locationAttribute)); locationList.add(location); } - return Result.ok(locations); + return Result.OK(locations); } /** @@ -178,6 +183,6 @@ public class LocationMonitorController { Location location = new Location(); location.setZoneCode(zoneCode); HuahengJwtUtil.setWarehouseCode(req, location); - return Result.ok(locationService.getAllLocation(location)); + return Result.OK(locationService.getAllLocation(location)); } }