| | |
| | | Map<Long, List<WkOrderItem>> asnIds = wkOrderItems.stream().collect(Collectors.groupingBy(WkOrderItem::getOrderId)); |
| | | ids.forEach(id -> { |
| | | long count = Optional.ofNullable(asnOrderMapper.selectCount(new LambdaQueryWrapper<WkOrder>().in(WkOrder::getId, id))).orElse(0L); |
| | | WkOrder order = asnOrderMapper.selectById(id); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("ASN主单状态修改失败!!"); |
| | | } |
| | | if (count == asnIds.get(id).size()) { |
| | | if (asnOrderMapper.update(null, new LambdaUpdateWrapper<WkOrder>().eq(WkOrder::getId, id).set(WkOrder::getNtyStatus, 1)) <= 0) { |
| | | throw new CoolException("ASN主单状态修改失败!!"); |
| | | } |
| | | order.setNtyStatus(1); |
| | | } else { |
| | | if (asnOrderMapper.update(null, new LambdaUpdateWrapper<WkOrder>().eq(WkOrder::getId, id).set(WkOrder::getNtyStatus, 2)) <= 0) { |
| | | throw new CoolException("ASN主单状态修改失败!!"); |
| | | } |
| | | order.setNtyStatus(2); |
| | | } |
| | | if (asnOrderMapper.updateById(order) <= 0) { |
| | | throw new CoolException("ASN主单状态修改失败!!"); |
| | | } |
| | | }); |
| | | return true; |