Commit d728807310166cb3d9579d384c4416927e18b358
1 parent
e2db9e3e
IN 查询限制BUG解决
Signed-off-by: TanYibin <5491541@qq.com>
Showing
1 changed file
with
19 additions
and
14 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java
... | ... | @@ -10,6 +10,8 @@ import javax.annotation.Resource; |
10 | 10 | import javax.servlet.http.HttpServletRequest; |
11 | 11 | |
12 | 12 | import cn.hutool.core.util.ObjectUtil; |
13 | + | |
14 | +import org.apache.commons.collections4.ListUtils; | |
13 | 15 | import org.jeecg.common.api.vo.Result; |
14 | 16 | import org.jeecg.modules.wms.config.container.entity.Container; |
15 | 17 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
... | ... | @@ -64,32 +66,35 @@ public class LocationMonitorController { |
64 | 66 | map.put("emptyLocation", 0); |
65 | 67 | map.put("haveContainLocation", 0); |
66 | 68 | map.put("haveInventoryLocation", 0); |
67 | - return Result.ok(map); | |
69 | + return Result.OK(map); | |
68 | 70 | } |
69 | - List<String> locationCodeList = locationList.stream().map(Location::getCode).collect(Collectors.toList()); | |
70 | 71 | // 换stream进行数据拣选速度更快 |
71 | 72 | List<Location> emptyLocationList = |
72 | 73 | locationList.stream().filter(t -> QuantityConstant.STATUS_LOCATION_EMPTY.equals(t.getStatus())).collect(Collectors.toList()); |
73 | - emptyLocationList = emptyLocationList.stream().filter(t -> t.getContainerCode().isEmpty()).collect(Collectors.toList()); | |
74 | + emptyLocationList = emptyLocationList.stream().filter(t -> t.getContainerCode() == null || t.getContainerCode().isEmpty()).collect(Collectors.toList()); | |
74 | 75 | map.put("emptyLocation", emptyLocationList.size()); |
76 | + List<String> locationCodeList = locationList.stream().map(Location::getCode).collect(Collectors.toList()); | |
77 | + List<List<String>> locationCodePartitionList = ListUtils.partition(locationCodeList, 2000); | |
75 | 78 | // 查询库位上的托盘信息 |
76 | - LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
77 | - HuahengJwtUtil.setWarehouseCode(containerLambdaQueryWrapper, Container.class, req); | |
78 | - containerLambdaQueryWrapper.select(Container::getCode, Container::getStatus, Container::getFillStatus).in(Container::getLocationCode, locationCodeList); | |
79 | - List<Container> containerList = containerService.list(containerLambdaQueryWrapper); | |
79 | + List<Container> containerList = new ArrayList<Container>(); | |
80 | + for (List<String> partitionList : locationCodePartitionList) { | |
81 | + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
82 | + HuahengJwtUtil.setWarehouseCode(containerLambdaQueryWrapper, Container.class, req); | |
83 | + containerLambdaQueryWrapper.select(Container::getCode, Container::getStatus, Container::getFillStatus).in(Container::getLocationCode, partitionList); | |
84 | + List<Container> containerPartitionList = containerService.list(containerLambdaQueryWrapper); | |
85 | + containerList.addAll(containerPartitionList); | |
86 | + } | |
80 | 87 | List<String> containerCodeList = containerList.stream() |
81 | - .filter( | |
82 | - t -> QuantityConstant.STATUS_CONTAINER_FILL_EMPTY.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_MANY.equals(t.getFillStatus())) | |
88 | + .filter(t -> QuantityConstant.STATUS_CONTAINER_FILL_EMPTY.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_MANY.equals(t.getFillStatus())) | |
83 | 89 | .map(Container::getCode).collect(Collectors.toList()); |
84 | 90 | List<Location> haveEmptyContainLocation = locationList.stream().filter(t -> containerCodeList.contains(t.getContainerCode())).collect(Collectors.toList()); |
85 | 91 | map.put("haveContainLocation", haveEmptyContainLocation.size()); |
86 | 92 | List<String> containerCodeList1 = containerList.stream() |
87 | - .filter( | |
88 | - t -> QuantityConstant.STATUS_CONTAINER_FILL_SOME.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_FULL.equals(t.getFillStatus())) | |
93 | + .filter(t -> QuantityConstant.STATUS_CONTAINER_FILL_SOME.equals(t.getFillStatus()) || QuantityConstant.STATUS_CONTAINER_FILL_FULL.equals(t.getFillStatus())) | |
89 | 94 | .map(Container::getCode).collect(Collectors.toList()); |
90 | 95 | List<Location> haveInventoryLocationList = locationList.stream().filter(t -> containerCodeList1.contains(t.getContainerCode())).collect(Collectors.toList()); |
91 | 96 | map.put("haveInventoryLocation", haveInventoryLocationList.size()); |
92 | - return Result.ok(map); | |
97 | + return Result.OK(map); | |
93 | 98 | } |
94 | 99 | |
95 | 100 | /** |
... | ... | @@ -164,7 +169,7 @@ public class LocationMonitorController { |
164 | 169 | location.setLocationAttribute(String.valueOf(locationAttribute)); |
165 | 170 | locationList.add(location); |
166 | 171 | } |
167 | - return Result.ok(locations); | |
172 | + return Result.OK(locations); | |
168 | 173 | } |
169 | 174 | |
170 | 175 | /** |
... | ... | @@ -178,6 +183,6 @@ public class LocationMonitorController { |
178 | 183 | Location location = new Location(); |
179 | 184 | location.setZoneCode(zoneCode); |
180 | 185 | HuahengJwtUtil.setWarehouseCode(req, location); |
181 | - return Result.ok(locationService.getAllLocation(location)); | |
186 | + return Result.OK(locationService.getAllLocation(location)); | |
182 | 187 | } |
183 | 188 | } |
... | ... |