From a0914318549b357ef3c438d0c2a3714f58ea3487 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 23 一月 2026 14:14:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | 51 ++++++++++++++++++++++++++++++++++++---------------
1 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 2579a18..67c56c7 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -15,10 +15,10 @@
<where>
1=1
<if test="salesLedgerProduct.salesLedgerId != null and salesLedgerProduct.salesLedgerId != '' ">
- AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
+ AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
</if>
<if test="salesLedgerProduct.type != null and salesLedgerProduct.type != '' ">
- AND T1.type = #{salesLedgerProduct.type}
+ AND T1.type = #{salesLedgerProduct.type}
</if>
</where>
</select>
@@ -27,7 +27,7 @@
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 product_order po on pwo.product_order_id = po.id
left join sales_ledger_product slp on po.product_model_id = slp.id
where qi.product_main_id = #{productMainId}
@@ -44,22 +44,22 @@
<where>
slp.type = 1
<if test="req.salesContractNo != null and req.salesContractNo != '' ">
- AND sl.sales_contract_no like concat('%',#{req.salesContractNo},'%')
+ AND sl.sales_contract_no like concat('%',#{req.salesContractNo},'%')
</if>
<if test="req.customerContractNo != null and req.customerContractNo != '' ">
- AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%')
+ AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%')
</if>
<if test="req.projectName != null and req.projectName != '' ">
- AND sl.project_name like concat('%',#{req.projectName},'%')
+ AND sl.project_name like concat('%',#{req.projectName},'%')
</if>
<if test="req.customerName != null and req.customerName != '' ">
- AND sl.customer_name like concat('%',#{req.customerName},'%')
+ AND sl.customer_name like concat('%',#{req.customerName},'%')
</if>
<if test="req.productCategory != null and req.productCategory != '' ">
- AND slp.product_category like concat('%',#{req.productCategory},'%')
+ AND slp.product_category like concat('%',#{req.productCategory},'%')
</if>
<if test="req.status != null and req.status ">
- AND slp.pending_invoice_total > 0
+ AND slp.pending_invoice_total > 0
</if>
</where>
order by slp.register_date desc
@@ -76,22 +76,22 @@
<where>
slp.type = 2
<if test="req.purchaseContractNumber != null and req.purchaseContractNumber != '' ">
- AND sl.purchase_contract_number like concat('%',#{req.purchaseContractNumber},'%')
+ AND sl.purchase_contract_number like concat('%',#{req.purchaseContractNumber},'%')
</if>
<if test="req.customerContractNo != null and req.customerContractNo != '' ">
- AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%')
+ AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%')
</if>
<if test="req.projectName != null and req.projectName != '' ">
- AND sl.project_name like concat('%',#{req.projectName},'%')
+ AND sl.project_name like concat('%',#{req.projectName},'%')
</if>
<if test="req.customerName != null and req.customerName != '' ">
- AND sl.customer_name like concat('%',#{req.customerName},'%')
+ AND sl.customer_name like concat('%',#{req.customerName},'%')
</if>
<if test="req.productCategory != null and req.productCategory != '' ">
- AND slp.product_category like concat('%',#{req.productCategory},'%')
+ AND slp.product_category like concat('%',#{req.productCategory},'%')
</if>
<if test="req.status != null and req.status ">
- AND slp.pending_invoice_total > 0
+ AND slp.pending_invoice_total > 0
</if>
</where>
order by slp.register_date desc
@@ -126,4 +126,25 @@
<!-- 鎸変骇鍝佸ぇ绫绘帓搴� -->
ORDER BY slp.product_category
</select>
+ <select id="selectProductBomStructure" resultType="com.ruoyi.sales.dto.LossProductModelDto">
+ select
+ a.model,
+ a.product_name,
+ a.unit,
+ sum(a.single_quantity) AS loss_num
+ from (SELECT ps.unit,
+ ps.unit_quantity,
+ pm1.model,
+ p.product_name,
+ ps.unit_quantity * slp.quantity AS single_quantity
+ FROM sales_ledger sl
+ LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id
+ LEFT JOIN product_model pm ON pm.id = slp.product_model_id
+ LEFT JOIN product_bom pb ON pb.product_model_id = pm.id
+ LEFT JOIN product_structure ps ON pb.id = ps.bom_id
+ LEFT JOIN product_model pm1 ON pm1.id = ps.product_model_id
+ LEFT JOIN product p ON p.id = pm1.product_id
+ WHERE sl.id = #{salesLedegerId}) A
+ group by a.model, a.product_name, a.unit
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3