Sfoglia il codice sorgente

看板核对新增列表为空判断

fgd 1 anno fa
parent
commit
96475644c8

+ 14 - 4
sd-business/src/main/java/com/sd/business/service/board/impl/DailyBoardServiceImpl.java

@@ -543,13 +543,23 @@ public class DailyBoardServiceImpl implements DailyBoardService {
         List<Long> departmentIds = departmentList.stream().map(BaseIdPo::getId).collect(Collectors.toList());
         // 查询今日生成完成任务
         List<ProductionTask> productionTaskList = productionTaskService.list(q -> q.between(ProductionTask::getCompleteTime, beginDate, endDate));
-        List<Long> orderIds = productionTaskList.stream().map(ProductionTask::getOrderId).collect(Collectors.toList());
-        long productionOrderCount = orderService.count(q -> q.in(OrderInfo::getDepartmentId, departmentIds).in(BaseIdPo::getId, orderIds));
+        long productionOrderCount;
+        if (productionTaskList.isEmpty()) {
+            productionOrderCount = 0L;
+        } else {
+            List<Long> orderIds = productionTaskList.stream().map(ProductionTask::getOrderId).collect(Collectors.toList());
+            productionOrderCount = orderService.count(q -> q.in(OrderInfo::getDepartmentId, departmentIds).in(BaseIdPo::getId, orderIds));
+        }
 
         // 查询今日出库单出库数据
         List<OutboundOrder> outboundOrderList = outboundOrderService.list(q -> q.between(OutboundOrder::getOutboundTime, beginDate, endDate));
-        List<String> wlnCodes = outboundOrderList.stream().map(OutboundOrder::getOrderWlnCode).collect(Collectors.toList());
-        long wlnOrderCount = orderService.count(q -> q.in(OrderInfo::getDepartmentId, departmentIds).in(OrderInfo::getWlnCode, wlnCodes));
+        long wlnOrderCount;
+        if (outboundOrderList.isEmpty()) {
+            wlnOrderCount = 0L;
+        } else {
+            List<String> wlnCodes = outboundOrderList.stream().map(OutboundOrder::getOrderWlnCode).collect(Collectors.toList());
+            wlnOrderCount = orderService.count(q -> q.in(OrderInfo::getDepartmentId, departmentIds).in(OrderInfo::getWlnCode, wlnCodes));
+        }
         if (ObjectUtil.notEqual(productionOrderCount, wlnOrderCount)) {
             throw new ServiceException("核对失败,订单总数存在差异!");
         }