From 2b758e6ab222a4efc9b2efd8167715cb96f73f05 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期四, 30 四月 2026 17:36:48 +0800
Subject: [PATCH] 审核附件修改

---
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 712124a..a1d05e9 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -29,10 +29,17 @@
         select slp.*
         from quality_inspect qi
                  left join production_product_main ppm on qi.product_main_id = ppm.id
-                 left join product_work_order pwo on ppm.work_order_id = pwo.id
-                 left join product_order po on pwo.product_order_id = po.id
-                 left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1
+                 left join production_operation_task pot on ppm.production_operation_task_id = pot.id
+                 left join production_order po on pot.production_order_id = po.id
+                 left join production_plan pp_main
+                           on find_in_set(pp_main.id, replace(replace(replace(po.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+                 left join sales_ledger_product slp on slp.sales_ledger_id = pp_main.sales_ledger_id
+            and slp.product_model_id = po.product_model_id
+            and slp.type = 1
         where qi.product_main_id = #{productMainId}
+          and slp.id is not null
+        order by slp.id desc
+        limit 1
 
 
     </select>
@@ -131,9 +138,7 @@
         <if test="req.productCategory != null and req.productCategory != ''">
             AND slp.product_category = #{req.productCategory}
         </if>
-        <!-- 鎸変骇鍝佸ぇ绫诲垎缁勮仛鍚� -->
-        GROUP BY slp.product_category
-        <!-- 鎸変骇鍝佸ぇ绫绘帓搴� -->
+        GROUP BY slp.product_category, slp.specification_model, sl.supplier_name
         ORDER BY slp.product_category
     </select>
     <select id="selectProductBomStructure" resultType="com.ruoyi.sales.dto.LossProductModelDto">

--
Gitblit v1.9.3