From f0aa89d43b395c857874648675d0e9f001daa6e6 Mon Sep 17 00:00:00 2001 From: lxw Date: Fri, 15 Nov 2024 18:10:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E7=94=B5=E6=9C=BA=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=83=BD?= =?UTF-8?q?=E4=B8=80=E8=A1=8C=20=20=E6=A0=87=E7=A7=B0=E9=87=8D=E9=87=8F?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=EF=BC=8C=E5=8E=BB=E6=8E=89=E6=8D=A2=E8=83=BD?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B6=88=E9=98=B2=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/DbModel/Station/BinInfo.cs | 6 ++++++ Service/Charger/Handler/BatteryBaseInfoHandler.cs | 10 +++++++++- Service/Charger/Handler/RemoteSignalingHandler.cs | 5 +++-- Service/Charger/Msg/Charger/Resp/BatteryBaseInfo.cs | 4 ++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Entity/DbModel/Station/BinInfo.cs b/Entity/DbModel/Station/BinInfo.cs index e1f3cf5..36e0c4e 100644 --- a/Entity/DbModel/Station/BinInfo.cs +++ b/Entity/DbModel/Station/BinInfo.cs @@ -196,5 +196,11 @@ namespace Entity.DbModel.Station /// [SugarColumn(ColumnName = "in_time")] public DateTime? InTime { get; set; } + + /// + /// 电池标称能量 + /// + [SugarColumn(ColumnName = "nominal_energy")] + public decimal? NominalEnergy { get; set; } } } \ No newline at end of file diff --git a/Service/Charger/Handler/BatteryBaseInfoHandler.cs b/Service/Charger/Handler/BatteryBaseInfoHandler.cs index 0442f71..2bd7d9c 100644 --- a/Service/Charger/Handler/BatteryBaseInfoHandler.cs +++ b/Service/Charger/Handler/BatteryBaseInfoHandler.cs @@ -1,5 +1,6 @@ using DotNetty.Transport.Channels; using log4net; +using Repository.Station; using Service.Charger.Client; using Service.Charger.Msg.Charger.Resp; @@ -11,13 +12,20 @@ namespace Service.Charger.Handler; public class BatteryBaseInfoHandler : SimpleChannelInboundHandler, IBaseHandler { private static readonly ILog Log = LogManager.GetLogger(typeof(BatteryBaseInfoHandler)); - + public BinInfoRepository BinInfoRepository { get; set; } protected override void ChannelRead0(IChannelHandlerContext ctx, BatteryBaseInfo msg) { if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) { Log.Info($"receive {msg} from {sn}"); client.BatteryBaseInfo = msg; + + + float msgBatteryNominalEnergy = msg.RatedBatteryPack; + + decimal? nominalEnergyValue = (decimal?)msgBatteryNominalEnergy; + + BinInfoRepository.Update(t => t.NominalEnergy == nominalEnergyValue, t => t.No == client.BinNo); } } } \ No newline at end of file diff --git a/Service/Charger/Handler/RemoteSignalingHandler.cs b/Service/Charger/Handler/RemoteSignalingHandler.cs index 5c4d62e..3e76b3b 100644 --- a/Service/Charger/Handler/RemoteSignalingHandler.cs +++ b/Service/Charger/Handler/RemoteSignalingHandler.cs @@ -38,7 +38,8 @@ namespace Service.Charger.Handler client.RemoteSignaling = msg; - if (StaticStationInfo.AutoFireRelocation == 1) + //TODO::自动消防策略注释 + /*if (StaticStationInfo.AutoFireRelocation == 1) { if (msg.MaximumAlarmLevel == 3|| msg.FireAlarm==1 || msg.SmokeAlarm==1 ) @@ -55,7 +56,7 @@ namespace Service.Charger.Handler } - } + }*/ List lstAlarm = new List(); if (msg.CurrentBMS==1) { lstAlarm.Add("52"); } if (msg.CurrentStatusBMS==3) { lstAlarm.Add("53"); } diff --git a/Service/Charger/Msg/Charger/Resp/BatteryBaseInfo.cs b/Service/Charger/Msg/Charger/Resp/BatteryBaseInfo.cs index 2edc2af..401df54 100644 --- a/Service/Charger/Msg/Charger/Resp/BatteryBaseInfo.cs +++ b/Service/Charger/Msg/Charger/Resp/BatteryBaseInfo.cs @@ -29,8 +29,8 @@ public class BatteryBaseInfo: ASDU /// /// 电池包额定总能量 /// - [Property(32+8*17, 16)] - public byte RatedBatteryPack{get;set;} + [Property(32+8*17, 16,scale:0.1)] + public float RatedBatteryPack{get;set;} /// /// 电池冷却方式 ///