diff --git a/Entity/Api/Req/AddSwapOrderReq.cs b/Entity/Api/Req/AddSwapOrderReq.cs index bcf34b8..1099440 100644 --- a/Entity/Api/Req/AddSwapOrderReq.cs +++ b/Entity/Api/Req/AddSwapOrderReq.cs @@ -127,5 +127,20 @@ /// 换电电池 /// public List batteryList { get; set; } + + /// + /// 电费 + /// + public int? ElectricityTotalFee { get; set; } + + /// + /// 附加费 + /// + public int? AppendTotalFee { get; set; } + + /// + /// 总费用(所有的总费用) + /// + public int? TotalFee { get; set; } } } diff --git a/Entity/Api/Req/ModifySwapOrderReq.cs b/Entity/Api/Req/ModifySwapOrderReq.cs index 63468d3..5df1928 100644 --- a/Entity/Api/Req/ModifySwapOrderReq.cs +++ b/Entity/Api/Req/ModifySwapOrderReq.cs @@ -135,5 +135,20 @@ namespace Entity.Api.Req /// 换电电池 /// public List batteryList { get; set; } + + /// + /// 电费 + /// + public int? ElectricityTotalFee { get; set; } + + /// + /// 附加费 + /// + public int? AppendTotalFee { get; set; } + + /// + /// 总费用(所有的总费用) + /// + public int? TotalFee { get; set; } } } diff --git a/Entity/Api/Req/StationConfigReq.cs b/Entity/Api/Req/StationConfigReq.cs index 8aee201..61810f7 100644 --- a/Entity/Api/Req/StationConfigReq.cs +++ b/Entity/Api/Req/StationConfigReq.cs @@ -43,4 +43,20 @@ public class StationConfigReq /// 换电模式 (0: 读取rdid 1:手动填写车辆vin) /// public int VehicleManually { get; set; } + + + /// + /// 服务费 + /// + public int ServiceTotalFee { get; set; } + + /// + /// 电费 + /// + public int ElectricityTotalFee { get; set; } + + /// + /// 附加费 + /// + public int AppendTotalFee { get; set; } } \ No newline at end of file diff --git a/Entity/Api/Resp/StationConfigResp.cs b/Entity/Api/Resp/StationConfigResp.cs index d8699ea..c0036f8 100644 --- a/Entity/Api/Resp/StationConfigResp.cs +++ b/Entity/Api/Resp/StationConfigResp.cs @@ -49,4 +49,20 @@ public class StationConfigResp /// 换电模式 (0: 读取rdid 1:手动填写车辆vin) /// public int VehicleManually { get; set; } + + + /// + /// 服务费 + /// + public int? ServiceTotalFee { get; set; } + + /// + /// 电费 + /// + public int? ElectricityTotalFee { get; set; } + + /// + /// 附加费 + /// + public int? AppendTotalFee { get; set; } } \ No newline at end of file diff --git a/Entity/Api/Resp/SwapOrderResp.cs b/Entity/Api/Resp/SwapOrderResp.cs index dd36282..c082a83 100644 --- a/Entity/Api/Resp/SwapOrderResp.cs +++ b/Entity/Api/Resp/SwapOrderResp.cs @@ -144,5 +144,35 @@ namespace Entity.Api.Resp /// 换电小步 /// public List StepList { get; set; } + + /// + /// Desc:公司 + /// Default: + /// Nullable:True + /// + public string? Company {get;set;} + + /// + /// Desc:部门 + /// Default: + /// Nullable:True + /// + public string? Departments {get;set;} + + /// + /// 电费 + /// + public int? ElectricityTotalFee { get; set; } + + /// + /// 附加费 + /// + public int? AppendTotalFee { get; set; } + + /// + /// 总费用(所有的总费用) + /// + public int? TotalFee { get; set; } + } } \ No newline at end of file diff --git a/Entity/Constant/StationParamConst.cs b/Entity/Constant/StationParamConst.cs index 8f42cf0..38e4243 100644 --- a/Entity/Constant/StationParamConst.cs +++ b/Entity/Constant/StationParamConst.cs @@ -190,6 +190,12 @@ public class StationParamConst //选包策略换电Soc public static readonly string SwapSoc = "Station.SwapSoc"; + // 换电服务费 + public static readonly string ServiceTotalFee = "Station.ServiceTotalFee"; + // 电费 + public static readonly string ElectricityTotalFee = "Station.ElectricityTotalFee"; + // 附加费 + public static readonly string AppendTotalFee = "Station.AppendTotalFee"; //充电soc public static readonly string ChargeSoc = "Station.ChargeSoc"; diff --git a/Entity/DbModel/Station/SwapOrder.cs b/Entity/DbModel/Station/SwapOrder.cs index 85b7ab1..64f7cf5 100644 --- a/Entity/DbModel/Station/SwapOrder.cs +++ b/Entity/DbModel/Station/SwapOrder.cs @@ -124,5 +124,24 @@ namespace Entity.DbModel.Station /// [SugarColumn(ColumnName = "swap_way")] public int? SwapWay { get; set; } + + /// + /// 电费(单位分) + /// + [SugarColumn(ColumnName = "electricity_total_fee")] + public int? ElectricityTotalFee { get; set; } + + /// + /// 附加费(单位分) + /// + [SugarColumn(ColumnName = "append_total_fee")] + public int? AppendTotalFee { get; set; } + + /// + /// 总费用(所有的总费用-单位分) + /// + [SugarColumn(ColumnName = "total_fee")] + public int? TotalFee { get; set; } + } } \ No newline at end of file diff --git a/Entity/Dto/ChargeCountDto.cs b/Entity/Dto/ChargeCountDto.cs new file mode 100644 index 0000000..2f5a53d --- /dev/null +++ b/Entity/Dto/ChargeCountDto.cs @@ -0,0 +1,23 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +/// +/// 充电量统计导出 +/// +[ExcelExporter(Name = "充电量统计", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class ChargeCountDto +{ + /// + /// 时间 + /// + [ExporterHeader(DisplayName = "时间", IsBold = true)] + public string? Time { get; set; } + + /// + /// 充电度数 + /// + [ExporterHeader(DisplayName = "用电量/kWh", IsBold = true)] + public decimal? ChargeCount { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/ChargeCountDto2.cs b/Entity/Dto/ChargeCountDto2.cs new file mode 100644 index 0000000..7871457 --- /dev/null +++ b/Entity/Dto/ChargeCountDto2.cs @@ -0,0 +1,20 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "CHARGE STATISTICS", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class ChargeCountDto2 +{ + /// + /// 时间 + /// + [ExporterHeader(DisplayName = "TIME", IsBold = true)] + public string? Time { get; set; } + + /// + /// 充电度数 + /// + [ExporterHeader(DisplayName = "ELECTRICITY CONSUMPTION/kWh", IsBold = true)] + public decimal? ChargeCount { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/ChargeEquipAlarmProcessRecordDto.cs b/Entity/Dto/ChargeEquipAlarmProcessRecordDto.cs new file mode 100644 index 0000000..c15086b --- /dev/null +++ b/Entity/Dto/ChargeEquipAlarmProcessRecordDto.cs @@ -0,0 +1,35 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "充电机已处理报警日志", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class ChargeEquipAlarmProcessRecordDto +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "站号", IsBold = true)] + public string StationNumber { get; set; } = "2号站"; + + + [ExporterHeader(DisplayName = "充电机编号", IsBold = true)] + public string EquipCode { get; set; } + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "报警名称", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "报警开始时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } + + [ExporterHeader(DisplayName = "报警结束时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? ProcessTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/ChargeEquipAlarmProcessRecordDto2.cs b/Entity/Dto/ChargeEquipAlarmProcessRecordDto2.cs new file mode 100644 index 0000000..7a7ee02 --- /dev/null +++ b/Entity/Dto/ChargeEquipAlarmProcessRecordDto2.cs @@ -0,0 +1,35 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "CHARGER HAS PROCESSED ALARM LOG", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class ChargeEquipAlarmProcessRecordDto2 +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "STATION NUMBER", IsBold = true)] + public string StationNumber { get; set; } = "STATION 2"; + + + [ExporterHeader(DisplayName = "CHARGER NUMBER", IsBold = true)] + public string EquipCode { get; set; } + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "ALARM NAME", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "ALARM START TIME", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } + + [ExporterHeader(DisplayName = "ALARM END TIME", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? ProcessTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/ChargeEquipAlarmRecordDto.cs b/Entity/Dto/ChargeEquipAlarmRecordDto.cs new file mode 100644 index 0000000..126b20c --- /dev/null +++ b/Entity/Dto/ChargeEquipAlarmRecordDto.cs @@ -0,0 +1,33 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + + +[ExcelExporter(Name = "充电机未处理报警日志", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class ChargeEquipAlarmRecordDto +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "站号", IsBold = true)] + public string StationNumber { get; set; } = "2号站"; + + + [ExporterHeader(DisplayName = "充电机编号", IsBold = true)] + public string EquipCode { get; set; } + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "报警名称", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "报警开始时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/ChargeEquipAlarmRecordDto2.cs b/Entity/Dto/ChargeEquipAlarmRecordDto2.cs new file mode 100644 index 0000000..7b34a66 --- /dev/null +++ b/Entity/Dto/ChargeEquipAlarmRecordDto2.cs @@ -0,0 +1,32 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "THE CHARGER DID NOT PROCESS THE ALARM LOG", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class ChargeEquipAlarmRecordDto2 +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "STATION NUMBER", IsBold = true)] + public string StationNumber { get; set; } = "STATION 2"; + + + [ExporterHeader(DisplayName = "CHARGER NUMBER", IsBold = true)] + public string EquipCode { get; set; } + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "ALARM NAME", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "ALARM START TIME", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/ChargeOrderDto.cs b/Entity/Dto/ChargeOrderDto.cs index 3ae9620..9ff15ab 100644 --- a/Entity/Dto/ChargeOrderDto.cs +++ b/Entity/Dto/ChargeOrderDto.cs @@ -6,123 +6,38 @@ namespace Entity.Dto; [ExcelExporter(Name = "充电订单", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] public class ChargeOrderDto { + [ExporterHeader(DisplayName = "换电站名称", IsBold = true)] + public string stationName { get; set; } = "2号站"; /// /// Desc:订单编号 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "订单编号", IsBold = true)] + [ExporterHeader(DisplayName = "充电流水号", IsBold = true)] public string Sn { get; set; } - - /// - /// Desc:电池编号 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "电池编号", IsBold = true)] - - public string BatteryNo { get; set; } - - /// - /// Desc:启动报文状态;0-初始化;1-启动成功 - /// Default:0 - /// Nullable:True - /// - [ExporterHeader(DisplayName = "启动报文状态", IsBold = true)] - public string CmdStatusDisplay - { - get - { - return CmdStatus switch - { - 0 => "初始化", - 1 => "启动成功", - _ => "未知" - }; - } - } - /// - /// Desc:启动报文状态;0-初始化;1-启动成功 - /// Default:0 - /// Nullable:True - /// - [ExporterHeader(IsIgnore = true)] - - public int? CmdStatus { get; set; } - /// /// Desc:充电机编号 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "充电机编号", IsBold = true)] - + [ExporterHeader(DisplayName = "充电桩编号", IsBold = true)] public string ChargerNo { get; set; } - + /// - /// Desc:充电枪编号 + /// Desc:电池编号 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "充电枪编号", IsBold = true)] - - public string ChargerGunNo { get; set; } - - - /// - /// 0:站内充电 1:站外充电 - /// - [ExporterHeader(DisplayName = "充电位置", IsBold = true)] - public string ChargeModeDisplay - { - get - { - return ChargeMode switch - { - 0 => "站内充电", - 1 => "站外充电", - _ => "未知" - }; - } - } - - /// - /// 0:站内充电 1:站外充电 - /// - [ExporterHeader(IsIgnore = true)] + [ExporterHeader(DisplayName = "电池编号", IsBold = true)] - public int ChargeMode { get; set; } - - /// - /// 1:站控启动 2:本地启动 - /// - [ExporterHeader(DisplayName = "启动方式", IsBold = true)] - public string StartModeDisplay - { - get - { - return StartMode switch - { - 1 => "站控启动", - 2 => "本地启动", - _ => "未知" - }; - } - } + public string BatteryNo { get; set; } - /// - /// 1:站控启动 2:本地启动 - /// - [ExporterHeader(IsIgnore = true)] - - public int StartMode { get; set; } - /// /// 充电开始时间 /// - [ExporterHeader(DisplayName = "充电开始时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + [ExporterHeader(DisplayName = "开始时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] public DateTime? StartTime { get; set; } @@ -131,82 +46,57 @@ public class ChargeOrderDto /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "充电结束时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + [ExporterHeader(DisplayName = "结束时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] public DateTime? EndTime { get; set; } - - /// - /// Desc:充电开始soc - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "充电开始soc", IsBold = true)] - - public int? StartSoc { get; set; } - - /// - /// Desc:充电结束soc - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "充电结束soc", IsBold = true)] - - public int? StopSoc { get; set; } - + + /// /// Desc:充电时长 /// Default: /// Nullable:True /// [ExporterHeader(DisplayName = "充电时长", IsBold = true)] - public int ChargeTimeCount { get; set; } /// - /// Desc:充电电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "充电电量", IsBold = true)] - - public decimal? ElecCount { get; set; } - - /// - /// Desc:充电开始交流表电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "充电开始交流表电量", IsBold = true)] - - public decimal? StartAcElec { get; set; } - - /// - /// Desc:充电结束交流表电量 + /// Desc:充电开始soc /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "充电结束交流表电量", IsBold = true)] + [ExporterHeader(DisplayName = "充电开始soc", IsBold = true)] - public decimal? StopAcElec { get; set; } + public int? StartSoc { get; set; } /// - /// Desc:充电开始直流表电量 + /// Desc:充电结束soc /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "充电开始直流表电量", IsBold = true)] + [ExporterHeader(DisplayName = "充电结束soc", IsBold = true)] - public decimal? StartDcElec { get; set; } + public int? StopSoc { get; set; } + + + /// - /// Desc:充电结束直流表电量 + /// Desc:充电开始交流表电量 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "充电结束直流表电量", IsBold = true)] - - public decimal? StopDcElec { get; set; } - + [ExporterHeader(DisplayName = "开始交流表电量/kWh", IsBold = true)] + public decimal? StartAcElec1 { get; set; } + + [ExporterHeader(DisplayName = "结束交流表电量/kWh", IsBold = true)] + public decimal? StopAcElec1 { get; set; } + + [ExporterHeader(DisplayName = "开始直流表电量/kWh", IsBold = true)] + public decimal? StartDcElec1 { get; set; } + + [ExporterHeader(DisplayName = "结束直流表电量/kWh", IsBold = true)] + public decimal? StopDcElec1 { get; set; } + /// /// Desc:停止原因;0:满电自动停止;1-人工停止 /// Default:0 @@ -233,189 +123,4 @@ public class ChargeOrderDto [ExporterHeader(IsIgnore = true)] public int? StopReason { get; set; } - - /// - /// Desc:尖时段电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "尖时段电量", IsBold = true)] - - public decimal? SharpElecCount { get; set; } - - /// - /// Desc:峰时段电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "峰时段电量", IsBold = true)] - - public decimal? PeakElecCount { get; set; } - - /// - /// Desc:平时段电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "平时段电量", IsBold = true)] - - public decimal? FlatElecCount { get; set; } - - /// - /// Desc:谷时段电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "谷时段电量", IsBold = true)] - - public decimal? ValleyElecCount { get; set; } - - /// - /// Desc:尖时段交流电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "尖时段交流电量", IsBold = true)] - - public decimal? ACSharpElecCount { get; set; } - - /// - /// Desc:峰时段交流电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "峰时段交流电量", IsBold = true)] - - public decimal? ACPeakElecCount { get; set; } - - /// - /// Desc:平时段交流电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "平时段交流电量", IsBold = true)] - - public decimal? ACFlatElecCount { get; set; } - - /// - /// Desc:谷时段交流电量 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "谷时段交流电量", IsBold = true)] - - public decimal? ACValleyElecCount { get; set; } - - /// - /// Desc:电价版本号 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "电价版本号", IsBold = true)] - - public string ElecPriceModelVersion { get; set; } - - /// - /// Desc:换电订单编号 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "换电订单编号", IsBold = true)] - - public string SwapOrderSn { get; set; } - - /// - /// Desc:上传云平台状态;0-未上传;1-已上传 - /// Default:0 - /// Nullable:True - /// - [ExporterHeader(DisplayName = "上传云平台状态", IsBold = true)] - public string CloudReportStatusDisplay - { - get - { - return CloudReportStatus switch - { - 0 => "未上传", - 1 => "已上传", - _ => "未知" - }; - } - } - - - [ExporterHeader(IsIgnore = true)] - - public int? CloudReportStatus { get; set; } - - /// - /// Desc:创建人 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "创建人", IsBold = true)] - - public string CreatedBy { get; set; } - - /// - /// Desc:创建时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [ExporterHeader(DisplayName = "创建时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] - - public DateTime? CreatedTime { get; set; } - - /// - /// Desc:更新人 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "更新人", IsBold = true,Width = 25)] - - public string UpdatedBy { get; set; } - - /// - /// Desc:更新时间 - /// Default:CURRENT_TIMESTAMP - /// Nullable:True - /// - [ExporterHeader(DisplayName = "更新时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] - - public DateTime? UpdatedTime { get; set; } - - /// - /// 云平台充电订单 - /// - [ExporterHeader(DisplayName = "云平台充电订单", IsBold = true)] - - public string? CloudChargeOrder { get; set; } - - /// - /// Desc:是否可以上传云平台 - /// Default: - /// Nullable:True - /// - [ExporterHeader(DisplayName = "是否可以上传云平台", IsBold = true)] - public string CanUploadDisplay - { - get - { - return CanUpload switch - { - 0 => "不可用", - 1 => "可以", - _ => "未知" - }; - } - } - - /// - /// Desc:是否可以上传云平台 - /// Default: - /// Nullable:True - /// - [ExporterHeader(IsIgnore = true)] - - public int? CanUpload { get; set; } } \ No newline at end of file diff --git a/Entity/Dto/ChargeOrderDto2.cs b/Entity/Dto/ChargeOrderDto2.cs index 30c73e2..e45f7ae 100644 --- a/Entity/Dto/ChargeOrderDto2.cs +++ b/Entity/Dto/ChargeOrderDto2.cs @@ -9,65 +9,18 @@ namespace Entity.Dto; [ExcelExporter(Name = "Charge Orders", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] public class ChargeOrderDto2 { + [ExporterHeader(DisplayName = "NAME OF CHANGING STATION", IsBold = true)] + public string stationName { get; set; } = "STATION 2"; + [ExporterHeader(DisplayName = "Order Number", IsBold = true)] public string Sn { get; set; } [ExporterHeader(DisplayName = "Battery Number", IsBold = true)] public string BatteryNo { get; set; } - [ExporterHeader(DisplayName = "Command Status", IsBold = true)] - public string CmdStatusDisplay - { - get - { - return CmdStatus switch - { - 0 => "Initialized", - 1 => "Started Successfully", - _ => "Unknown" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int? CmdStatus { get; set; } - [ExporterHeader(DisplayName = "Charger Number", IsBold = true)] public string ChargerNo { get; set; } - - [ExporterHeader(DisplayName = "Charger Gun Number", IsBold = true)] - public string ChargerGunNo { get; set; } - - [ExporterHeader(DisplayName = "Charging Location", IsBold = true)] - public string ChargeModeDisplay - { - get - { - return ChargeMode switch - { - 0 => "In-station Charging", - 1 => "Out-of-station Charging", - _ => "Unknown" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int ChargeMode { get; set; } - - [ExporterHeader(DisplayName = "Start Mode", IsBold = true)] - public string StartModeDisplay - { - get - { - return StartMode switch - { - 1 => "Station-controlled Start", - 2 => "Local Start", - _ => "Unknown" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int StartMode { get; set; } + [ExporterHeader(DisplayName = "Start Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] @@ -76,6 +29,9 @@ public class ChargeOrderDto2 [ExporterHeader(DisplayName = "End Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] public DateTime? EndTime { get; set; } + + [ExporterHeader(DisplayName = "Charge Duration", IsBold = true)] + public int ChargeTimeCount { get; set; } [ExporterHeader(DisplayName = "Start SOC", IsBold = true)] public int? StartSoc { get; set; } @@ -83,24 +39,21 @@ public class ChargeOrderDto2 [ExporterHeader(DisplayName = "End SOC", IsBold = true)] public int? StopSoc { get; set; } - [ExporterHeader(DisplayName = "Charge Duration", IsBold = true)] - public int ChargeTimeCount { get; set; } - - [ExporterHeader(DisplayName = "Charge Quantity", IsBold = true)] - public decimal? ElecCount { get; set; } - - [ExporterHeader(DisplayName = "Start AC Quantity", IsBold = true)] - public decimal? StartAcElec { get; set; } - - [ExporterHeader(DisplayName = "End AC Quantity", IsBold = true)] - public decimal? StopAcElec { get; set; } - - [ExporterHeader(DisplayName = "Start DC Quantity", IsBold = true)] - public decimal? StartDcElec { get; set; } - - [ExporterHeader(DisplayName = "End DC Quantity", IsBold = true)] - public decimal? StopDcElec { get; set; } - + + [ExporterHeader(DisplayName = "START ALTERNATING METER POWER/kWh", IsBold = true)] + public decimal? StartAcElec1 { get; set; } + + [ExporterHeader(DisplayName = "END THE AC METER BATTERY/kWh", IsBold = true)] + public decimal? StopAcElec1 { get; set; } + + [ExporterHeader(DisplayName = "START DC METER POWER/kWh", IsBold = true)] + public decimal? StartDcElec1 { get; set; } + + [ExporterHeader(DisplayName = "END DC METER POWER/kWh", IsBold = true)] + public decimal? StopDcElec1 { get; set; } + + + [ExporterHeader(DisplayName = "Stop Reason", IsBold = true)] public string StopReasonDisplay { @@ -114,85 +67,7 @@ public class ChargeOrderDto2 }; } } - + [ExporterHeader(IsIgnore = true)] public int? StopReason { get; set; } - [ExporterHeader(DisplayName = "Sharp Period Quantity", IsBold = true)] - public decimal? SharpElecCount { get; set; } - - [ExporterHeader(DisplayName = "Peak Period Quantity", IsBold = true)] - public decimal? PeakElecCount { get; set; } - - [ExporterHeader(DisplayName = "Flat Period Quantity", IsBold = true)] - public decimal? FlatElecCount { get; set; } - - [ExporterHeader(DisplayName = "Valley Period Quantity", IsBold = true)] - public decimal? ValleyElecCount { get; set; } - - [ExporterHeader(DisplayName = "Sharp Period AC Quantity", IsBold = true)] - public decimal? ACSharpElecCount { get; set; } - - [ExporterHeader(DisplayName = "Peak Period AC Quantity", IsBold = true)] - public decimal? ACPeakElecCount { get; set; } - - [ExporterHeader(DisplayName = "Flat Period AC Quantity", IsBold = true)] - public decimal? ACFlatElecCount { get; set; } - - [ExporterHeader(DisplayName = "Valley Period AC Quantity", IsBold = true)] - public decimal? ACValleyElecCount { get; set; } - - [ExporterHeader(DisplayName = "Electricity Price Version", IsBold = true)] - public string ElecPriceModelVersion { get; set; } - - [ExporterHeader(DisplayName = "Swap Order Number", IsBold = true)] - public string SwapOrderSn { get; set; } - - [ExporterHeader(DisplayName = "Cloud Report Status", IsBold = true)] - public string CloudReportStatusDisplay - { - get - { - return CloudReportStatus switch - { - 0 => "Not Uploaded", - 1 => "Uploaded", - _ => "Unknown" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int? CloudReportStatus { get; set; } - - [ExporterHeader(DisplayName = "Created By", IsBold = true)] - public string CreatedBy { get; set; } - - [ExporterHeader(DisplayName = "Created Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", - AutoCenterColumn = true)] - public DateTime? CreatedTime { get; set; } - - [ExporterHeader(DisplayName = "Updated By", IsBold = true, Width = 25)] - public string UpdatedBy { get; set; } - - [ExporterHeader(DisplayName = "Updated Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", - AutoCenterColumn = true)] - public DateTime? UpdatedTime { get; set; } - - [ExporterHeader(DisplayName = "Cloud Charge Order", IsBold = true)] - public string? CloudChargeOrder { get; set; } - - [ExporterHeader(DisplayName = "Can Upload to Cloud", IsBold = true)] - public string CanUploadDisplay - { - get - { - return CanUpload switch - { - 0 => "Not Available", - 1 => "Available", - _ => "Unknown" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int? CanUpload { get; set; } } \ No newline at end of file diff --git a/Entity/Dto/PlcEquipAlarmProcessRecordDto.cs b/Entity/Dto/PlcEquipAlarmProcessRecordDto.cs new file mode 100644 index 0000000..663cd32 --- /dev/null +++ b/Entity/Dto/PlcEquipAlarmProcessRecordDto.cs @@ -0,0 +1,32 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + + +[ExcelExporter(Name = "Plc已处理报警日志", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class PlcEquipAlarmProcessRecordDto +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "站号", IsBold = true)] + public string StationNumber { get; set; } = "2号站"; + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "报警名称", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "报警开始时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } + + [ExporterHeader(DisplayName = "报警结束时间", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? ProcessTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/PlcEquipAlarmProcessRecordDto2.cs b/Entity/Dto/PlcEquipAlarmProcessRecordDto2.cs new file mode 100644 index 0000000..2fa74dc --- /dev/null +++ b/Entity/Dto/PlcEquipAlarmProcessRecordDto2.cs @@ -0,0 +1,31 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "PLC HAS PROCESSED ALARM LOG", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class PlcEquipAlarmProcessRecordDto2 +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "STATION NUMBER", IsBold = true)] + public string StationNumber { get; set; } = "STATION 2"; + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "ALARM NAME", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "ALARM START TIME", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } + + [ExporterHeader(DisplayName = "ALARM END TIME", IsBold = true,Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? ProcessTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/PlcEquipAlarmRecordDto.cs b/Entity/Dto/PlcEquipAlarmRecordDto.cs new file mode 100644 index 0000000..12b4846 --- /dev/null +++ b/Entity/Dto/PlcEquipAlarmRecordDto.cs @@ -0,0 +1,28 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "PLc未处理报警日志", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class PlcEquipAlarmRecordDto +{ + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "站号", IsBold = true)] + public string StationNumber { get; set; } = "2号站"; + + /// + /// Desc:报警描述 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "报警名称", IsBold = true)] + public string ErrorMsg { get; set; } + + /// + /// 报警开始时间 + /// + [ExporterHeader(DisplayName = "报警开始时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/PlcEquipAlarmRecordDto2.cs b/Entity/Dto/PlcEquipAlarmRecordDto2.cs new file mode 100644 index 0000000..219d2cb --- /dev/null +++ b/Entity/Dto/PlcEquipAlarmRecordDto2.cs @@ -0,0 +1,19 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "PLC DID NOT PROCESS ALARM LOG", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class PlcEquipAlarmRecordDto2 +{ + [ExporterHeader(DisplayName = "STATION NUMBER", IsBold = true)] + public string StationNumber { get; set; }= "STATION 2"; + + + [ExporterHeader(DisplayName = "Alarm Description", IsBold = true)] + public string ErrorMsg { get; set; } + + + [ExporterHeader(DisplayName = "ALARM START TIME", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? StartTime { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/SwapLoseOrderDto.cs b/Entity/Dto/SwapLoseOrderDto.cs new file mode 100644 index 0000000..9b07b0f --- /dev/null +++ b/Entity/Dto/SwapLoseOrderDto.cs @@ -0,0 +1,71 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +/// +/// 换电失败订单导出 +/// +[ExcelExporter(Name = "2号站换电失败记录", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class SwapLoseOrderDto +{ + [ExporterHeader(IsIgnore = true)] + public string Sn { get; set; } + + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "站号", IsBold = true)] + public string StationNumber { get; set; } = "2号站"; + + + [ExporterHeader(DisplayName = "开始时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", + AutoCenterColumn = true)] + public DateTime? SwapBeginTime { get; set; } + + + [ExporterHeader(DisplayName = "车辆vin码", IsBold = true)] + public string VehicleVin { get; set; } + + + /// + /// Desc:车牌号 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "车牌号", IsBold = true)] + public string VehicleNo { get; set; } + + /// + /// Desc:取电池仓位号 满电包仓号 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "取电池仓位号", IsBold = true)] + public int? UpBatteryBinNo { get; set; } + + /// + /// Desc:放电池仓位号 亏电包仓号 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "存电池仓位号", IsBold = true)] + public int? DownBatteryBinNo { get; set; } + + + /// + /// Desc:换电结束时间 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "失败时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? SwapEndTime { get; set; } + + /// + /// Desc:失败原因 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "失败原因", IsBold = true)] + public string FailReason { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/SwapLoseOrderDto2.cs b/Entity/Dto/SwapLoseOrderDto2.cs new file mode 100644 index 0000000..47c4b74 --- /dev/null +++ b/Entity/Dto/SwapLoseOrderDto2.cs @@ -0,0 +1,37 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; + +namespace Entity.Dto; + +[ExcelExporter(Name = "POWER FAILURE RECORD OF STATION 2", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] +public class SwapLoseOrderDto2 +{ + + [ExporterHeader(IsIgnore = true)] + public string Sn { get; set; } + + [ExporterHeader(DisplayName = "STATION NUMBER", IsBold = true)] + public string StationNumber { get; set; }= "STATION 2"; + + [ExporterHeader(DisplayName = "Swap Begin Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", + AutoCenterColumn = true)] + public DateTime? SwapBeginTime { get; set; } + + [ExporterHeader(DisplayName = "Vehicle VIN", IsBold = true)] + public string VehicleVin { get; set; } + + [ExporterHeader(DisplayName = "Vehicle Number", IsBold = true)] + public string VehicleNo { get; set; } + + [ExporterHeader(DisplayName = "Up Battery Bin Number", IsBold = true)] + public int? UpBatteryBinNo { get; set; } + + [ExporterHeader(DisplayName = "Down Battery Bin Number", IsBold = true)] + public int? DownBatteryBinNo { get; set; } + + [ExporterHeader(DisplayName = "Swap End Time", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + public DateTime? SwapEndTime { get; set; } + + [ExporterHeader(DisplayName = "Failure Reason", IsBold = true)] + public string FailReason { get; set; } +} \ No newline at end of file diff --git a/Entity/Dto/SwapOrderDto.cs b/Entity/Dto/SwapOrderDto.cs index c81b7f0..c051ca0 100644 --- a/Entity/Dto/SwapOrderDto.cs +++ b/Entity/Dto/SwapOrderDto.cs @@ -14,9 +14,22 @@ public class SwapOrderDto /// 站号 /// [ExporterHeader(DisplayName = "站号", IsBold = true)] - public string StationNumber { get; set; } + public string StationNumber { get; set; }= "2号站"; + + + [ExporterHeader(DisplayName = "创建时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", + AutoCenterColumn = true)] + public DateTime? CreatedTime { get; set; } + /// + /// Desc:车辆vin码 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "车辆vin码", IsBold = true)] + public string VehicleVin { get; set; } + /// /// Desc:车牌号 /// Default: @@ -24,38 +37,48 @@ public class SwapOrderDto /// [ExporterHeader(DisplayName = "车牌号", IsBold = true)] public string VehicleNo { get; set; } - + /// - /// Desc:车辆mac + /// Desc:公司 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "车辆mac", IsBold = true)] - public string VehicleMac { get; set; } + [ExporterHeader(DisplayName = "所属公司", IsBold = true)] + public string? Company {get;set;} /// - /// Desc: 公司 + /// Desc:部门 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "公司", IsBold = true)] - public string Firm { get; set; } + [ExporterHeader(DisplayName = "所属部门", IsBold = true)] + public string? Departments {get;set;} /// - /// Desc: 部门 - /// Default: + /// Desc:换电类型:;1自动换电;2手动换电 + /// Default:0 /// Nullable:True /// - [ExporterHeader(DisplayName = "部门", IsBold = true)] - public string Department { get; set; } - + [ExporterHeader(DisplayName = "换电模式", IsBold = true)] + public string SwapWayDisplay + { + get + { + return SwapWay switch + { + 1 => "自动换电", + 2 => "手动换电", + _ => "未知" + }; + } + } /// - /// Desc:车辆vin码 - /// Default: + /// Desc:换电类型:;1自动换电;2手动换电 + /// Default:0 /// Nullable:True /// - [ExporterHeader(DisplayName = "车辆vin码", IsBold = true)] - public string VehicleVin { get; set; } + [ExporterHeader(IsIgnore = true)] + public int? SwapWay { get; set; } ///// ///// Desc:车辆进场时间 @@ -80,7 +103,7 @@ public class SwapOrderDto /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "换电开始时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", + [ExporterHeader(DisplayName = "开始时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] public DateTime? SwapBeginTime { get; set; } @@ -89,7 +112,7 @@ public class SwapOrderDto /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "换电结束时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] + [ExporterHeader(DisplayName = "结束时间", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] public DateTime? SwapEndTime { get; set; } @@ -110,143 +133,81 @@ public class SwapOrderDto return duration.ToString("c"); } } - - - /// - /// Desc:换电结果;0-未知;1-成功;2-失败 - /// Default:0 - /// Nullable:True - /// - [ExporterHeader(DisplayName = "换电结果", IsBold = true)] - public string SwapResultDisplay - { - get - { - return SwapResult switch - { - 0 => "未知", - 1 => "成功", - 2 => "失败", - _ => "未知" - }; - } - } - - /// - /// Desc:换电结果;0-未知;1-成功;2-失败 - /// Default:0 - /// Nullable:True - /// - // [ExporterHeader(DisplayName = "换电结果", IsBold = true)] - [ExporterHeader(IsIgnore = true)] - public int? SwapResult { get; set; } - + + /// - /// Desc:失败原因 + /// Desc:取电池仓位号 满电包仓号 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "失败原因", IsBold = true)] - public string FailReason { get; set; } - + [ExporterHeader(DisplayName = "换电仓位(取)", IsBold = true)] + public int? UpBatteryBinNo { get; set; } + + /// - /// Desc:换电类型:;1自动换电;2手动换电 - /// Default:0 - /// Nullable:True - /// - [ExporterHeader(DisplayName = "换电类型", IsBold = true)] - public string SwapWayDisplay - { - get - { - return SwapWay switch - { - 1 => "自动换电", - 2 => "手动换电", - _ => "未知" - }; - } - } - /// - /// Desc:换电类型:;1自动换电;2手动换电 - /// Default:0 + /// Desc:满电包编码 + /// Default: /// Nullable:True /// - [ExporterHeader(IsIgnore = true)] - public int? SwapWay { get; set; } - - + [ExporterHeader(DisplayName = "电池编号(取)", IsBold = true)] + public string? UpBatteryNo { get; set; } + + /// - /// Desc:亏电包编码 - /// Default: - /// Nullable:True + /// 满电包电量 /// - [ExporterHeader(DisplayName = "电池编号(存)", IsBold = true)] - - public string? DownBatteryNo { get; set; } + [ExporterHeader(DisplayName = "换池电量kWh(取)", IsBold = true)] + public string? UpBatteryElectricQuantity { get; set; } + + /// - /// Desc:亏电包soc + /// Desc:满电包soc /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "soc(存)", IsBold = true)] - - public decimal? DownBatterySoc { get; set; } + [ExporterHeader(DisplayName = "soc(取)", IsBold = true)] + public decimal? UpBatterySoc { get; set; } + /// /// Desc:放电池仓位号 亏电包仓号 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "放电池仓位号", IsBold = true)] + [ExporterHeader(DisplayName = "换电仓位(存)", IsBold = true)] public int? DownBatteryBinNo { get; set; } /// - /// Desc:取电池仓位号 满电包仓号 + /// Desc:亏电包编码 /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "取电池仓位号", IsBold = true)] - - public int? UpBatteryBinNo { get; set; } + [ExporterHeader(DisplayName = "电池编号(存)", IsBold = true)] + public string? DownBatteryNo { get; set; } + + + /// - /// Desc:满电包编码 - /// Default: - /// Nullable:True + /// 亏电包电量 /// - [ExporterHeader(DisplayName = "满电包编码(取)", IsBold = true)] - - public string? UpBatteryNo { get; set; } - + [ExporterHeader(DisplayName = "换池电量kwh(存)", IsBold = true)] + public string? DownBatteryElectricQuantity { get; set; } /// - /// Desc:满电包soc + /// Desc:亏电包soc /// Default: /// Nullable:True /// - [ExporterHeader(DisplayName = "满电包soc", IsBold = true)] - - public decimal? UpBatterySoc { get; set; } - /// - /// 满电包电量 - /// - [ExporterHeader(DisplayName = "电池电量(取)", IsBold = true)] - public string? UpBatteryElectricQuantity { get; set; } + [ExporterHeader(DisplayName = "soc(存)", IsBold = true)] - + public decimal? DownBatterySoc { get; set; } - /// - /// 亏电包电量 - /// - [ExporterHeader(DisplayName = "电池电量(存)", IsBold = true)] - public string? DownBatteryElectricQuantity { get; set; } - /// /// 电量差 /// - [ExporterHeader(DisplayName = "电池差值", IsBold = true)] + [ExporterHeader(DisplayName = "电量差kwh", IsBold = true)] public string ElectricQuantity { get; set; } @@ -257,81 +218,24 @@ public class SwapOrderDto /// [ExporterHeader(DisplayName = "订单编号", IsBold = true)] public string Sn { get; set; } - - - - /// - /// Desc:上传云平台状态;0-未上传;1-已上传 - /// Default:0 - /// Nullable:True - /// - [ExporterHeader(DisplayName = "上传云平台状态", IsBold = true)] - public string CloudReportStatusDisplay - { - get - { - return CloudReportStatus switch - { - 0 => "未上传", - 1 => "已上传", - _ => "未上传" - }; - } - } - - - - - - // [ExporterHeader(DisplayName = "上传云平台状态", IsBold = true)] - [ExporterHeader(IsIgnore = true)] public int? CloudReportStatus { get; set; } - - - /// - /// 云平台订单号 - /// - [ExporterHeader(DisplayName = "云平台订单号", IsBold = true)] - public string? CloudSn { get; set; } - - - + + + /// - /// Desc:亏电包真实soc - /// Default: - /// Nullable:True + /// 电费 /// - [ExporterHeader(DisplayName = "亏电包真实soc", IsBold = true)] - - public decimal? DownBatteryRealSoc { get; set; } - - - + [ExporterHeader(DisplayName = "电费", IsBold = true)] + public int? ElectricityTotalFee { get; set; } /// - /// Desc:亏电包上次换电结算时soc - /// Default: - /// Nullable:True + /// 附加费 /// - [ExporterHeader(DisplayName = "亏电包上次换电结算时soc", IsBold = true)] - - public decimal? DownBatteryLastSoc { get; set; } - + [ExporterHeader(DisplayName = "附加费", IsBold = true)] + public int? AppendTotalFee { get; set; } /// - /// Desc:满电包真实soc - /// Default: - /// Nullable:True + /// 总费用(所有的总费用) /// - [ExporterHeader(DisplayName = "满电包真实soc", IsBold = true)] - - public decimal? UpBatteryRealSoc { get; set; } - - - - - - - - - + [ExporterHeader(DisplayName = "总费用(所有的总费用)", IsBold = true)] + public int? TotalFee { get; set; } } \ No newline at end of file diff --git a/Entity/Dto/SwapOrderDto2.cs b/Entity/Dto/SwapOrderDto2.cs index 9d7bad4..e009cc5 100644 --- a/Entity/Dto/SwapOrderDto2.cs +++ b/Entity/Dto/SwapOrderDto2.cs @@ -9,6 +9,17 @@ namespace Entity.Dto; [ExcelExporter(Name = "Swap Orders", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true)] public class SwapOrderDto2 { + /// + /// 站号 + /// + [ExporterHeader(DisplayName = "STATION NUMBER", IsBold = true)] + public string StationNumber { get; set; }= "STATION 2"; + + [ExporterHeader(DisplayName = "CREATION TIME", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss", + AutoCenterColumn = true)] + public DateTime? CreatedTime { get; set; } + + [ExporterHeader(DisplayName = "Order Number", IsBold = true)] public string Sn { get; set; } @@ -35,45 +46,7 @@ public class SwapOrderDto2 [ExporterHeader(DisplayName = "Swap End Time", Width = 30, Format = "yyyy-MM-dd HH:mm:ss", AutoCenterColumn = true)] public DateTime? SwapEndTime { get; set; } - - [ExporterHeader(DisplayName = "Swap Result", IsBold = true)] - public string SwapResultDisplay - { - get - { - return SwapResult switch - { - 0 => "Unknown", - 1 => "Success", - 2 => "Failure", - _ => "Unknown" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int? SwapResult { get; set; } - - [ExporterHeader(DisplayName = "Failure Reason", IsBold = true)] - public string FailReason { get; set; } - - [ExporterHeader(DisplayName = "Cloud Report Status", IsBold = true)] - public string CloudReportStatusDisplay - { - get - { - return CloudReportStatus switch - { - 0 => "Not Uploaded", - 1 => "Uploaded", - _ => "Not Uploaded" - }; - } - } - - [ExporterHeader(IsIgnore = true)] public int? CloudReportStatus { get; set; } - - [ExporterHeader(DisplayName = "Cloud Order Number", IsBold = true)] - public string? CloudSn { get; set; } + [ExporterHeader(DisplayName = "Swap Type", IsBold = true)] public string SwapWayDisplay @@ -94,12 +67,6 @@ public class SwapOrderDto2 [ExporterHeader(DisplayName = "Down Battery SOC", IsBold = true)] public decimal? DownBatterySoc { get; set; } - [ExporterHeader(DisplayName = "Down Battery Real SOC", IsBold = true)] - public decimal? DownBatteryRealSoc { get; set; } - - [ExporterHeader(DisplayName = "Down Battery Last SOC", IsBold = true)] - public decimal? DownBatteryLastSoc { get; set; } - [ExporterHeader(DisplayName = "Down Battery Number", IsBold = true)] public string? DownBatteryNo { get; set; } @@ -109,21 +76,12 @@ public class SwapOrderDto2 [ExporterHeader(DisplayName = "Up Battery SOC", IsBold = true)] public decimal? UpBatterySoc { get; set; } - [ExporterHeader(DisplayName = "Up Battery Real SOC", IsBold = true)] - public decimal? UpBatteryRealSoc { get; set; } - [ExporterHeader(DisplayName = "Down Battery Bin Number", IsBold = true)] public int? DownBatteryBinNo { get; set; } [ExporterHeader(DisplayName = "Up Battery Bin Number", IsBold = true)] public int? UpBatteryBinNo { get; set; } - /// - /// 站号 - /// - [ExporterHeader(DisplayName = "Station Number", IsBold = true)] - public string StationNumber { get; set; } - /// /// 电量 /// @@ -132,11 +90,45 @@ public class SwapOrderDto2 /// /// 亏电包电量 /// - [ExporterHeader(DisplayName = "亏电包电量", IsBold = true)] + [ExporterHeader(DisplayName = "LOSS OF POWER PACKAGE", IsBold = true)] public string? DownBatteryElectricQuantity { get; set; } /// /// 满电包电量 /// - [ExporterHeader(DisplayName = "满电包电量", IsBold = true)] + [ExporterHeader(DisplayName = "FULL CHARGE PACK POWER", IsBold = true)] public string? UpBatteryElectricQuantity { get; set; } + + /// + /// Desc:公司 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "CORPORATION", IsBold = true)] + public string? Company {get;set;} + + /// + /// Desc:部门 + /// Default: + /// Nullable:True + /// + [ExporterHeader(DisplayName = "SECTION", IsBold = true)] + public string? Departments {get;set;} + + /// + /// 电费 + /// + [ExporterHeader(DisplayName = "ELECTRIC CHARGE", IsBold = true)] + public int? ElectricityTotalFee { get; set; } + + /// + /// 附加费 + /// + [ExporterHeader(DisplayName = "ADDITIONAL CHARGE", IsBold = true)] + public int? AppendTotalFee { get; set; } + + /// + /// 总费用(所有的总费用) + /// + [ExporterHeader(DisplayName = "TOTAL COST", IsBold = true)] + public int? TotalFee { get; set; } } \ No newline at end of file diff --git a/Service/Init/StaticStationInfo.cs b/Service/Init/StaticStationInfo.cs index fab1620..1b9ace9 100644 --- a/Service/Init/StaticStationInfo.cs +++ b/Service/Init/StaticStationInfo.cs @@ -315,5 +315,24 @@ public class StaticStationInfo _sysConfigService.Set(key, value); } + + public static int ServiceTotalFee + { + get => int.Parse(Resolve(StationParamConst.ServiceTotalFee)); + set => Set(StationParamConst.ServiceTotalFee, value); + } + + public static int ElectricityTotalFee + { + get => int.Parse(Resolve(StationParamConst.ElectricityTotalFee)); + set => Set(StationParamConst.ElectricityTotalFee, value); + } + + public static int AppendTotalFee + { + get => int.Parse(Resolve(StationParamConst.AppendTotalFee)); + set => Set(StationParamConst.AppendTotalFee, value); + } + #endregion } \ No newline at end of file diff --git a/Service/Station/ChargeOrderService.cs b/Service/Station/ChargeOrderService.cs index c1963b9..4a3f2fc 100644 --- a/Service/Station/ChargeOrderService.cs +++ b/Service/Station/ChargeOrderService.cs @@ -84,6 +84,34 @@ public class ChargeOrderService : BaseServices { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "充电订单.xlsx" }; } } + + public async Task ExportElectricityChargerNoConsumption(ChargeCountReq req,string language) + { + // 查询订单 + List resp = await GetElectricityConsumption(req, false); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap().ReverseMap(); + }); + IMapper mapper = config.CreateMapper(); + + if (language == "en") + { + List list2 = mapper.Map>(resp); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(list2); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_chargeCount.xlsx" }; + } + else + { + List list = mapper.Map>(resp); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(list); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "充电量统计.xlsx" }; + } + } /// /// 查询需要导出订单 /// diff --git a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs index a71b298..e903cec 100644 --- a/WebStarter/Controllers/BasicConfig/BaseConfigController.cs +++ b/WebStarter/Controllers/BasicConfig/BaseConfigController.cs @@ -151,6 +151,10 @@ namespace WebStarter.Controllers.BasicConfig stationBaseRespResp.StationStatus = StaticStationInfo.StationStatus; stationBaseRespResp.ChargeSoc = StaticStationInfo.ChargeSoc; stationBaseRespResp.VehicleManually = StaticStationInfo.VehicleManually; + // 单价 + stationBaseRespResp.ServiceTotalFee = StaticStationInfo.ServiceTotalFee; + stationBaseRespResp.ElectricityTotalFee = StaticStationInfo.ElectricityTotalFee; + stationBaseRespResp.AppendTotalFee = StaticStationInfo.AppendTotalFee; return Result.Success(stationBaseRespResp); } @@ -172,6 +176,15 @@ namespace WebStarter.Controllers.BasicConfig StaticStationInfo.ChargeSoc = input.ChargeSoc; StaticStationInfo.VehicleManually = input.VehicleManually; + + + + StaticStationInfo.ServiceTotalFee = input.ServiceTotalFee; + StaticStationInfo.ElectricityTotalFee = input.ElectricityTotalFee; + StaticStationInfo.AppendTotalFee = input.AppendTotalFee; + + + return Result.Success(); } diff --git a/WebStarter/Controllers/EquipAlarmRecordController.cs b/WebStarter/Controllers/EquipAlarmRecordController.cs index 7641080..cfe8dd5 100644 --- a/WebStarter/Controllers/EquipAlarmRecordController.cs +++ b/WebStarter/Controllers/EquipAlarmRecordController.cs @@ -1,5 +1,6 @@ using System.Linq.Expressions; using AutoMapper; +using Common.Const; using Entity.Api.Req; using Entity.DbModel.Station; using Entity.Dto; @@ -103,10 +104,53 @@ public class EquipAlarmRecordController : ControllerBase { cfg.CreateMap().ReverseMap(); cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); }); IMapper mapper = config.CreateMapper(); - + + if (req.TypeCode==(int)EquipmentType.Plc) + { + if (language == "en") + { + List logExList2 = mapper.Map>(equipAlarmRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList2); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_Unhandled_Alarm_Logs.xlsx" }; + } + else + { + List logExList = mapper.Map>(equipAlarmRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "未处理报警日志.xlsx" }; + } + } + if (req.TypeCode==(int)EquipmentType.Charger) + { + if (language == "en") + { + List logExList2 = mapper.Map>(equipAlarmRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList2); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_Unhandled_Alarm_Logs.xlsx" }; + } + else + { + List logExList = mapper.Map>(equipAlarmRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "未处理报警日志.xlsx" }; + } + } + if (language == "en") { List logExList2 = mapper.Map>(equipAlarmRecords); @@ -198,9 +242,54 @@ public class EquipAlarmRecordController : ControllerBase { cfg.CreateMap().ReverseMap(); cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); }); IMapper mapper = config.CreateMapper(); + + + if (req.TypeCode==(int)EquipmentType.Plc) + { + if (language == "en") + { + List logExList2 = mapper.Map>(equipAlarmProcessRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList2); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_Processed_Alarm_Logs.xlsx" }; + } + else + { + List logExList = mapper.Map>(equipAlarmProcessRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "已处理报警日志.xlsx" }; + } + } + + if (req.TypeCode==(int)EquipmentType.Charger) + { + if (language == "en") + { + List logExList2 = mapper.Map>(equipAlarmProcessRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList2); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_Processed_Alarm_Logs.xlsx" }; + } + else + { + List logExList = mapper.Map>(equipAlarmProcessRecords); + IExcelExporter excelExporter = new ExcelExporter(); + var res = await excelExporter.ExportAsByteArray(logExList); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "已处理报警日志.xlsx" }; + } + } if (language == "en") { diff --git a/WebStarter/Controllers/HomeController.cs b/WebStarter/Controllers/HomeController.cs index 2e0c575..c18b71e 100644 --- a/WebStarter/Controllers/HomeController.cs +++ b/WebStarter/Controllers/HomeController.cs @@ -70,4 +70,18 @@ public class HomeController : ControllerBase { return Result>.Success(await _chargeOrderService.GetElectricityConsumptionByChargerNo(req), "成功"); } + + /// + /// 充电量导出 + /// + /// + /// + [HttpPost] + [Route("export")] + public async Task ExportSwapOrder([FromBody] ChargeCountReq req) + { + // 获取请求头中的语言信息 + var language = Request.Headers["Accept-Language"].ToString().ToLower(); + return await _chargeOrderService.ExportElectricityChargerNoConsumption(req,language); + } } \ No newline at end of file diff --git a/WebStarter/Controllers/SwapOrderController.cs b/WebStarter/Controllers/SwapOrderController.cs index ab4cdd6..287818f 100644 --- a/WebStarter/Controllers/SwapOrderController.cs +++ b/WebStarter/Controllers/SwapOrderController.cs @@ -30,15 +30,17 @@ public class SwapOrderController : ControllerBase private readonly SwapOrderStepService swapOrderStepService; private readonly SwapOrderReportCloudRepository swapOrderReportCloudRepository; private readonly VehicleService vehicleService; + private readonly BaseVehicleRepository _baseVehicleRepository; public SwapOrderController(SwapOrderService swapOrderService, SwapOrderBatteryService swapOrderBatteryService, - SwapOrderStepService swapOrderStepService,SwapOrderReportCloudRepository swapOrderReportCloudRepository) + SwapOrderStepService swapOrderStepService,SwapOrderReportCloudRepository swapOrderReportCloudRepository,BaseVehicleRepository baseVehicleRepository + ) { this.swapOrderService = swapOrderService; this.swapOrderBatteryService = swapOrderBatteryService; this.swapOrderStepService = swapOrderStepService; this.swapOrderReportCloudRepository = swapOrderReportCloudRepository; - + _baseVehicleRepository = baseVehicleRepository; } /// @@ -58,8 +60,27 @@ public class SwapOrderController : ControllerBase Log.Info($"查询换电订单 SwapOrderController start QueryPage swapOrderService.QuerySwapOrder req={req}"); var swapOrderResp = swapOrderService.QuerySwapOrder(req); Log.Info($"查询换电订单 SwapOrderController end QueryPage swapOrderService.QuerySwapOrder req={req}"); - PackageSwapOrder(swapOrderResp); + + List? list = swapOrderResp.Rows; + List vehicleNoList = list?.Select(resp => resp.VehicleNo).ToList() ?? new List(); + // 查询车辆的部门 + List vehicleList = await _baseVehicleRepository + .Queryable() + .In(vehicle => vehicle.VehicleNo, vehicleNoList) + .ToListAsync(); + + // 给换电订单赋值车的公司和部门 + foreach (var swapOrder in list) + { + var matchingVehicle = vehicleList.FirstOrDefault(v => v.VehicleNo == swapOrder.VehicleNo); + + if (matchingVehicle != null) + { + swapOrder.Company = matchingVehicle.Company; + swapOrder.Departments = matchingVehicle.Departments; + } + } return Result>.Success(swapOrderResp); } @@ -363,91 +384,157 @@ public class SwapOrderController : ControllerBase var config = new MapperConfiguration(cfg => { cfg.CreateMap().ReverseMap(); - cfg.CreateMap().ReverseMap(); - cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); + cfg.CreateMap().ReverseMap(); }); IMapper mapper = config.CreateMapper(); List swapOrderBattery = mapper.Map>(batteryList); - List list = mapper.Map>(orderList); - List list2 = mapper.Map>(orderList); - - // 将电池数据添加到换电订单数据中 - for (int i = 0; i < list.Count; i++) + // 换电订单 + List swapOrderResp = mapper.Map>(orderList); + + List vehicleNoList = swapOrderResp.Select(resp => resp.VehicleNo).ToList() ?? new List(); + // 查询车辆的部门 + List vehicleList = await _baseVehicleRepository + .Queryable() + .In(vehicle => vehicle.VehicleNo, vehicleNoList) + .ToListAsync(); + + // 给换电订单赋值车的公司和部门 + foreach (var swapOrder in swapOrderResp) { - if (language == "en") + var matchingVehicle = vehicleList.FirstOrDefault(v => v.VehicleNo == swapOrder.VehicleNo); + + if (matchingVehicle != null) { - SwapOrderDto2 dto = list2[i]; + swapOrder.Company = matchingVehicle.Company; + swapOrder.Departments = matchingVehicle.Departments; + } + } + + if (req.SwapResult == 0 || req.SwapResult == 1) + { + List list = mapper.Map>(swapOrderResp); + List list2 = mapper.Map>(swapOrderResp); - SwapOrderBatteryResp? swapOrderBatteryResp = - swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); - if (swapOrderBatteryResp != null) + // 将电池数据添加到换电订单数据中 + for (int i = 0; i < list.Count; i++) + { + if (language == "en") { - dto.DownBatterySoc = swapOrderBatteryResp.DownBatterySoc; - dto.DownBatteryRealSoc = swapOrderBatteryResp.DownBatteryRealSoc; - dto.DownBatteryLastSoc = swapOrderBatteryResp.DownBatteryLastSoc; - dto.DownBatteryNo = swapOrderBatteryResp.DownBatteryNo; - dto.UpBatteryNo = swapOrderBatteryResp.UpBatteryNo; - dto.UpBatterySoc = swapOrderBatteryResp.UpBatterySoc; - dto.UpBatteryRealSoc = swapOrderBatteryResp.UpBatteryRealSoc; - dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo; - dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo; - dto.StationNumber = StaticStationInfo.StationNumber; - try - { - dto.DownBatteryElectricQuantity = ((double)dto.DownBatterySoc * 3.75).ToString(); - dto.UpBatteryElectricQuantity = ((double)dto.UpBatterySoc * 3.75).ToString(); - double ElectricQuantity = ((float)(dto.UpBatterySoc - dto.DownBatterySoc)) * 3.75; - dto.ElectricQuantity = ElectricQuantity.ToString(); + SwapOrderDto2 dto = list2[i]; + SwapOrderBatteryResp? swapOrderBatteryResp = + swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); + if (swapOrderBatteryResp != null) + { + dto.DownBatterySoc = swapOrderBatteryResp.DownBatterySoc; + dto.DownBatteryNo = swapOrderBatteryResp.DownBatteryNo; + dto.UpBatteryNo = swapOrderBatteryResp.UpBatteryNo; + dto.UpBatterySoc = swapOrderBatteryResp.UpBatterySoc; + dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo; + dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo; + try + { + dto.DownBatteryElectricQuantity = ((double)dto.DownBatterySoc * 3.75).ToString(); + dto.UpBatteryElectricQuantity = ((double)dto.UpBatterySoc * 3.75).ToString(); + double ElectricQuantity = ((float)(dto.UpBatterySoc - dto.DownBatterySoc)) * 3.75; + dto.ElectricQuantity = ElectricQuantity.ToString(); + } + catch (Exception e) + { + } } - catch (Exception e) + } + else + { + SwapOrderDto dto = list[i]; + SwapOrderBatteryResp? swapOrderBatteryResp = + swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); + if (swapOrderBatteryResp != null) { + dto.DownBatterySoc = swapOrderBatteryResp.DownBatterySoc; + dto.DownBatteryNo = swapOrderBatteryResp.DownBatteryNo; + dto.UpBatteryNo = swapOrderBatteryResp.UpBatteryNo; + dto.UpBatterySoc = swapOrderBatteryResp.UpBatterySoc; + dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo; + dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo; + try + { + dto.DownBatteryElectricQuantity = ((double)dto.DownBatterySoc * 3.75).ToString(); + dto.UpBatteryElectricQuantity = ((double)dto.UpBatterySoc * 3.75).ToString(); + double ElectricQuantity = ((float)(dto.UpBatterySoc - dto.DownBatterySoc)) * 3.75; + dto.ElectricQuantity = ElectricQuantity.ToString(); + } + catch (Exception e) + { + } } } } - else + + IExcelExporter excelExporter = new ExcelExporter(); + var res = language == "en" + ? await excelExporter.ExportAsByteArray(list2) + : await excelExporter.ExportAsByteArray(list); + + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { - SwapOrderDto dto = list[i]; - SwapOrderBatteryResp? swapOrderBatteryResp = - swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); - if (swapOrderBatteryResp != null) + FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + + (language == "en" ? "_Swap_Orders.xlsx" : "2号站换电记录.xlsx") + }; + } + else + { + List list = mapper.Map>(swapOrderResp); + List list2 = mapper.Map>(swapOrderResp); + + // 将电池数据添加到换电订单数据中 + for (int i = 0; i < list.Count; i++) + { + + if (language == "en") { - dto.DownBatterySoc = swapOrderBatteryResp.DownBatterySoc; - dto.DownBatteryRealSoc = swapOrderBatteryResp.DownBatteryRealSoc; - dto.DownBatteryLastSoc = swapOrderBatteryResp.DownBatteryLastSoc; - dto.DownBatteryNo = swapOrderBatteryResp.DownBatteryNo; - dto.UpBatteryNo = swapOrderBatteryResp.UpBatteryNo; - dto.UpBatterySoc = swapOrderBatteryResp.UpBatterySoc; - dto.UpBatteryRealSoc = swapOrderBatteryResp.UpBatteryRealSoc; - dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo; - dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo; - dto.StationNumber = StaticStationInfo.StationNumber; - try + SwapLoseOrderDto2 dto = list2[i]; + + SwapOrderBatteryResp? swapOrderBatteryResp = + swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); + if (swapOrderBatteryResp != null) { - dto.DownBatteryElectricQuantity = ((double)dto.DownBatterySoc * 3.75).ToString(); - dto.UpBatteryElectricQuantity = ((double)dto.UpBatterySoc * 3.75).ToString(); - double ElectricQuantity = ((float)(dto.UpBatterySoc - dto.DownBatterySoc)) * 3.75; - dto.ElectricQuantity = ElectricQuantity.ToString(); + dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo; + dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo; + } - catch (Exception e) + } + else + { + SwapLoseOrderDto dto = list[i]; + SwapOrderBatteryResp? swapOrderBatteryResp = + swapOrderBattery.FirstOrDefault(battery => battery.SwapOrderSn == dto.Sn); + if (swapOrderBatteryResp != null) { + dto.DownBatteryBinNo = swapOrderBatteryResp.DownBatteryBinNo; + dto.UpBatteryBinNo = swapOrderBatteryResp.UpBatteryBinNo; + } } } - } - IExcelExporter excelExporter = new ExcelExporter(); - var res = language == "en" - ? await excelExporter.ExportAsByteArray(list2) - : await excelExporter.ExportAsByteArray(list); + IExcelExporter excelExporter = new ExcelExporter(); + var res = language == "en" + ? await excelExporter.ExportAsByteArray(list2) + : await excelExporter.ExportAsByteArray(list); - return new FileStreamResult(new MemoryStream(res), "application/octet-stream") - { - FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + - (language == "en" ? "_Swap_Orders.xlsx" : "2号站换电记录.xlsx") - }; + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") + { + FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + + (language == "en" ? "_Swap_Lose_Orders.xlsx" : "2号站换电失败记录.xlsx") + }; + } } diff --git a/WebStarter/db/换电订单新增计费字段.sql b/WebStarter/db/换电订单新增计费字段.sql new file mode 100644 index 0000000..93bc0b2 --- /dev/null +++ b/WebStarter/db/换电订单新增计费字段.sql @@ -0,0 +1,4 @@ +ALTER TABLE swap_order +ADD COLUMN electricity_total_fee INT COMMENT '电费', +ADD COLUMN append_total_fee INT COMMENT '附加费', +ADD COLUMN total_fee INT COMMENT '总费用(所有的总费用)';