总停机时率

This commit is contained in:
chenlin 2026-02-05 09:20:37 +08:00
parent 9d60544dd0
commit eb6c4151f8
2 changed files with 13 additions and 1 deletions

View File

@ -94,6 +94,15 @@ namespace DOAN.Model.MES.report
/// 停机总时长
/// </summary>
public double TotalDowntimeHours { get; set; }
/// <summary>
/// 计划总时长
/// </summary>
public double TotalPlanHours { get; set; }
/// <summary>
/// 停机率
/// </summary>
public double TotalDowntimeRate { get; set; }
}
public class ProductionCompletionModel

View File

@ -112,6 +112,7 @@ namespace DOAN.Service.MES.report
}).ToList();
var totalDowntimeHours = response.Sum(it => it.DowntimeHours);
var totalPlanHours = groupListWorkRoute.Sum(it => it.PlanHours);
var groupList = response.GroupBy(it => it.LineCode).Select(it => new
{
LineCode = it.Key,
@ -128,7 +129,9 @@ namespace DOAN.Service.MES.report
PlanHours = l.PlanHours,
DowntimeHours = gList.FirstOrDefault()?.DowntimeHours ?? 0, // 如果没有停机时间则为0
DowntimeRate = l.PlanHours == 0 ? 0 : Math.Round((gList.FirstOrDefault()?.DowntimeHours ?? 0) / l.PlanHours, 2),
TotalDowntimeHours = totalDowntimeHours
TotalDowntimeHours = totalDowntimeHours,
TotalPlanHours = totalPlanHours,
TotalDowntimeRate = totalPlanHours == 0 ? 0 : Math.Round(totalDowntimeHours / totalPlanHours, 2)
}).ToList();
return result;
}