bug修复
This commit is contained in:
parent
4a90687814
commit
6b4ec9c046
@ -1178,10 +1178,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}));
|
||||
// 查配件申请表的所有已领取数量小于申请数量的子表信息
|
||||
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
||||
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
item.in(DlTwItem::getTwId, ids)
|
||||
.apply("wares_already_count < wares_count");
|
||||
}));
|
||||
List<DlTwItem> twItems = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(ids)){
|
||||
twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||
item.in(DlTwItem::getTwId, ids)
|
||||
.apply("wares_already_count < wares_count");
|
||||
}));
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(twItems)) {
|
||||
// 更新工单子表(主要是把已领料的字段同步给工单配件的数量字段)
|
||||
// 查询工单子表(三个查询条件,属于那个工单,属于配件类型,属于需要改变的(即申请表的已领取数量小于申请数量的))
|
||||
@ -1192,10 +1195,11 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
.in(DlRepairTitem::getPartId, waresId);
|
||||
}));
|
||||
// 同一个配件可能申请过多次,属于是一个工单配件可能是对应多个申请表配件
|
||||
List<DlTwItem> finalTwItems = twItems;
|
||||
List<DlRepairTitem> AllItems = items.stream().map(item -> {
|
||||
DlRepairTitem titem = new DlRepairTitem();
|
||||
titem.setId(item.getId());
|
||||
List<DlTwItem> wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList());
|
||||
List<DlTwItem> wares = finalTwItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList());
|
||||
int sum = wares.stream().mapToInt(DlTwItem::getWaresAlreadyCount).sum();
|
||||
titem.setItemCount(sum);
|
||||
BigDecimal discount = item.getItemDiscount() == null ? BigDecimal.ONE : item.getItemDiscount();
|
||||
|
Loading…
Reference in New Issue
Block a user