94 lines
3.1 KiB
C#
94 lines
3.1 KiB
C#
using DeviceRepair.Models.Enum;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace DeviceRepair.Models.Common
|
|
{
|
|
/// <summary>
|
|
/// 当前年度计划完成进度
|
|
/// </summary>
|
|
public class CurrentYearPlanSchedule
|
|
{
|
|
public CurrentYearPlanSchedule()
|
|
{
|
|
TimeOut = 0;
|
|
Complete = 0;
|
|
Current = 0;
|
|
Future = 0;
|
|
}
|
|
|
|
|
|
public CurrentYearPlanSchedule(IList<AnnualMaintenancePlan> Datas) : this()
|
|
{
|
|
if (Datas == null || Datas.Count > 0)
|
|
{
|
|
Datas.ToList().ForEach(item =>
|
|
{
|
|
for (int i = 0; i < 12; i++)
|
|
{
|
|
string fileName = $"{(new System.Globalization.CultureInfo("en-US")).DateTimeFormat.MonthNames[i].Substring(0, 3)}Status";
|
|
if (item.GetType().GetProperty(fileName) == null)
|
|
return;
|
|
|
|
EnumPlanCompleteStatus value = (EnumPlanCompleteStatus)item.GetType().GetProperty(fileName).GetValue(item, null);
|
|
switch (value)
|
|
{
|
|
case EnumPlanCompleteStatus.None:
|
|
break;
|
|
case EnumPlanCompleteStatus.TimeOut:
|
|
TimeOut += 1;
|
|
break;
|
|
case EnumPlanCompleteStatus.Complete:
|
|
Complete += 1;
|
|
break;
|
|
case EnumPlanCompleteStatus.Current:
|
|
Current += 1;
|
|
break;
|
|
case EnumPlanCompleteStatus.Future:
|
|
Future += 1;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 总数
|
|
/// </summary>
|
|
public int Total { get; set; }
|
|
|
|
/// <summary>
|
|
/// 已超时
|
|
/// </summary>
|
|
public int TimeOut { get; set; }
|
|
|
|
/// <summary>
|
|
/// 已完成
|
|
/// </summary>
|
|
public int Complete { get; set; }
|
|
|
|
/// <summary>
|
|
/// 当前月待处理
|
|
/// </summary>
|
|
public int Current { get; set; }
|
|
|
|
/// <summary>
|
|
/// 未来处理
|
|
/// </summary>
|
|
public int Future { get; set; }
|
|
|
|
public void CalcTotal()
|
|
{
|
|
Total = TimeOut + Complete + Current + Future;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"<backcolor=91,192,222>全年欲保养数:{Total}<nbsp></backcolor><backcolor=255,255,129><nbsp>当月待保养数:{Current}<nbsp></backcolor><backcolor=192,255,192><nbsp>全年已完成:{Complete}<nbsp></backcolor><backcolor=255,126,126><nbsp>已超时数:{TimeOut}<nbsp></backcolor><backcolor=255,255,129><nbsp>全年待完成数:{Current + Future}</backcolor>";
|
|
}
|
|
}
|
|
}
|