413 lines
15 KiB
C#

using Foresight.Fleet.Services.Asset;
using Foresight.ServiceModel;
using IronIntel.Services.Business.Admin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IronIntel.Contractor.Machines
{
public class AssetBasicItem
{
public long ID { get; set; }
public string Name { get; set; }
public string Name2 { get; set; }
public string MakeName { get; set; }
public string ModelName { get; set; }
private double _EngineHours;
public double EngineHours
{
get
{
return _EngineHours;
}
set
{
value = value > 0 ? value : 0;
_EngineHours = Math.Round(value, 2);
}
}
public string CalampDeviceAirID { get; set; }
public bool TelematicsEnabled { get; set; }
public bool Hide { get; set; }
public bool OnRoad { get; set; }
public int MakeYear { get; set; }
public string DealerID { get; set; }
public string Dealer { get; set; }
public string ContractorID { get; set; }
public string Contractor { get; set; }
public string TypeName { get; set; }
public int ModelID { get; set; }
public int TypeID { get; set; }
public int MakeID { get; set; }
public string VIN { get; set; }
public DateTime? EngineHoursDate { get; set; }
public string DisplayName
{
get
{
//DisplayName取值顺序为Name2,Name,VIN,ID用于前端显示
string name = Name2;
if (string.IsNullOrWhiteSpace(name))
name = Name;
if (string.IsNullOrWhiteSpace(name))
name = VIN;
if (string.IsNullOrWhiteSpace(name))
name = ID.ToString();
return name;
}
}
public string EngineHoursDateStr { get { return EngineHoursDate == null ? "" : EngineHoursDate.Value.ToShortDateString(); } }
public string EngineHoursDateTimeStr { get { return EngineHoursDate == null ? "" : EngineHoursDate.Value.ToString(); } }
}
public class AssetDetailItem2
{
public bool IgnoreDuplicate { get; set; }//忽略重复
public long ID { get; set; }
public string Name { get; set; }
public string Name2 { get; set; }
public string VIN { get; set; }
public int MakeID { get; set; }
public string MakeName { get; set; }
public int ModelID { get; set; }
public string ModelName { get; set; }
public int TypeID { get; set; }
public string TypeName { get; set; }
public int MakeYear { get; set; }
private double? _EngineHours;
public double? EngineHours
{
get
{
return _EngineHours;
}
set
{
if (value != null)
_EngineHours = Math.Round(value.Value, 2);
else
_EngineHours = value;
}
}
public DateTime? EngineHoursLocalTime { get; set; }
private double? _Odometer;
public double? Odometer
{
get
{
return _Odometer;
}
set
{
if (value != null)
_Odometer = Math.Round(value.Value, 2);
else
_Odometer = value;
}
}
public DateTime? OdometerLocalTime { get; set; }
public string OdometerUnits { get; set; }
public string Description { get; set; }
public string PairedDeviceSN { get; set; }
public double? UnderCarriageHours { get; set; }
public bool TelematicsEnabled { get; set; }
public bool Hidden { get; set; }
public bool OnRoad { get; set; }
public string EQClass { get; set; }
public string CostCenter { get; set; }
public string AquisitionType { get; set; }
public DateTime? AddedLocalTime { get; set; }
public DateTime? AddedTime { get; set; }
public string AddedByUserName { get; set; }
public string IconFileName { get; set; }
public string ContractorID { get; set; }
public long OnSiteJobsiteID { get; set; }
public string[] ContactIDs { get; set; }
public string[] MachineGroupIDs { get; set; }
public MachineRentalInfo MachineRental { get; set; }
public MachineAttributeClient[] MachineAttributes { get; set; }
public StringKeyValue[] VisibleOnWorkOrders { get; set; }
public string AddedOnStr
{
get { return AddedLocalTime == null ? "" : AddedLocalTime.Value.ToString("MM/dd/yyyy"); }
}
public string EngineHoursDateTimeStr
{
get { return EngineHoursLocalTime == null ? "" : EngineHoursLocalTime.Value.ToString("MM/dd/yyyy"); }
}
public string OdometerDateTimeStr
{
get { return OdometerLocalTime == null ? "" : OdometerLocalTime.Value.ToString("MM/dd/yyyy"); }
}
}
public class MachineItem
{
public Int64 MachineID { get; set; }
public int TypeID { get; set; }
public string MachineType { get; set; }
public int ModelID { get; set; }
public string Model { get; set; }
public int MakeID { get; set; }
public string Make { get; set; }
public string MakeIconColor { get; set; }
public string VIN { get; set; }
public string Name { get; set; }
public string Name2 { get; set; }
public int MakeYear { get; set; }
public string Notes { get; set; }
public string ContractorID { get; set; }
public string Contractor { get; set; }
public string DealerID { get; set; }
public string Dealer { get; set; }
public int Status { get; set; }
public Int64 GpsDeviceID { get; set; } //空 -1
public string GpsDeviceSN { get; set; } = string.Empty; //空 -1
public double StartingEngineHours { get; set; }
private double _EngineHours;
public double EngineHours
{
get
{
return _EngineHours;
}
set
{
value = value > 0 ? value : 0;
_EngineHours = Math.Round(value, 2);
}
}
public DateTime EngineHoursDate { get; set; }
public string EngineHoursDateStr { get { return EngineHoursDate == DateTime.MinValue ? "" : EngineHoursDate.ToShortDateString(); } }
public string EngineHoursDateTimeStr { get { return EngineHoursDate == DateTime.MinValue ? "" : EngineHoursDate.ToString(); } }
public bool Hide { get; set; }
public double ODOStart2 { get; set; }
private double _ODOMeter;
public double ODOMeter
{
get
{
return _ODOMeter;
}
set
{
value = value > 0 ? value : 0;
_ODOMeter = Math.Round(value, 2);
}
}
public DateTime ODOMeterDate { get; set; }
public string ODOMeterDateStr { get { return ODOMeterDate == DateTime.MinValue ? "" : ODOMeterDate.ToShortDateString(); } }
public string ODOMeterDateTimeStr { get { return ODOMeterDate == DateTime.MinValue ? "" : ODOMeterDate.ToString(); } }
public string ODOMeterUom { get; set; }
public double FuelCost { get; set; }
public string FuelCostUom { get; set; }
public double MachineRate { get; set; }
public string WorkType { get; set; }
public double RetirementHours { get; set; }
public double RetirementOdo { get; set; }
public bool OnRoad { get; set; }
public DateTime LeaseStart { get; set; }
public string LeaseStartStr { get { return LeaseStart == DateTime.MinValue ? "" : LeaseStart.ToShortDateString(); } }
public DateTime LeaseEnd { get; set; }
public string LeaseEndStr { get { return LeaseEnd == DateTime.MinValue ? "" : LeaseEnd.ToShortDateString(); } }
public double LeaseTerm { get; set; }
public double UndercarriageHours { get; set; }
public string AquisitionType { get; set; }
public int OnSiteJobsiteID { get; set; }
public string[] ContactIDs { get; set; }
public MachineAttributeClient[] MachineAttributes { get; set; }
public string MachineIconFileName { get; set; }
public string DistanceCalcBy { get; set; }
public bool TelematicsEnabled { get; set; }
public string CostCenter { get; set; }
public string EqClass { get; set; }
public string Description { get; set; }
public string[] MachineGroupIDs { get; set; }
public MachineRentalInfo MachineRental { get; set; }
public StringKeyValue[] VisibleOnWorkOrders { get; set; }
public DateTime AddedOn { get; set; }
public string AddedOnStr { get { return AddedOn == DateTime.MinValue ? "" : AddedOn.ToShortDateString(); } }
public string AddedBy { get; set; }
public string AddedByName { get; set; }
public string ShowName
{
get
{
//Name取值顺序为Name2,Name,VIN,ID用于前端显示
string name = Name2;
if (string.IsNullOrWhiteSpace(name))
name = Name;
if (string.IsNullOrWhiteSpace(name))
name = VIN;
if (string.IsNullOrWhiteSpace(name))
name = MachineID.ToString();
return name;
}
}//由于地图显示及排序的名称
}
public class MachineOffsetItem
{
public Int64 MachineID { get; set; }
public double Value { get; set; }
public double Offset { get; set; }
public string Notes { get; set; }
public OffsetTypes Type { get; set; }
}
public class DeviceItem
{
public string ContractorID { get; set; }
public string DeviceType { get; set; }
public int Status { get; set; }
public string Notes { get; set; }
public DateTime? ServiceStartDate { get; set; }
public DateTime? InvoiceDate { get; set; }
public DateTime? AddLocalDate { get; set; }
public DateTime? AddDate { get; set; }
public string InvoiceNumber { get; set; }
public PairedAssetItem PairedAsset { get; set; }
public string SourceName { get; set; }
public string Source { get; set; }
public string SourceDeviceId { get; set; }
public string AlternativeSerialNumber { get; set; }
public string SerialNumber { get; set; }
public long Id { get; set; }
public bool Active { get; }
public long DeviceID { get; set; }
public string AddDateStr { get { return AddLocalDate == null ? "" : AddLocalDate.Value.ToShortDateString(); } }
public string InvoiceDateStr { get { return InvoiceDate == null ? "" : InvoiceDate.Value.ToShortDateString(); } }
public string ServiceStartDateStr { get { return ServiceStartDate == null ? "" : ServiceStartDate.Value.ToShortDateString(); } }
}
public class PairedAssetItem
{
public long Id { get; set; }
public string VIN { get; set; }
public string Name { get; set; }
public int Year { get; set; }
public string MakeName { get; set; }
public string ModelName { get; set; }
public string TypeName { get; set; }
public double? EngineHours { get; set; }
public DateTime? EngineHoursDate { get; set; }
public DateTime? EngineHoursLocalDate { get; set; }
public string EngineHoursDateStr { get { return EngineHoursLocalDate == null ? "" : EngineHoursLocalDate.Value.ToShortDateString(); } }
}
public class CommentItem
{
public long Id { get; set; }
public DateTime SubmitLocalDate { get; set; }
public string UserName { get; set; }
public string Comment { get; set; }
public string SubmitDateStr { get { return SubmitLocalDate == DateTime.MinValue ? "" : SubmitLocalDate.ToString(); } }
}
public class MachineGroup
{
public string GroupID { get; set; }
public string GroupName { get; set; }
public string Description { get; set; }
public string Code { get; set; }
public long[] MachineIDs { get; set; }
}
public class AssetMakeItem
{
public int ID { get; set; }
public string Name { get; set; }
public string IconColor { get; set; }
public string AlterActiveName { get; set; }
public string AddedBy { get; set; }//companyid
public DateTime AddedDate { get; set; }
public string Synonyms { get; set; }
public bool CanEdit
{
get
{
return SystemParams.CompanyID.Equals(AddedBy, StringComparison.OrdinalIgnoreCase);
}
}
}
public class AssetModelItem
{
public int ID { get; set; }
public string Name { get; set; }
public string AddedBy { get; set; }//companyid
public int MakeID { get; set; }
public string MakeName { get; set; }
public int TypeID { get; set; }
public string TypeName { get; set; }
public string Synonyms { get; set; }
public bool CanEdit
{
get
{
return SystemParams.CompanyID.Equals(AddedBy, StringComparison.OrdinalIgnoreCase);
}
}
}
public class MachineAttributeCategoryClient
{
public string Name { get; set; }
public string DisplayText { get; set; }
public int TabID { get; set; }
public string TabName { get; set; }
public int OrderIndex { get; set; }
public List<MachineAttributeClient> MachineAttributes { get; set; }
}
public class MachineAttributeClient
{
public int ID { get; set; }
public string DisplayText { get; set; }
public string Format { get; set; }
public string Description { get; set; }
public MachineAttributeDataTypes DataType { get; set; }
public bool Multiline { get; set; }
public int Length { get; set; }
public int Precision { get; set; }
public string Value { get; set; }
public bool Dropdown { get; set; }
public string DataSource { get; set; }
}
public class AssetAttachmentItem
{
public long ID { get; set; }
public long AssetId { get; set; }
public string FileName { get; set; }
public string AddedByUserIID { get; set; }
public string AddedByUserName { get; set; }
public string Notes { get; set; }
public bool VisibleOnWorkOrder { get; set; }
public DateTime AddedOn { get; set; }
public string AddedOnStr { get { return AddedOn.ToString(); } }
public byte[] FileData { get; set; }
}
}