From 333d209effc6574985ce5b696d36785ca50b9fcc Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 15 四月 2026 17:53:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_天津_阳光彩印' into dev_天津_阳光彩印

---
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml                          |    7 +++++--
 src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java |    4 +---
 src/main/java/com/ruoyi/sales/dto/SimpleProductDto.java                               |   24 ++++++++++++++++++++++++
 src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java               |    5 ++++-
 src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java                    |    3 ++-
 src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java             |   16 +++++++++++-----
 6 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
index 6d291f8..0b70308 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.basic.dto.ProductDto;
@@ -73,7 +74,9 @@
         queryWrapper.eq(ProductModel::getProductId, productDto.getId());
         queryWrapper.eq(productDto.getCreateUser() != null, ProductModel::getCreateUser, productDto.getCreateUser());
         queryWrapper.eq(productDto.getDeptId() != null, ProductModel::getDeptId, productDto.getDeptId());
-        queryWrapper.in(productDto.getDeptIds() != null && productDto.getDeptIds().length > 0, ProductModel::getDeptId, Arrays.asList(productDto.getDeptIds()));
+        if (ObjectUtils.isNotEmpty(productDto.getDeptIds())) {
+            queryWrapper.in( ProductModel::getDeptId, Arrays.asList(productDto.getDeptIds()));
+        }
         return productModelMapper.selectList(queryWrapper);
     }
 
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index d497c2e..a149329 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -349,9 +349,7 @@
             }
 
             /*娣诲姞鐢熶骇鏍哥畻        鍖哄垎宸ュ簭鏄浠惰繕鏄鏃�*/
-            BigDecimal workHours = (productProcess.getType() == 1)
-                    ? productProcess.getSalaryQuota().multiply(productQty)
-                    : productProcess.getSalaryQuota();
+            BigDecimal workHours = productProcess.getSalaryQuota();
 
             SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder()
                     .productMainId(productionProductMain.getId())
diff --git a/src/main/java/com/ruoyi/sales/dto/SimpleProductDto.java b/src/main/java/com/ruoyi/sales/dto/SimpleProductDto.java
new file mode 100644
index 0000000..6561e73
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/dto/SimpleProductDto.java
@@ -0,0 +1,24 @@
+package com.ruoyi.sales.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * @author buhuazhen
+ * @date 2026/4/15
+ * @email 3038525872@qq.com
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SimpleProductDto implements Serializable {
+    private Long id;
+    private String productCategory;
+    private String specificationModel;
+    private Long productModelId;
+    private String unit = "";
+    private String subUnit = "";
+}
diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
index 686fc2e..3bffba1 100644
--- a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
@@ -7,6 +7,7 @@
 import com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto;
 import com.ruoyi.sales.dto.LossProductModelDto;
 import com.ruoyi.sales.dto.SalesLedgerProductDto;
+import com.ruoyi.sales.dto.SimpleProductDto;
 import com.ruoyi.sales.pojo.SalesLedgerProduct;
 import org.apache.ibatis.annotations.Param;
 
@@ -22,7 +23,7 @@
  * @date 2025-05-08
  */
 public interface SalesLedgerProductMapper extends MyBaseMapper<SalesLedgerProduct> {
-    List<SalesLedgerProduct> selectProduct();
+    List<SimpleProductDto> selectProduct();
 
     List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct);
 
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index 35b0916..e1668ef 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -9,6 +9,7 @@
 import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.sales.dto.SimpleProductDto;
 import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
 import com.ruoyi.sales.pojo.SalesLedgerProduct;
 import com.ruoyi.stock.dto.StockInRecordDto;
@@ -29,6 +30,7 @@
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * <p>
@@ -117,7 +119,7 @@
     public R importStockInventory(MultipartFile file) {
         try {
             // 鏌ヨ鎵�鏈夌殑浜у搧
-            List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectProduct();
+            List<SimpleProductDto> salesLedgerProducts = salesLedgerProductMapper.selectProduct();
 
             ExcelUtil<StockInventoryExportData> util = new ExcelUtil<StockInventoryExportData>(StockInventoryExportData.class);
             List<StockInventoryExportData> list = util.importExcel(file.getInputStream());
@@ -127,12 +129,16 @@
 
             list.forEach(dto -> {
                 boolean matched = false;
-                for (SalesLedgerProduct item : salesLedgerProducts) {
+                for (SimpleProductDto item : salesLedgerProducts) {
                     if (ObjectUtils.isEmpty(dto.getWarehouseCode())) {
                         return;
                     }
                     if (item.getProductCategory().equals(dto.getProductName()) &&
-                            item.getSpecificationModel().equals(dto.getModel())) {
+                            item.getSpecificationModel().equals(dto.getModel())
+                            && Optional.ofNullable(item.getUnit()).orElse("").equals(dto.getUnit())
+                            && Optional.ofNullable(item.getSubUnit()).orElse("").equals(dto.getSubUnit())
+                    ) {
+
                         StockInventoryDto stockInventoryDto = new StockInventoryDto();
                         stockInventoryDto.setWarehouseCode(dto.getWarehouseCode());
                         stockInventoryDto.setWarehouseName(dto.getWarehouseName());
@@ -149,8 +155,8 @@
                 }
                 if (!matched) {
                     // 璁板綍鏈尮閰嶇殑鏁版嵁
-                    String unmatchedInfo = String.format("浜у搧鍚嶇О锛�%s锛岃鏍煎瀷鍙凤細%s",
-                            dto.getProductName(), dto.getModel());
+                    String unmatchedInfo = String.format("浜у搧鍚嶇О锛�%s锛岃鏍煎瀷鍙凤細%s 涓诲崟浣嶏細%s 杈呭崟浣嶏細%s",
+                            dto.getProductName(), dto.getModel(), dto.getUnit(), dto.getSubUnit());
                     unmatchedRecords.add(unmatchedInfo);
                 }
             });
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 73026c8..adad88d 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -153,11 +153,14 @@
                WHERE sl.id = #{salesLedegerId}) A
         group by a.model, a.product_name, a.unit
     </select>
-    <select id="selectProduct" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct">
+    <select id="selectProduct" resultType="com.ruoyi.sales.dto.SimpleProductDto">
         select
+            pm.id,
             p.product_name as product_category,
             pm.model as specification_model,
-            pm.id as product_model_id
+            pm.id as product_model_id,
+            pm.unit,
+            pm.sub_unit
         from product_model pm
         left join product p on pm.product_id = p.id
     </select>

--
Gitblit v1.9.3