From 6b4ec9c046a8f703306f5d87569c44d5b8e27563 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Sat, 2 Nov 2024 16:41:02 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DlRepairTicketsServiceImpl.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 f8798a7a..50c32faa 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();