master
赵宝玉 2 months ago
commit a17b8c3d68

@ -131,16 +131,16 @@
/// <summary>
/// 电费
/// </summary>
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费
/// </summary>
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
/// <summary>
/// 总费用(所有的总费用)
/// </summary>
public int? TotalFee { get; set; }
public decimal? TotalFee { get; set; }
}
}

@ -139,16 +139,16 @@ namespace Entity.Api.Req
/// <summary>
/// 电费
/// </summary>
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费
/// </summary>
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
/// <summary>
/// 总费用(所有的总费用)
/// </summary>
public int? TotalFee { get; set; }
public decimal? TotalFee { get; set; }
}
}

@ -54,15 +54,15 @@ public class StationConfigResp
/// <summary>
/// 服务费
/// </summary>
public int? ServiceTotalFee { get; set; }
public decimal? ServiceTotalFee { get; set; }
/// <summary>
/// 电费
/// </summary>
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费
/// </summary>
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
}

@ -159,20 +159,25 @@ namespace Entity.Api.Resp
/// </summary>
public string? Departments {get;set;}
/// <summary>
/// 换电服务费用
/// </summary>
public decimal? ServiceTotalFee { get; set; }
/// <summary>
/// 电费
/// </summary>
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费
/// </summary>
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
/// <summary>
/// 总费用(所有的总费用)
/// </summary>
public int? TotalFee { get; set; }
public decimal? TotalFee { get; set; }
/// <summary>
/// 手动操作

@ -199,5 +199,11 @@ namespace Entity.DbModel.Station
/// </summary>
[SugarColumn(ColumnName = "in_time")]
public DateTime? InTime { get; set; }
/// <summary>
/// 电池标称能量
/// </summary>
[SugarColumn(ColumnName = "nominal_energy")]
public decimal? NominalEnergy { get; set; }
}
}

@ -125,23 +125,29 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "swap_way")]
public int? SwapWay { get; set; }
/// <summary>
/// 换电服务费用(单位分)
/// </summary>
[SugarColumn(ColumnName = "service_total_fee")]
public decimal? ServiceTotalFee { get; set; }
/// <summary>
/// 电费(单位分)
/// </summary>
[SugarColumn(ColumnName = "electricity_total_fee")]
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费(单位分)
/// </summary>
[SugarColumn(ColumnName = "append_total_fee")]
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
/// <summary>
/// 总费用(所有的总费用-单位分)
/// </summary>
[SugarColumn(ColumnName = "total_fee")]
public int? TotalFee { get; set; }
public decimal? TotalFee { get; set; }
}
}

@ -205,10 +205,21 @@ namespace Entity.DbModel.Station
public int? UpBatteryBinNo { get; set; }
/// <summary>
/// 标称能量
/// 放电池标称能量
/// </summary>
///
[SugarColumn(ColumnName = "nominal_energy")]
public float? NominalEnergy { get; set; }
[SugarColumn(ColumnName = "down_nominal_energy")]
public decimal? DownNominalEnergy { get; set; }
/// <summary>
/// 取电池标称能量
/// </summary>
[SugarColumn(ColumnName = "up_nominal_energy")]
public decimal? UpNominalEnergy { get; set; }
/// <summary>
/// 是否算费0未结算1已结算
/// </summary>
[SugarColumn(ColumnName = "settle_an_account_flag")]
public int? SettleAnAccountFlag { get; set; }
}
}

@ -25,6 +25,10 @@ public class ChargeOrderDto
[ExporterHeader(DisplayName = "充电桩编号", IsBold = true)]
public string ChargerNo { get; set; }
[ExporterHeader(DisplayName = "仓位号", IsBold = true)]
public string BinNO { get; set; }
/// <summary>
/// Desc:电池编号
/// Default:
@ -56,7 +60,7 @@ public class ChargeOrderDto
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "充电时长", IsBold = true)]
[ExporterHeader(DisplayName = "充电时长/min", IsBold = true)]
public int ChargeTimeCount { get; set; }
/// <summary>

@ -14,6 +14,8 @@ public class ChargeOrderDto2
[ExporterHeader(DisplayName = "Order Number", IsBold = true)]
public string Sn { get; set; }
[ExporterHeader(DisplayName = "Battery Number", IsBold = true)]
public string BatteryNo { get; set; }
@ -21,6 +23,9 @@ public class ChargeOrderDto2
[ExporterHeader(DisplayName = "Charger Number", IsBold = true)]
public string ChargerNo { get; set; }
[ExporterHeader(DisplayName = "Location Number", IsBold = true)]
public string BinNO { get; set; }
[ExporterHeader(DisplayName = "Start Time", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)]

