统计尖峰平谷充电量bug

master
xjl 5 months ago
parent fd520fdc0a
commit 135e46016e

@ -42,6 +42,7 @@ namespace Service.Charger.Handler
if(ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client)) if(ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
{ {
float[] powersPeriods = new float[4] { 0, 0, 0, 0 }; //元素索引顺序代表值1234 float[] powersPeriods = new float[4] { 0, 0, 0, 0 }; //元素索引顺序代表值1234
if (msg.FlagOfTime1 >= 1 && msg.FlagOfTime1 <= 4){powersPeriods[msg.FlagOfTime1 - 1] += msg.ChargingPowerOfTime1;} if (msg.FlagOfTime1 >= 1 && msg.FlagOfTime1 <= 4){powersPeriods[msg.FlagOfTime1 - 1] += msg.ChargingPowerOfTime1;}
if (msg.FlagOfTime2 >= 1 && msg.FlagOfTime2 <= 4){powersPeriods[msg.FlagOfTime2 - 1] += msg.ChargingPowerOfTime2;} if (msg.FlagOfTime2 >= 1 && msg.FlagOfTime2 <= 4){powersPeriods[msg.FlagOfTime2 - 1] += msg.ChargingPowerOfTime2;}
@ -88,13 +89,13 @@ namespace Service.Charger.Handler
StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore), StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore),
StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter), StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter),
SharpElecCount = Convert.ToDecimal(powersPeriods[0]), SharpElecCount = Convert.ToDecimal(powersPeriods[0]),
PeakElecCount = Convert.ToDecimal(powersPeriods[0]), PeakElecCount = Convert.ToDecimal(powersPeriods[1]),
FlatElecCount = Convert.ToDecimal(powersPeriods[0]), FlatElecCount = Convert.ToDecimal(powersPeriods[2]),
ValleyElecCount = Convert.ToDecimal(powersPeriods[0]), ValleyElecCount = Convert.ToDecimal(powersPeriods[3]),
AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]), AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]),
AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]), AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[1]),
AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]), AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[2]),
AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]), AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[3]),
ChargeMode = msg.ChargeMode, ChargeMode = msg.ChargeMode,
StartMode = msg.StartMode StartMode = msg.StartMode
}; };
@ -116,13 +117,13 @@ namespace Service.Charger.Handler
db.StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore); db.StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore);
db.StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter); db.StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter);
db.SharpElecCount = Convert.ToDecimal(powersPeriods[0]); db.SharpElecCount = Convert.ToDecimal(powersPeriods[0]);
db.PeakElecCount = Convert.ToDecimal(powersPeriods[0]); db.PeakElecCount = Convert.ToDecimal(powersPeriods[1]);
db.FlatElecCount = Convert.ToDecimal(powersPeriods[0]); db.FlatElecCount = Convert.ToDecimal(powersPeriods[2]);
db.ValleyElecCount = Convert.ToDecimal(powersPeriods[0]); db.ValleyElecCount = Convert.ToDecimal(powersPeriods[3]);
db.AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]); db.AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]);
db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]); db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[1]);
db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]); db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[2]);
db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]); db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[3]);
db.ChargeMode = msg.ChargeMode; db.ChargeMode = msg.ChargeMode;
db.StartMode = msg.StartMode; db.StartMode = msg.StartMode;
_chargeOrderRepository.Update(db); _chargeOrderRepository.Update(db);

Loading…
Cancel
Save