| | |
| | | } |
| | | Map<Long, List<DeliveryItem>> listMap = items.stream().collect(Collectors.groupingBy(DeliveryItem::getDeliveryId)); |
| | | listMap.keySet().forEach(key -> { |
| | | //TODO 判断单据是否已经存在,如存在则累加修改子表,不存在才新建 |
| | | Delivery delivery = deliveryService.getById(key); |
| | | if (Objects.isNull(delivery)) { |
| | | throw new CoolException("单据不存在!!"); |
| | |
| | | exceStatus = AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val; |
| | | } |
| | | |
| | | Double wkQty = Math.round((delivery.getWorkQty() + sum) * 10000) / 10000.0; |
| | | if (!deliveryService.update(new LambdaUpdateWrapper<Delivery>() |
| | | .set(Delivery::getExceStatus, exceStatus) |
| | | .set(Delivery::getWorkQty, sum) |
| | | .set(Delivery::getWorkQty, wkQty) |
| | | .eq(Delivery::getId, key))) { |
| | | throw new CoolException("主单修改失败!!"); |
| | | } |