2023-04-28 12:21:24 +08:00

167 lines
6.1 KiB
C#

using Foresight.Fleet.Services.AssetHealth;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IronIntel.Contractor.Maintenance
{
public class AlertInfo
{
public long AlertID { get; set; }
public long WorkOrderID { get; set; }
public string WorkOrderStatus { get; set; }
public string AlertType { get; set; }
public DateTime AlertTime_UTC { get; set; }
public string AlertTime_UTCStr { get { return AlertTime_UTC == DateTime.MinValue ? "" : AlertTime_UTC.ToString(); } }
public DateTime AlertLocalTime { get; set; }
public string AlertLocalTimeStr { get { return AlertLocalTime == DateTime.MinValue ? "" : AlertLocalTime.ToString(); } }
public bool Completed { get; set; }
public long MachineID { get; set; }
public int ModelID { get; set; }
public string Model { get; set; }
public int MakeID { get; set; }
public string Make { get; set; }
public string VIN { get; set; }
public string MachineName { get; set; }
private double _EngineHours;
public double EngineHours
{
get
{
return _EngineHours;
}
set
{
value = value > 0 ? value : 0;
_EngineHours = Math.Round(value, 2);
}
}
private double _CurrentHours;
public double CurrentHours
{
get
{
return _CurrentHours;
}
set
{
value = value > 0 ? value : 0;
_CurrentHours = Math.Round(value, 2);
}
}
public string Description { get; set; }
public string FormatDescription(string desc)
{
if (!string.IsNullOrEmpty(desc))
{
if (desc.IndexOf("\r\n") > 0)
desc = desc.Substring(0, desc.IndexOf("\r\n"));
if (desc.IndexOf("\n") > 0)
desc = desc.Substring(0, desc.IndexOf("\n"));
}
return desc;
}
public string ServiceDescription { get; set; } = "";
public string ScheduleID { get; set; }
public string IntervalID { get; set; }
public bool Recurring { get; set; }
public int Priority { get; set; }
public double ExpectedCost { get; set; }
public int AlertCount { get; set; }
public List<long> RepeatedAlerts { get; set; }
public int OpenWorkOrderCount { get; set; }//针对Alert对应的机器
public string PMType { get; set; }
public string AcknowledgedBy { get; set; }
public string AcknowledgedByName { get; set; }
public DateTime AcknowledgedTime_UTC { get; set; }
public string AcknowledgedTime_UTCStr { get { return AcknowledgedTime_UTC == DateTime.MinValue ? "" : AcknowledgedTime_UTC.ToString(); } }
public DateTime AcknowledgedTime_Local { get; set; }
public string AcknowledgedTime_LocalStr { get { return AcknowledgedTime_Local == DateTime.MinValue ? "" : AcknowledgedTime_Local.ToString(); } }
public string AcknowledgedComment { get; set; }
}
public class MachineInfoForAlert
{
public long MachineID { get; set; }
public string VIN { get; set; }
public string MachineName { get; set; }
public string Make { get; set; }
public string Model { get; set; }
private double _EngineHours;
public double EngineHours
{
get
{
return _EngineHours;
}
set
{
value = value > 0 ? value : 0;
_EngineHours = Math.Round(value, 2);
}
}
public int DTCAlertCount { get; set; }
public int PMAlertCount { get; set; }
public int InspectAlertCount { get; set; }
public int OpenWorkOrders { get; set; }
public DateTime LatestAlertDateTime { get; set; }
public string LatestAlertDateTimeStr { get { return LatestAlertDateTime == DateTime.MinValue ? "" : LatestAlertDateTime.ToString(); } }
public List<AlertInfo> Alerts { get; } = new List<AlertInfo>();
}
public class AssetAlertInfo
{
public long ID { get; set; }
public DateTime AlertTime { get; set; }
public string AlertTimeStr { get { return AlertTime == DateTime.MinValue ? "" : AlertTime.ToString(); } }
public DateTime AlertLocalTime { get; set; }
public string AlertLocalTimeStr { get { return AlertLocalTime == DateTime.MinValue ? "" : AlertLocalTime.ToString(); } }
public string AlertType { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string FormatDescription(string desc)
{
if (!string.IsNullOrEmpty(desc))
{
if (desc.IndexOf("\r\n") > 0)
desc = desc.Substring(0, desc.IndexOf("\r\n"));
if (desc.IndexOf("\n") > 0)
desc = desc.Substring(0, desc.IndexOf("\n"));
}
return desc;
}
public long AssetID { get; set; }
public string VIN { get; set; }
public string AssetName { get; set; }
public string ModelName { get; set; }
public string MakeName { get; set; }
public string AssetTypeName { get; set; }
private double _EngineHours;
public double EngineHours
{
get
{
return _EngineHours;
}
set
{
value = value > 0 ? value : 0;
_EngineHours = Math.Round(value, 2);
}
}
public bool Completed { get; set; }
public DateTime? CompletedDate { get; set; }
public string CompletedDateStr { get { return CompletedDate == null ? "" : CompletedDate.ToString(); } }
public AssetAlertCategory Category { get; set; }
public string ServiceDescription { get; set; }
}
}