From b93fa3243f3651f72387acf24c0c28dab3f66213 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 13 Oct 2025 09:54:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(dms):=E4=BF=AE=E5=A4=8D=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=AD=E6=97=B6=E9=97=B4=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将大于等于符号(>=)修正为转义字符(>=) - 确保停机时间和标准秒数比较逻辑正确 - 统一时间比较表达式的转义格式 - 修复产量损失计算中的条件判断 - 保证故障延迟统计的准确性 --- .../main/resources/mapper/dms/DmsReportMapper.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/hwmom-dms/src/main/resources/mapper/dms/DmsReportMapper.xml b/ruoyi-modules/hwmom-dms/src/main/resources/mapper/dms/DmsReportMapper.xml index 2480c658..50205325 100644 --- a/ruoyi-modules/hwmom-dms/src/main/resources/mapper/dms/DmsReportMapper.xml +++ b/ruoyi-modules/hwmom-dms/src/main/resources/mapper/dms/DmsReportMapper.xml @@ -34,8 +34,8 @@ coalesce( 公式:停机秒数 ÷ 标准秒/件 = 损失件数 cast(case when fb.real_begin_time is not null and fb.real_end_time is not null - and fb.real_end_time >= fb.real_begin_time - and fb.standard_seconds_per_unit is not null and fb.standard_seconds_per_unit > 0 + and fb.real_end_time >= fb.real_begin_time + and fb.standard_seconds_per_unit is not null and fb.standard_seconds_per_unit > 0 then (datediff(second, fb.real_begin_time, fb.real_end_time) / fb.standard_seconds_per_unit) else 0.0 end as decimal(18,2)) as output_loss_qty @@ -105,7 +105,7 @@ where mp2.machine_id = fb.machine_id - 同一机台 g.fault_type, count(1) as fault_count, sum(g.downtime_hours) as total_downtime_hours, - sum(case when g.real_end_time is not null and g.require_end_time is not null and g.real_end_time > g.require_end_time then 1 else 0 end) as delay_count, + sum(case when g.real_end_time is not null and g.require_end_time is not null and g.real_end_time > g.require_end_time then 1 else 0 end) as delay_count, sum(g.output_loss_qty) as total_output_loss, sum(g.order_delay_count) as total_order_delay_count from ( @@ -135,14 +135,14 @@ where mp2.machine_id = fb.machine_id - 同一机台 -- 故障类型:确保转换为字符串类型并处理空值 cast(coalesce(af.fault_type, '') as varchar(10)) as fault_type, cast(case - when fb.real_begin_time is not null and fb.real_end_time is not null and fb.real_end_time >= fb.real_begin_time + when fb.real_begin_time is not null and fb.real_end_time is not null and fb.real_end_time >= fb.real_begin_time then datediff(second, fb.real_begin_time, fb.real_end_time) / 3600.0 else 0.0 end as decimal(18,6)) as downtime_hours, -- 产量损失:停机秒数 / 标准秒/件 cast(case - when fb.real_begin_time is not null and fb.real_end_time is not null and fb.real_end_time >= fb.real_begin_time - and fb.standard_seconds_per_unit is not null and fb.standard_seconds_per_unit > 0 + when fb.real_begin_time is not null and fb.real_end_time is not null and fb.real_end_time >= fb.real_begin_time + and fb.standard_seconds_per_unit is not null and fb.standard_seconds_per_unit > 0 then (datediff(second, fb.real_begin_time, fb.real_end_time) / fb.standard_seconds_per_unit) else 0.0 end as decimal(18,2)) as output_loss_qty,