diff --git a/Service/Charger/Handler/RecordChargeHandler.cs b/Service/Charger/Handler/RecordChargeHandler.cs index d1e66d1..f87b309 100644 --- a/Service/Charger/Handler/RecordChargeHandler.cs +++ b/Service/Charger/Handler/RecordChargeHandler.cs @@ -42,6 +42,7 @@ namespace Service.Charger.Handler if(ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client)) { + float[] powersPeriods = new float[4] { 0, 0, 0, 0 }; //元素索引顺序代表值;1:尖;2:峰;3:平;4:谷 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;} @@ -88,13 +89,13 @@ namespace Service.Charger.Handler StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore), StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter), SharpElecCount = Convert.ToDecimal(powersPeriods[0]), - PeakElecCount = Convert.ToDecimal(powersPeriods[0]), - FlatElecCount = Convert.ToDecimal(powersPeriods[0]), - ValleyElecCount = Convert.ToDecimal(powersPeriods[0]), + PeakElecCount = Convert.ToDecimal(powersPeriods[1]), + FlatElecCount = Convert.ToDecimal(powersPeriods[2]), + ValleyElecCount = Convert.ToDecimal(powersPeriods[3]), AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]), - AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]), - AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]), - AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]), + AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[1]), + AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[2]), + AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[3]), ChargeMode = msg.ChargeMode, StartMode = msg.StartMode }; @@ -116,13 +117,13 @@ namespace Service.Charger.Handler db.StartDcElec = Convert.ToDecimal(msg.DcMeterDataBefore); db.StopDcElec = Convert.ToDecimal(msg.DcMeterDataAfter); db.SharpElecCount = Convert.ToDecimal(powersPeriods[0]); - db.PeakElecCount = Convert.ToDecimal(powersPeriods[0]); - db.FlatElecCount = Convert.ToDecimal(powersPeriods[0]); - db.ValleyElecCount = Convert.ToDecimal(powersPeriods[0]); + db.PeakElecCount = Convert.ToDecimal(powersPeriods[1]); + db.FlatElecCount = Convert.ToDecimal(powersPeriods[2]); + db.ValleyElecCount = Convert.ToDecimal(powersPeriods[3]); db.AcSharpElecCount = Convert.ToDecimal(acPowersPeriods[0]); - db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[0]); - db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[0]); - db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[0]); + db.AcPeakElecCount = Convert.ToDecimal(acPowersPeriods[1]); + db.AcFlatElecCount = Convert.ToDecimal(acPowersPeriods[2]); + db.AcValleyElecCount = Convert.ToDecimal(acPowersPeriods[3]); db.ChargeMode = msg.ChargeMode; db.StartMode = msg.StartMode; _chargeOrderRepository.Update(db);