diff --git a/DOAN.Model/MES/report/MonthProuctModel.cs b/DOAN.Model/MES/report/MonthProuctModel.cs index 6e170e6..af50d47 100644 --- a/DOAN.Model/MES/report/MonthProuctModel.cs +++ b/DOAN.Model/MES/report/MonthProuctModel.cs @@ -94,6 +94,15 @@ namespace DOAN.Model.MES.report /// 停机总时长 /// public double TotalDowntimeHours { get; set; } + + /// + /// 计划总时长 + /// + public double TotalPlanHours { get; set; } + /// + /// 停机率 + /// + public double TotalDowntimeRate { get; set; } } public class ProductionCompletionModel diff --git a/DOAN.Service/MES/report/ReportService.cs b/DOAN.Service/MES/report/ReportService.cs index e733a08..04fb897 100644 --- a/DOAN.Service/MES/report/ReportService.cs +++ b/DOAN.Service/MES/report/ReportService.cs @@ -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; }