@ -18,6 +18,10 @@ public class SwapLoseOrderDto
[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? CreatedTime { get; set; }
[ExporterHeader(DisplayName = "开始时间", IsBold = true, Width = 30, Format = "yyyy-MM-dd HH:mm:ss",
AutoCenterColumn = true)]
@ -68,4 +72,7 @@ public class SwapLoseOrderDto
/// </summary>
[ExporterHeader(DisplayName = "失败原因", IsBold = true)]
public string FailReason { get; set; }
[ExporterHeader(DisplayName = "备注", IsBold = true)]
public decimal? Remark { get; set; }
}

@ -166,7 +166,7 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "soc", IsBold = true)]
[ExporterHeader(DisplayName = "soc%", IsBold = true)]
public decimal? UpBatterySoc { get; set; }
@ -199,7 +199,7 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "soc", IsBold = true)]
[ExporterHeader(DisplayName = "soc%", IsBold = true)]
public decimal? DownBatterySoc { get; set; }
@ -216,26 +216,34 @@ public class SwapOrderDto
/// Default:
/// Nullable:True
/// </summary>
[ExporterHeader(DisplayName = "订单编号", IsBold = true)]
[ExporterHeader(IsIgnore = true)]
public string Sn { get; set; }
/// <summary>
/// 换电服务费用
/// </summary>
[ExporterHeader(DisplayName = "服务费", IsBold = true)]
public decimal? ServiceTotalFee { get; set; }
/// <summary>
/// 电费
/// </summary>
[ExporterHeader(DisplayName = "电费", IsBold = true)]
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费
/// </summary>
[ExporterHeader(DisplayName = "附加费", IsBold = true)]
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
/// <summary>
/// 总费用(所有的总费用)
/// </summary>
[ExporterHeader(DisplayName = "总费用(所有的总费用)", IsBold = true)]
public int? TotalFee { get; set; }
[ExporterHeader(DisplayName = "总费用", IsBold = true)]
public decimal? TotalFee { get; set; }
[ExporterHeader(DisplayName = "备注", IsBold = true)]
public decimal? Remark { get; set; }
}

@ -118,17 +118,17 @@ public class SwapOrderDto2
/// 电费
/// </summary>
[ExporterHeader(DisplayName = "ELECTRIC CHARGE", IsBold = true)]
public int? ElectricityTotalFee { get; set; }
public decimal? ElectricityTotalFee { get; set; }
/// <summary>
/// 附加费
/// </summary>
[ExporterHeader(DisplayName = "ADDITIONAL CHARGE", IsBold = true)]
public int? AppendTotalFee { get; set; }
public decimal? AppendTotalFee { get; set; }
/// <summary>
/// 总费用(所有的总费用)
/// </summary>
[ExporterHeader(DisplayName = "TOTAL COST", IsBold = true)]
public int? TotalFee { get; set; }
public decimal? TotalFee { get; set; }
}

@ -89,6 +89,7 @@ public class CommonMgr
UpBatteryNo = upBin.BatteryNo,
UpBatterySoe = upBin.Soe,
UpBatteryBinNo = int.Parse(upBin.No),
UpNominalEnergy = upBin.NominalEnergy,
DownBatteryBinNo = int.Parse(inBin.No),
DownBatteryNo = inBin.BatteryNo,
DownBatterySoc = inBin.Soc,

@ -316,21 +316,21 @@ public class StaticStationInfo
}
public static int ServiceTotalFee
public static decimal ServiceTotalFee
{
get => int.Parse(Resolve(StationParamConst.ServiceTotalFee));
get => decimal.Parse(Resolve(StationParamConst.ServiceTotalFee));
set => Set(StationParamConst.ServiceTotalFee, value);
}
public static int ElectricityTotalFee
public static decimal ElectricityTotalFee
{
get => int.Parse(Resolve(StationParamConst.ElectricityTotalFee));
get => decimal.Parse(Resolve(StationParamConst.ElectricityTotalFee));
set => Set(StationParamConst.ElectricityTotalFee, value);
}
public static int AppendTotalFee
public static decimal AppendTotalFee
{
get => int.Parse(Resolve(StationParamConst.AppendTotalFee));
get => decimal.Parse(Resolve(StationParamConst.AppendTotalFee));
set => Set(StationParamConst.AppendTotalFee, value);
}

