Showing
1 changed file
with
34 additions
and
1 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| @@ -43,6 +43,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | @@ -43,6 +43,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | ||
| 43 | import lombok.extern.slf4j.Slf4j; | 43 | import lombok.extern.slf4j.Slf4j; |
| 44 | import org.apache.commons.collections4.CollectionUtils; | 44 | import org.apache.commons.collections4.CollectionUtils; |
| 45 | import org.apache.commons.collections4.MapUtils; | 45 | import org.apache.commons.collections4.MapUtils; |
| 46 | +import org.apache.commons.lang3.BooleanUtils; | ||
| 46 | import org.apache.commons.lang3.StringUtils; | 47 | import org.apache.commons.lang3.StringUtils; |
| 47 | import org.springframework.transaction.annotation.Transactional; | 48 | import org.springframework.transaction.annotation.Transactional; |
| 48 | import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper; | 49 | import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper; |
| @@ -457,7 +458,39 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -457,7 +458,39 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 457 | return; | 458 | return; |
| 458 | } | 459 | } |
| 459 | List<String> orderIds = detailList.stream().map(ShipmentsPlanDetail::getOrderId).distinct().collect(Collectors.toList()); | 460 | List<String> orderIds = detailList.stream().map(ShipmentsPlanDetail::getOrderId).distinct().collect(Collectors.toList()); |
| 460 | - purchaseOrderInfoService.updateStatus(orderIds, "DELIVERED"); | 461 | + // 获取订货单规格数据 |
| 462 | + List<PurchaseOrderLine> orderLineList = purchaseOrderLineService.listByOrderIds(orderIds, true); | ||
| 463 | + if (CollectionUtils.isEmpty(orderLineList)) { | ||
| 464 | + return; | ||
| 465 | + } | ||
| 466 | + // 按照订货单分组 | ||
| 467 | + Map<String, List<PurchaseOrderLine>> orderLineMap = new HashMap<>(); | ||
| 468 | + for (PurchaseOrderLine orderLine : orderLineList) { | ||
| 469 | + String orderId = orderLine.getPurchaseOrderId(); | ||
| 470 | + List<PurchaseOrderLine> list = orderLineMap.computeIfAbsent(orderId, k -> new ArrayList<>()); | ||
| 471 | + list.add(orderLine); | ||
| 472 | + } | ||
| 473 | + List<String> needDeliveryOrderIds = new ArrayList<>(); | ||
| 474 | + for (String orderId : orderIds) { | ||
| 475 | + List<PurchaseOrderLine> lineList = orderLineMap.get(orderId); | ||
| 476 | + if (CollectionUtils.isEmpty(lineList)) { | ||
| 477 | + log.info("========================== 订货单 {} 不存在规格数据!", orderId); | ||
| 478 | + continue; | ||
| 479 | + } | ||
| 480 | + boolean needDelivery = true; | ||
| 481 | + for (PurchaseOrderLine line : lineList) { | ||
| 482 | + Boolean shipment = line.getShipment(); | ||
| 483 | + if (!BooleanUtils.isTrue(shipment)) { | ||
| 484 | + needDelivery = false; | ||
| 485 | + break; | ||
| 486 | + } | ||
| 487 | + } | ||
| 488 | + if (needDelivery) { | ||
| 489 | + needDeliveryOrderIds.add(orderId); | ||
| 490 | + } | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + purchaseOrderInfoService.updateStatus(needDeliveryOrderIds, "DELIVERED"); | ||
| 461 | } | 494 | } |
| 462 | 495 | ||
| 463 | @Override | 496 | @Override |