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,