From 135e46016e57abb7456a7db41c7d07cd2e829b83 Mon Sep 17 00:00:00 2001 From: xjl <2595686544@qq.com> Date: Tue, 25 Jun 2024 11:46:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=B0=96=E5=B3=B0=E5=B9=B3?= =?UTF-8?q?=E8=B0=B7=E5=85=85=E7=94=B5=E9=87=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Charger/Handler/RecordChargeHandler.cs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) 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);