From 3ce910ea493dea8a3778bcb9532d73f71741a3b2 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 23 五月 2026 12:42:32 +0800
Subject: [PATCH] 发货台账删除如果审核就不允许删除
---
src/main/resources/mapper/quality/QualityInspectMapper.xml | 61 +++++++++++++++++++-----------
1 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/src/main/resources/mapper/quality/QualityInspectMapper.xml b/src/main/resources/mapper/quality/QualityInspectMapper.xml
index e5ce119..0ac0254 100644
--- a/src/main/resources/mapper/quality/QualityInspectMapper.xml
+++ b/src/main/resources/mapper/quality/QualityInspectMapper.xml
@@ -9,8 +9,8 @@
pl.purchase_contract_number as purchase_contract_no
</when>
<otherwise>
- pwo.work_order_no,
- sl.sales_contract_no
+ pot.work_order_no,
+ po_sales.sales_contract_no
</otherwise>
</choose>
FROM
@@ -21,9 +21,17 @@
</when>
<otherwise>
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 po.id = pwo.product_order_id
- left join sales_ledger sl ON sl.id = po.sales_ledger_id
+ LEFT JOIN production_operation_task pot ON ppm.production_operation_task_id = pot.id
+ left join production_order po ON po.id = pot.production_order_id
+ left join (
+ select po2.id as order_id,
+ group_concat(distinct sl2.sales_contract_no order by sl2.sales_contract_no separator ',') as sales_contract_no
+ from production_order po2
+ left join production_plan pp2
+ on find_in_set(pp2.id, replace(replace(replace(po2.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+ left join sales_ledger sl2 on sl2.id = pp2.sales_ledger_id
+ group by po2.id
+ ) po_sales ON po_sales.order_id = po.id
</otherwise>
</choose>
WHERE
@@ -120,8 +128,7 @@
COALESCE(SUM(
CASE
WHEN qi.inspect_state = 1
- AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ THEN qi.qualified_quantity
ELSE 0
END
), 0) AS qualifiedCount,
@@ -129,8 +136,7 @@
COALESCE(SUM(
CASE
WHEN qi.inspect_state = 1
- AND qi.check_result = '涓嶅悎鏍�'
- THEN qi.quantity
+ THEN qi.unqualified_quantity
ELSE 0
END
), 0) AS unqualifiedCount,
@@ -158,8 +164,7 @@
COALESCE(SUM(
CASE
WHEN qi.inspect_state = 1
- AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ THEN qi.qualified_quantity
ELSE 0
END
), 0)
@@ -240,8 +245,8 @@
/* 鍚堟牸 */
COALESCE(SUM(
CASE
- WHEN qi.inspect_state = 1 AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ WHEN qi.inspect_state = 1
+ THEN qi.qualified_quantity
ELSE 0
END
), 0) AS qualifiedCount,
@@ -249,8 +254,8 @@
/* 涓嶅悎鏍� */
COALESCE(SUM(
CASE
- WHEN qi.inspect_state = 1 AND qi.check_result = '涓嶅悎鏍�'
- THEN qi.quantity
+ WHEN qi.inspect_state = 1
+ THEN qi.unqualified_quantity
ELSE 0
END
), 0) AS unqualifiedCount,
@@ -271,8 +276,8 @@
ROUND(
COALESCE(SUM(
CASE
- WHEN qi.inspect_state = 1 AND qi.check_result = '鍚堟牸'
- THEN qi.quantity
+ WHEN qi.inspect_state = 1
+ THEN qi.qualified_quantity
ELSE 0
END
), 0)
@@ -304,7 +309,6 @@
<select id="getYearlyPassRateStatistics" resultType="com.ruoyi.quality.dto.QualityPassRateDto">
SELECT t.modelType,
-
COALESCE(SUM(
CASE
WHEN pp.product_name = '鍘熸潗鏂�' AND t.modelType = 0 THEN qi.quantity
@@ -312,8 +316,23 @@
WHEN pp.product_name = '鎴愬搧' AND t.modelType = 2 THEN qi.quantity
ELSE 0
END
- ), 0) AS totalCount
-
+ ), 0) AS totalCount,
+ COALESCE(SUM(
+ CASE
+ WHEN pp.product_name = '鍘熸潗鏂�' AND t.modelType = 0 THEN qi.qualified_quantity
+ WHEN pp.product_name = '鍗婃垚鍝�' AND t.modelType = 1 THEN qi.qualified_quantity
+ WHEN pp.product_name = '鎴愬搧' AND t.modelType = 2 THEN qi.qualified_quantity
+ ELSE 0
+ END
+ ), 0) AS qualifiedCount,
+ COALESCE(SUM(
+ CASE
+ WHEN pp.product_name = '鍘熸潗鏂�' AND t.modelType = 0 THEN qi.unqualified_quantity
+ WHEN pp.product_name = '鍗婃垚鍝�' AND t.modelType = 1 THEN qi.unqualified_quantity
+ WHEN pp.product_name = '鎴愬搧' AND t.modelType = 2 THEN qi.unqualified_quantity
+ ELSE 0
+ END
+ ), 0) AS unqualifiedCount
FROM (SELECT 0 AS modelType
UNION ALL
SELECT 1
@@ -326,8 +345,6 @@
ON qi.product_model_id = pm.id
AND YEAR(qi.check_time) = #{year}
AND qi.inspect_state = 1
- AND qi.check_result = '鍚堟牸'
-
GROUP BY t.modelType
ORDER BY t.modelType;
</select>
--
Gitblit v1.9.3