From 80c45ea7934443bea5355bc6bace96ec23a58600 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 27 一月 2026 15:34:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index 52035d8..55333a5 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -77,6 +77,7 @@
     private ProductionProductInputMapper productionProductInputMapper;
     private QualityInspectMapper qualityInspectMapper;
     private ShippingInfoMapper shippingInfoMapper;
+    private ShippingInfoServiceImpl shippingInfoService;
 
     private StockUtils stockUtils;
 
@@ -97,6 +98,20 @@
 //                .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType());
         List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct);
         if(!CollectionUtils.isEmpty(salesLedgerProducts)){
+            salesLedgerProducts.forEach(item -> {
+                // 鍙戣揣淇℃伅
+                ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
+                        .eq(ShippingInfo::getSalesLedgerProductId, item.getId())
+                        .orderByDesc(ShippingInfo::getCreateTime)
+                        .last("limit 1"));
+                if(shippingInfo != null){
+                    item.setShippingDate(shippingInfo.getShippingDate());
+                    item.setShippingCarNumber(shippingInfo.getShippingCarNumber());
+                    item.setShippingStatus(shippingInfo.getStatus());
+                    item.setExpressCompany(shippingInfo.getExpressCompany());
+                    item.setExpressNumber(shippingInfo.getExpressNumber());
+                }
+            });
             // 寮�绁�
             InvoiceRegistrationProductDto invoiceRegistrationProductDto = new InvoiceRegistrationProductDto();
             invoiceRegistrationProductDto.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId().intValue());
@@ -120,16 +135,7 @@
                     ledgerProduct.setInvoiceAmount(invoiceAmount);
                     ledgerProduct.setNoInvoiceNum(noInvoiceNum);
                     ledgerProduct.setNoInvoiceAmount(noInvoiceAmount);
-                    // 鍙戣揣淇℃伅
-                    ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
-                            .eq(ShippingInfo::getSalesLedgerProductId, ledgerProduct.getId())
-                            .orderByDesc(ShippingInfo::getCreateTime)
-                            .last("limit 1"));
-                    if(shippingInfo != null){
-                        ledgerProduct.setShippingDate(shippingInfo.getShippingDate());
-                        ledgerProduct.setShippingCarNumber(shippingInfo.getShippingCarNumber());
-                        ledgerProduct.setShippingStatus(shippingInfo.getStatus());
-                    }
+
 
                 }
             }
@@ -150,6 +156,12 @@
         if (deletedProducts.isEmpty()) {
             return 0; // 娌℃湁鍙垹闄ょ殑鏁版嵁
         }
+        //鍒犻櫎鍙戣揣淇℃伅
+        List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>()
+                .in(ShippingInfo::getSalesLedgerProductId, Arrays.asList(ids)));
+        if(!CollectionUtils.isEmpty(shippingInfos)){
+            shippingInfoService.delete(shippingInfos.stream().map(ShippingInfo::getId).collect(Collectors.toList()));
+        }
 
         // 鍙兘灞炰簬澶氫釜涓昏〃
         Set<Long> mainIds = deletedProducts.stream()

--
Gitblit v1.9.3