@ -0,0 +1,107 @@
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.AutoTask;
using log4net;
using Repository.Station;
using Service.Init;
namespace Service.MyTask;
/// <summary>
/// 换电订单算费用
/// </summary>
[Scope]
public class SwapOrderSettleAnAccountTask : ITask
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SwapOrderSettleAnAccountTask));
private volatile bool _stop;
private SwapOrderBatteryRepository SwapOrderBatteryRepository { get; set; }
private SwapOrderRepository SwapOrderRepository { get; set; }
public SwapOrderSettleAnAccountTask(SwapOrderBatteryRepository swapOrderBatteryRepository,
SwapOrderRepository swapOrderRepository)
{
SwapOrderBatteryRepository = swapOrderBatteryRepository;
SwapOrderRepository = swapOrderRepository;
}
public string Name()
{
return "SwapOrderSettleAnAccountTask";
}
public int Interval()
{
return 1000 * 2;
}
public void Handle()
{
Log.Info("Begin SwapOrderSettleAnAccountTask");
List<SwapOrderBattery> listSwapOrderBattery = SwapOrderBatteryRepository.QueryListByClause(i =>
i.DownNominalEnergy != null && i.UpNominalEnergy != null && i.SettleAnAccountFlag == 0);
if (listSwapOrderBattery.Count > 0)
{
List<string?> list = listSwapOrderBattery.Select(resp => resp.SwapOrderSn).ToList();
List<SwapOrder> swapOrderList = SwapOrderRepository
.Queryable()
.In(swapOrder => swapOrder.Sn, list)
.ToList();
// 电费单价
decimal electricityTotalFee = StaticStationInfo.ElectricityTotalFee;
// 换电服务费用
decimal serviceTotalFee = StaticStationInfo.ServiceTotalFee;
// 附加费用
decimal appendTotalFee = StaticStationInfo.AppendTotalFee;
foreach (var swapOrderBattery in listSwapOrderBattery)
{
// 换上的满电包soc*满电包的电池标量
decimal? upNominalEnergy = swapOrderBattery.UpBatterySoc * swapOrderBattery.UpNominalEnergy;
// 换下的亏电包soc*亏电包的电池标量
decimal? downNominalEnergy = swapOrderBattery.DownBatterySoc * swapOrderBattery.DownNominalEnergy;
// 电量费用
decimal? electricCharge = (upNominalEnergy - downNominalEnergy) * electricityTotalFee;
var matchingOrder = swapOrderList.FirstOrDefault(order => order.Sn == swapOrderBattery.SwapOrderSn);
if (matchingOrder != null)
{
matchingOrder.ServiceTotalFee = serviceTotalFee;
matchingOrder.ElectricityTotalFee = electricCharge;
matchingOrder.AppendTotalFee = appendTotalFee;
matchingOrder.TotalFee = matchingOrder.ServiceTotalFee + matchingOrder.ElectricityTotalFee +
matchingOrder.AppendTotalFee;
// 标记换电订单已经算了订单价钱
swapOrderBattery.SettleAnAccountFlag = 1;
}
}
SwapOrderRepository.Update(swapOrderList);
SwapOrderBatteryRepository.Update(listSwapOrderBattery);
}
}
public bool Stoped()
{
return _stop;
}
public void Stop()
{
_stop = true;
}
public void ResetStop()
{
_stop = false;
}
}

