fix:喷涂领料数据验证

This commit is contained in:
zhaoyf
2026-08-31 15:56:47 +08:00
parent a28c5ff615
commit 6cfe2b623a

View File

@@ -298,42 +298,8 @@ public class PmDemandPlatingServiceImpl extends ServiceImpl<PmDemandPlatingMappe
if (CollectionUtils.isEmpty(pmDemandDtos)){
throw new BadRequestException("下推失败,请求数据不能为空");
}
List<PmDemandPlating> disList = this.list(new LambdaQueryWrapper<PmDemandPlating>()
.in(PmDemandPlating::getId, pmDemandDtos.stream().map(PmDemandDto::getId).collect(Collectors.toList()))
.eq(PmDemandPlating::getStatus, DemandStatus.DIS.getValue())
.ne(PmDemandPlating::getIs_deleted, 1));
if (disList.size()<pmDemandDtos.size()){
String collect = pmDemandDtos.stream()
.map(PmDemandDto::getWorkOrder)
.filter(workOrder -> disList.stream()
.noneMatch(i -> Objects.equals(i.getWork_order(), workOrder)))
.collect(Collectors.joining(","));
throw new BadRequestException("下推失败,单据"+collect+"状态不为已分配不能下推");
}
List<PmDemandPlating> allWorkDemand = this.list(new LambdaQueryWrapper<PmDemandPlating>()
.in(PmDemandPlating::getWork_order, pmDemandDtos.stream()
.map(PmDemandDto::getWorkOrder)
.distinct()
.collect(Collectors.toList()))
.ne(PmDemandPlating::getIs_deleted, 1));
if (pmDemandDtos.size() < allWorkDemand.size()) {
// 统计 allWorkDemand 中每个工单的数量
Map<String, Long> sourceCountMap = allWorkDemand.stream()
.collect(Collectors.groupingBy(PmDemandPlating::getWork_order, Collectors.counting()));
// 统计 pmDemandDtos 中每个工单的数量
Map<String, Long> targetCountMap = pmDemandDtos.stream()
.collect(Collectors.groupingBy(PmDemandDto::getWorkOrder, Collectors.counting()));
// 找出数量不一致的工单
String collect = sourceCountMap.entrySet().stream()
.filter(entry -> {
Long targetCount = targetCountMap.getOrDefault(entry.getKey(), 0L);
return !entry.getValue().equals(targetCount);
})
.map(Map.Entry::getKey)
.collect(Collectors.joining(",\n"));
throw new BadRequestException("存在未勾选完全的工单" + collect);
if (pmDemandDtos.stream().anyMatch(i -> !Objects.equals(i.getStatus(), "01"))){
throw new BadRequestException("单据不为已分配状态不能下推");
}
// 一次性分成两组
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);