fix:修复盘点问题

This commit is contained in:
2026-11-24 16:54:57 +08:00
parent 5ea4fa4e18
commit bfae016836

View File

@@ -79,6 +79,8 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS;
@@ -483,12 +485,21 @@ public class VoiceCallbackService {
return resultJson;
}
// 组盘有库存的载具集合
Map<String, GroupPlate> stockVehicles = iMdPbGroupplateService.list(
List<GroupPlate> groupPlates = iMdPbGroupplateService.list(
new LambdaQueryWrapper<GroupPlate>().gt(GroupPlate::getQty, BigDecimal.ZERO))
.stream() .filter(ObjectUtil::isNotEmpty)
.collect(Collectors.toMap(GroupPlate::getStoragevehicle_code, groupPlate -> groupPlate));
.collect(Collectors.toList());
List<String> stockVehicleCodes = groupPlates.stream()
.map(groupPlate -> groupPlate.getStoragevehicle_code())
.collect(Collectors.toList());
Map<String, GroupPlate> stockVehicles = groupPlates.stream()
.collect(Collectors.toMap(
GroupPlate::getStoragevehicle_code,
Function.identity(), BinaryOperator.maxBy(Comparator.comparing(GroupPlate::getCreate_time))
));
// 过滤出有载具的货位
shallowList = shallowList.stream()
.filter(shallow -> stockVehicles.keySet().contains(shallow.getStoragevehicle_code()))
.filter(shallow -> stockVehicleCodes.contains(shallow.getStoragevehicle_code()))
.collect(Collectors.toList());
log.info("含载具货位:{}", shallowList.size());
if (CollectionUtils.isEmpty(shallowList)) {