From 98af2bbf6d7c1c821919fc2221c4181479cdc562 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 01 四月 2026 11:32:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_宁夏_中盛建材' into dev_宁夏_中盛建材

---
 src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java b/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java
index 084b249..d9872ed 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/SalesDeliveryServiceImpl.java
@@ -7,7 +7,10 @@
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.config.AliDingConfig;
 import com.ruoyi.framework.util.AliDingUtils;
+import com.ruoyi.production.pojo.ProductMaterial;
 import com.ruoyi.production.pojo.ProductMaterialSku;
+import com.ruoyi.production.service.ProductMaterialService;
+import com.ruoyi.production.service.ProductMaterialSkuService;
 import com.ruoyi.productionPlan.enums.DataSourceTypeEnum;
 import com.ruoyi.productionPlan.pojo.ProductionPlan;
 import com.ruoyi.productionPlan.pojo.SalesDelivery;
@@ -41,6 +44,12 @@
 
     @Autowired
     private SalesDeliveryMapper salesDeliveryMapper;
+
+    @Autowired
+    private ProductMaterialSkuService productMaterialSkuService;
+
+    @Autowired
+    private ProductMaterialService productMaterialService;
 
     @Autowired
     private AliDingConfig aliDingConfig;
@@ -125,18 +134,24 @@
                 salesDelivery.setSalesman(formData.getString("textField_ladnkyu1"));//涓氬姟鍛�
                 salesDelivery.setDeliveryMethod(formData.getString("radioField_ldoc0027"));//鍙戣揣鏂瑰紡
                 String materialCode = row.getString("textField_l92dg1tc");
-                // 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡淇℃伅琛紝鍏宠仈鐗╂枡ID
-//                if (StringUtils.isNotEmpty(materialCode)) {
-//                    LambdaQueryWrapper<ProductMaterialSku> skuQueryWrapper = new LambdaQueryWrapper<>();
-//                    skuQueryWrapper.eq(ProductMaterialSku::getMaterialCode, materialCode);
-//                    ProductMaterialSku sku = productMaterialSkuService.getOne(skuQueryWrapper);
-//                    if (sku != null) {
-//                        salesDelivery.setProductMaterialSkuId(sku.getId());
-//                    }
-//                }
+                String productName = row.getString("textField_l96srw8x");
+                String model = row.getString("textField_l9tljfl8");
+                // 濡傛灉鍚嶅瓧涓虹┖缂栫爜涓嶄负绌�
+                if (StringUtils.isNotEmpty(materialCode) && StringUtils.isEmpty(productName)) {
+                    LambdaQueryWrapper<ProductMaterialSku> skuQueryWrapper = new LambdaQueryWrapper<>();
+                    skuQueryWrapper.eq(ProductMaterialSku::getMaterialCode, materialCode);
+                    ProductMaterialSku sku = productMaterialSkuService.getOne(skuQueryWrapper);
+                    if (sku != null) {
+                        ProductMaterial material = productMaterialService.getById(sku.getProductId());
+                        productName=material.getProductName();
+                        model=sku.getModel();
+                    }
+                }else if (StringUtils.isEmpty(productName) && StringUtils.isEmpty(materialCode)){
+                    continue;
+                }
                 salesDelivery.setMaterialCode(materialCode);//鐗╂枡缂栫爜
-                salesDelivery.setProductName(row.getString("textField_l96srw8x"));//浜у搧鍚嶇О
-                salesDelivery.setModel(row.getString("textField_l9tljfl8"));//浜у搧瑙勬牸
+                salesDelivery.setProductName(productName);//浜у搧鍚嶇О
+                salesDelivery.setModel(model);//浜у搧瑙勬牸
                 salesDelivery.setVolume(row.getBigDecimal("numberField_kt8b0qsg_value"));//鏂归噺
                 salesDelivery.setUnitPrice(row.getBigDecimal("numberField_la0tb2x9_value"));//鍗曚环
                 salesDelivery.setPrice(row.getBigDecimal("numberField_l9w2piwf"));//浠锋牸

--
Gitblit v1.9.3