From 03403ba333c3c0b7e6b0ae6895a5481edbfb5d08 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 02 七月 2026 14:40:39 +0800
Subject: [PATCH] 采购台账,可用数量为实际入库数量。存在采购质检部分合格入库情况。只有可用数量大于0进行采购退货操作
---
src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml b/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
index 6732a66..a5314fd 100644
--- a/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseReturnOrdersMapper.xml
@@ -54,7 +54,7 @@
where pro.id = #{id}
</select>
<select id="listPageAccountPurchaseReturn"
- resultType="com.ruoyi.account.bean.vo.PurchaseReturnVo">
+ resultType="com.ruoyi.account.bean.vo.purchase.PurchaseReturnVo">
select pro.id,
pro.no returnNo,
t.inboundBatches,
@@ -75,6 +75,9 @@
where 1=1
<if test="req.returnNo != null and req.returnNo != ''">
and pro.no like concat('%',#{req.returnNo},'%')
+ </if>
+ <if test="req.supplierId != null">
+ and pro.supplier_id = #{req.supplierId}
</if>
<if test="req.supplierName != null and req.supplierName != ''">
and sm.supplier_name like concat('%',#{req.supplierName},'%')
@@ -103,7 +106,10 @@
LEFT JOIN quality_inspect qi ON sir.record_type = 10 AND sir.record_id = qi.id
LEFT JOIN purchase_ledger pl
ON pl.id = IF(sir.record_type = 7, sir.record_id, qi.purchase_ledger_id)
- LEFT JOIN sales_ledger_product slp ON pl.id = slp.sales_ledger_id
+ LEFT JOIN sales_ledger_product slp
+ ON pl.id = slp.sales_ledger_id
+ AND slp.product_model_id = sir.product_model_id
+ AND slp.type = 2
LEFT JOIN (
SELECT
stock_in_record_id,
@@ -113,7 +119,7 @@
WHERE 1=1
GROUP BY stock_in_record_id
) rs ON rs.stock_in_record_id = sir.id
- WHERE sir.approval_status = 1 AND slp.type = 2
+ WHERE sir.approval_status = 1
AND sir.record_type IN ('7','10')
and pl.id = #{purchaseLedgerId}
</select>
--
Gitblit v1.9.3