diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 247cae51..baab5102 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -1178,10 +1178,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList()); - List twItems = twItemService.list(new LambdaQueryWrapper().and(item -> { - item.in(DlTwItem::getTwId, ids) - .apply("wares_already_count < wares_count"); - })); + List twItems = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(ids)){ + twItems = twItemService.list(new LambdaQueryWrapper().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 finalTwItems = twItems; List AllItems = items.stream().map(item -> { DlRepairTitem titem = new DlRepairTitem(); titem.setId(item.getId()); - List wares = twItems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).collect(Collectors.toList()); + List 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();