From 664db98c9e8595ce4dd636a27f480e3a08b81ff5 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 21 二月 2025 11:13:51 +0800
Subject: [PATCH] 新增可忽略的维修时间
---
modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml | 108 +++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 90 insertions(+), 18 deletions(-)
diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
index d35bb9e..a81cd95 100644
--- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -11,7 +11,7 @@
AND WeightedFailure > 0 THEN
1 / WeightedFailure
ELSE 0
- END AS basic_mtbf_regulate,
+ END AS basic_mtbf_regulate_tmp,
CASE
WHEN WeightedFailure IS NOT NULL
AND WeightedFailure > 0 THEN
@@ -24,23 +24,25 @@
sum(
CASE
WHEN b.product_type < 5 THEN
- 1 * 1 / basic_mtbf_regulate
+ 1 * 1 / basic_mtbf_regulate_tmp
WHEN a.reliab_distrib_type = 1 THEN
- 1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate
- WHEN a.reliab_distrib_type = 2 THEN
- 1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regul_succ_rate
+ a.basic_unit_num * a.basic_mtbf_operating_ratio /
+ a.basic_mtbf_regulate_tmp
+ WHEN a.reliab_distrib_type = 3 THEN
+ a.basic_unit_num * a.basic_mtbf_operating_ratio /
+ a.basic_mtbf_regulate_tmp
ELSE 0 END
) AS WeightedFailure,
sum(
CASE
WHEN b.product_type < 5 THEN
- 1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate
+ 1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate_tmp
WHEN a.repairable = 1 and a.reliab_distrib_type = 1 THEN
- 1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
- a.basic_mtbf_regulate
- WHEN a.repairable = 1 and a.reliab_distrib_type = 2 THEN
- 1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
- a.basic_mtbf_regul_succ_rate
+ a.basic_unit_num * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+ a.basic_mtbf_regulate_tmp
+ WHEN a.repairable = 1 and a.reliab_distrib_type = 3 THEN
+ a.basic_unit_num * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+ a.basic_mtbf_regulate_tmp
ELSE 0
END
) AS WeightedMttr
@@ -59,23 +61,89 @@
AND ((b.product_type = 5 AND a.basic_join_compute = 1
and ((
a.reliab_distrib_type = 1
- AND a.basic_mtbf_regulate > 0
+ AND a.basic_mtbf_regulate_tmp > 0
)
- OR (a.reliab_distrib_type = 2 AND a.basic_mtbf_regul_succ_rate > 0))
+ OR (a.reliab_distrib_type = 3 AND a.basic_mtbf_regul_succ_rate > 0))
)
- || (b.product_type < 5 AND a.basic_mtbf_regulate > 0))
+ || (b.product_type < 5 AND a.basic_mtbf_regulate_tmp > 0))
GROUP BY c.id, c.name
) c
) d
- set f.basic_mtbf_regulate = d.basic_mtbf_regulate,
- f.repair_mttcr = d.repair_mttcr
+ set f.basic_mtbf_regulate_tmp = d.basic_mtbf_regulate_tmp,
+ f.repair_mttcr = d.repair_mttcr
where f.product_id = d.id;
+ </update>
+
+ <update id="compute1">
+ UPDATE param_data a, product_model b
+ SET repair_mttcr = 0
+ where b.ship_id = ${shipId}
+ and repair_mttcr is null;
+
+ UPDATE param_data a, product_model b
+ SET basic_mtbf_regulate_tmp = basic_mtbf_regulate
+ where b.ship_id = ${shipId};
+
+ UPDATE param_data a, product_model b
+ SET basic_mtbf_regulate_tmp = basic_mtbf_regul_succ_rate/(1-basic_mtbf_regul_succ_rate)
+ where b.ship_id = ${shipId}
+ and reliab_distrib_type = 3
</update>
<update id="compute2">
UPDATE param_data a, product_model b
- SET ai = basic_mtbf_regulate / (basic_mtbf_regulate + repair_mttcr)
+ SET basic_mtbf_regulate = basic_mtbf_regulate_tmp
where b.ship_id = ${shipId}
+ and (reliab_distrib_type = 1 or reliab_distrib_type is null)
+ and a.product_id = b.id
+ and a.IS_DELETE = 0
+ and b.IS_DELETE = 0;
+
+ UPDATE param_data a, product_model b
+ SET ai = basic_mtbf_regulate_tmp / (basic_mtbf_regulate_tmp + repair_mttcr)
+ where b.ship_id = ${shipId}
+ and a.product_id = b.id
+ and a.IS_DELETE = 0
+ and b.IS_DELETE = 0;
+
+ UPDATE param_data a,(
+ select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
+ from param_data a,
+ product_model b
+ where b.ship_id = ${shipId}
+ and a.product_id = b.id
+ and a.basic_join_compute = 1
+ and b.product_type = 5
+ group by b.pid
+ ) b
+ set a.basic_join_compute = b.basic_join_compute
+ where a.product_id = b.pid;
+
+ UPDATE param_data a,(
+ select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
+ from param_data a,
+ product_model b
+ where b.ship_id = ${shipId}
+ and a.product_id = b.id
+ and a.basic_join_compute = 1
+ and b.product_type = 4
+ group by b.pid
+ ) b
+ set a.basic_join_compute = b.basic_join_compute
+ where a.product_id = b.pid;
+
+ UPDATE param_data a,(
+ select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
+ from param_data a,
+ product_model b
+ where b.ship_id = ${shipId}
+ and a.product_id = b.id
+ and a.basic_join_compute = 1
+ and b.product_type = 3
+ group by b.pid
+ ) b
+ set a.basic_join_compute = b.basic_join_compute
+ where a.product_id = b.pid;
</update>
<select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData">
@@ -85,11 +153,15 @@
b.ai,
b.basic_mtbf_regulate,
b.repair_mttcr,
- b.basic_mtbf_operating_ratio
+ b.basic_mtbf_operating_ratio,
+ b.basic_mtbf_regul_succ_rate,
+ b.basic_runs_num,
+ b.basic_unit_num
FROM product_model a
LEFT JOIN param_data b ON b.product_id = a.id and b.is_delete = 0
where a.is_delete = 0
and a.product_type <> 10
+ and b.basic_join_compute = 1
and a.ship_id = ${shipId}
or a.id = ${shipId}
ORDER BY a.product_type, a.sort
--
Gitblit v1.9.1