zw
rszn 6 months ago
parent 3811803739
commit 265f4ea3bc

@ -1,14 +1,10 @@
using DotNetty.Transport.Channels; using DotNetty.Transport.Channels;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
using log4net; using log4net;
using Repository.Station; using Repository.Station;
using Service.Charger.Client; using Service.Charger.Client;
using Service.Charger.Msg.Charger.Req; using Service.Charger.Msg.Charger.Req;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.Charger.Handler namespace Service.Charger.Handler
{ {
@ -32,14 +28,14 @@ namespace Service.Charger.Handler
if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client)) if (ClientMgr.TryGetClient(ctx.Channel, out string sn, out var client))
{ {
Log.Info($"receive {msg} from {sn}"); Log.Info($"receive {msg} from {sn}");
if (_binInfoRepository.Update(t => t.Soc == (decimal)msg.SOC, t => t.No == client.BinNo) > 0) bool update = _binInfoRepository.Update(it => new BinInfo()
{ {
Log.Info($"succeed update battery soc {msg.SOC} for {client.BinNo}"); Soc = (decimal)msg.SOC,
} Soh = (decimal)msg.SOH
else }, t => t.No == client.BinNo);
{ Log.Info(update
Log.Info($"fail update battery soc {msg.SOC} for {client.BinNo}"); ? $"succeed update battery soc {msg.SOC} for {client.BinNo}"
} : $"fail update battery soc {msg.SOC} for {client.BinNo}");
} }
} }
} }

Loading…
Cancel
Save