|
|
|
@ -511,33 +511,46 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
|
|
|
|
|
/// <param name="op">1: 自动; 2: 人工手动</param>
|
|
|
|
|
/// <param name="timeSpan">超时等待</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool PublishChargeOrder(ChargeOrder chargeOrder, int op, TimeSpan? timeSpan = null)
|
|
|
|
|
public bool PublishChargeOrder(List<ChargeOrder> orders, int op, TimeSpan? timeSpan = null)
|
|
|
|
|
{
|
|
|
|
|
ChargeOrder chargeOrder = orders[0];
|
|
|
|
|
ChargeOrder lastChargeOrder = orders[^1];
|
|
|
|
|
string swapOrderSn = chargeOrder.SwapOrderSn;
|
|
|
|
|
SwapOrder? swapOrder = SwapOrderRepository.QueryByClause(it => it.Sn == swapOrderSn);
|
|
|
|
|
ChargeRecordUpLoad req = new ChargeRecordUpLoad()
|
|
|
|
|
{
|
|
|
|
|
chrsn = chargeOrder.Sn,
|
|
|
|
|
chrsn = chargeOrder.CloudChargeOrder,
|
|
|
|
|
son = swapOrderSn,
|
|
|
|
|
bid = chargeOrder.BatteryNo,
|
|
|
|
|
st = chargeOrder.StartTime ?? DateTime.Now,
|
|
|
|
|
et = chargeOrder.EndTime ?? DateTime.Now,
|
|
|
|
|
et = lastChargeOrder.EndTime ?? DateTime.Now,
|
|
|
|
|
ssoc = chargeOrder.StartSoc ?? 0,
|
|
|
|
|
esoc = chargeOrder.StopSoc ?? 0,
|
|
|
|
|
esoc = lastChargeOrder.StopSoc ?? 0,
|
|
|
|
|
//ssoe = chargeOrder.soe
|
|
|
|
|
//esoe
|
|
|
|
|
dcce = Convert.ToSingle(chargeOrder.StopDcElec ?? 0 - chargeOrder.StartDcElec ?? 0),
|
|
|
|
|
acce = Convert.ToSingle(chargeOrder.StopAcElec ?? 0 - chargeOrder.StartAcElec ?? 0),
|
|
|
|
|
tp = Convert.ToSingle(chargeOrder.SharpElecCount),
|
|
|
|
|
pp = Convert.ToSingle(chargeOrder.PeakElecCount),
|
|
|
|
|
fp = Convert.ToSingle(chargeOrder.FlatElecCount),
|
|
|
|
|
vp = Convert.ToSingle(chargeOrder.ValleyElecCount),
|
|
|
|
|
ct = ((chargeOrder.EndTime ?? DateTime.Now).Subtract(chargeOrder.StartTime ?? DateTime.Now)).Minutes,
|
|
|
|
|
cn = 1,
|
|
|
|
|
dcce =0,
|
|
|
|
|
acce =0,
|
|
|
|
|
tp = 0,
|
|
|
|
|
pp = 0,
|
|
|
|
|
fp = 0,
|
|
|
|
|
vp = 0,
|
|
|
|
|
ct = 0,
|
|
|
|
|
cn = orders.Count,
|
|
|
|
|
sfs = op,
|
|
|
|
|
vin = swapOrder?.VehicleVin,
|
|
|
|
|
sfoc = op,
|
|
|
|
|
vin = swapOrder.VehicleVin,
|
|
|
|
|
sfoc = 0,
|
|
|
|
|
};
|
|
|
|
|
foreach (ChargeOrder order in orders)
|
|
|
|
|
{
|
|
|
|
|
req.dcce += Convert.ToSingle(order.StopDcElec ?? 0 - order.StartDcElec ?? 0);
|
|
|
|
|
req.acce += Convert.ToSingle(order.StopAcElec ?? 0 - order.StartAcElec ?? 0);
|
|
|
|
|
req.tp += Convert.ToSingle(order.SharpElecCount);
|
|
|
|
|
req.pp += Convert.ToSingle(order.PeakElecCount);
|
|
|
|
|
req.fp += Convert.ToSingle(order.FlatElecCount);
|
|
|
|
|
req.vp += Convert.ToSingle(order.ValleyElecCount);
|
|
|
|
|
req.ct += ((order.EndTime ?? DateTime.Now).Subtract(order.StartTime ?? DateTime.Now)).Minutes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.SendChargeRecordUpLoad(req);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|