@ -17,7 +17,7 @@ public class UpdateDownBatteryInfoTask : ITask
private static readonly ILog Log = LogManager.GetLogger(typeof(UpdateDownBatteryInfoTask));
private volatile bool _stop;
public SwapOrderBatteryRepository _swapOrderBatteryRepository { get; set; }
@ -55,6 +55,7 @@ public class UpdateDownBatteryInfoTask : ITask
_swapOrderBatteryRepository.Update(i => new SwapOrderBattery()
{
DownBatterySoc = lstBinInfo.Soc,
DownNominalEnergy = lstBinInfo.NominalEnergy,
DownBatteryNo = lstBinInfo.BatteryNo
},
i => i.SwapOrderSn.ToString() == UpSwapOrderBattery.SwapOrderSn

@ -70,6 +70,13 @@ public class ChargeOrderService : BaseServices<ChargeOrder>
if (language == "en")
{
List<ChargeOrderDto2> list2 = mapper.Map<List<ChargeOrderDto2>>(chargeOrders);
foreach (var chargeOrderDto in list2)
{
if (!string.IsNullOrEmpty(chargeOrderDto.ChargerNo))
{
chargeOrderDto.BinNO = chargeOrderDto.ChargerNo;
}
}
IExcelExporter excelExporter = new ExcelExporter();
var res = await excelExporter.ExportAsByteArray(list2);
return new FileStreamResult(new MemoryStream(res), "application/octet-stream")
@ -78,6 +85,13 @@ public class ChargeOrderService : BaseServices<ChargeOrder>
else
{
List<ChargeOrderDto> list = mapper.Map<List<ChargeOrderDto>>(chargeOrders);
foreach (var chargeOrderDto in list)
{
if (!string.IsNullOrEmpty(chargeOrderDto.ChargerNo))
{
chargeOrderDto.BinNO = chargeOrderDto.ChargerNo;
}
}
IExcelExporter excelExporter = new ExcelExporter();
var res = await excelExporter.ExportAsByteArray(list);
return new FileStreamResult(new MemoryStream(res), "application/octet-stream")

@ -401,6 +401,26 @@ public class SwapOrderController : ControllerBase
List<SwapOrderBatteryResp> swapOrderBattery = mapper.Map<List<SwapOrderBatteryResp>>(batteryList);
// 换电订单
List<SwapOrderResp> swapOrderResp = mapper.Map<List<SwapOrderResp>>(orderList);
foreach (var orderResp in swapOrderResp)
{
if (orderResp.ServiceTotalFee.HasValue)
{
orderResp.ServiceTotalFee = Math.Round(orderResp.ServiceTotalFee.Value / 100m, 2);
}
if (orderResp.ElectricityTotalFee.HasValue)
{
orderResp.ElectricityTotalFee = Math.Round(orderResp.ElectricityTotalFee.Value / 100m, 2);
}
if (orderResp.AppendTotalFee.HasValue)
{
orderResp.AppendTotalFee = Math.Round(orderResp.AppendTotalFee.Value / 100m, 2);
}
if (orderResp.TotalFee.HasValue)
{
orderResp.TotalFee = Math.Round(orderResp.TotalFee.Value / 100m, 2);
}
}
List<string> vehicleNoList = swapOrderResp.Select(resp => resp.VehicleNo).ToList() ?? new List<string>();
// 查询车辆的部门

@ -1,7 +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 '总费用(所有的总费用)';
ALTER TABLE swap_order_step
@ -10,11 +7,26 @@ ADD COLUMN step_desc varchar(255) COMMENT '描述',
ADD COLUMN param text COMMENT '参数';
INSERT INTO `sys_config` VALUES (1300000000180, 'Station.ServiceTotalFee', 'ServiceTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
INSERT INTO `sys_config` VALUES (1300000000181, 'Station.ElectricityTotalFee', 'ElectricityTotalFee', '100000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
INSERT INTO `sys_config` VALUES (1300000000182, 'Station.AppendTotalFee', 'AppendTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
ALTER TABLE swap_order_battery
DROP COLUMN nominal_energy;
ALTER TABLE swap_order_battery
ADD COLUMN nominal_energy DECIMAL(24, 2) COMMENT '电池标称能量';
ADD COLUMN down_nominal_energy DECIMAL(24,2) COMMENT '放电池标称能量',
ADD COLUMN up_nominal_energy DECIMAL(24,2) COMMENT '取电池标称能量';
ALTER TABLE bin_info
ADD COLUMN nominal_energy DECIMAL(24,2) COMMENT '电池标称能量';
INSERT INTO `sys_config` VALUES (1300000000180, 'Station.ServiceTotalFee', 'ServiceTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
INSERT INTO `sys_config` VALUES (1300000000181, 'Station.ElectricityTotalFee', 'ElectricityTotalFee', '100000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
INSERT INTO `sys_config` VALUES (1300000000182, 'Station.AppendTotalFee', 'AppendTotalFee', '10000', 2, 'Station', 100, NULL, NULL, NULL, NULL, NULL, NULL, NULL, b'0');
ALTER TABLE swap_order
ADD COLUMN service_total_fee INT COMMENT '换电服务费';
ALTER TABLE swap_order
MODIFY COLUMN electricity_total_fee DECIMAL(24,2) COMMENT '电费',
MODIFY COLUMN append_total_fee DECIMAL(24,2) COMMENT '附加费',
MODIFY COLUMN total_fee DECIMAL(24,2) COMMENT '总费用(所有的总费用)',
MODIFY COLUMN service_total_fee DECIMAL(24,2) COMMENT '换电服务费';

Loading…
Cancel
Save