|
|
@ -1,14 +1,21 @@
|
|
|
|
using Autofac;
|
|
|
|
using Autofac;
|
|
|
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.Redis;
|
|
|
|
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using Repository.Station;
|
|
|
|
|
|
|
|
using Service.Cloud.Msg;
|
|
|
|
|
|
|
|
using Service.Cloud.Msg.Host.Req;
|
|
|
|
using Service.Init;
|
|
|
|
using Service.Init;
|
|
|
|
using Service.System;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Service.Cloud.Client;
|
|
|
|
namespace Service.Cloud.Client;
|
|
|
|
|
|
|
|
|
|
|
|
[Scope("SingleInstance")]
|
|
|
|
[Scope("SingleInstance")]
|
|
|
|
public class CloudClientMgr
|
|
|
|
public class CloudClientMgr
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(CloudClientMgr));
|
|
|
|
public static CloudClient? CloudClient { get; set; }
|
|
|
|
public static CloudClient? CloudClient { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public static void Init()
|
|
|
|
public static void Init()
|
|
|
@ -29,5 +36,54 @@ public class CloudClientMgr
|
|
|
|
CloudClient.InitHandler();
|
|
|
|
CloudClient.InitHandler();
|
|
|
|
|
|
|
|
|
|
|
|
Task.Run(() => CloudClient.Connect());
|
|
|
|
Task.Run(() => CloudClient.Connect());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
|
|
|
|
|
|
|
|
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
|
|
|
|
|
|
|
|
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log.Info($"receive UploadTelemetryData={value}");
|
|
|
|
|
|
|
|
if (value.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UploadTelemetryData? data = JsonConvert.DeserializeObject<UploadTelemetryData>(value.ToString());
|
|
|
|
|
|
|
|
if (data != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BinInfo? binInfo = binInfoRepository.QueryByClause(it => it.ChargerNo == data.ChargerNo);
|
|
|
|
|
|
|
|
ChargeDevDataInfo req = new ChargeDevDataInfo()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sn = StaticStationInfo.StationNo,
|
|
|
|
|
|
|
|
en = data.ChargerNo,
|
|
|
|
|
|
|
|
sd = "A"+int.Parse(data.ChargerNo),
|
|
|
|
|
|
|
|
mtp = StaticStationInfo.ChargePower,
|
|
|
|
|
|
|
|
mcr = 1,
|
|
|
|
|
|
|
|
hb = binInfo?.Exists??0,
|
|
|
|
|
|
|
|
el = 0,
|
|
|
|
|
|
|
|
cno = int.Parse(data.ChargerNo),
|
|
|
|
|
|
|
|
cs = binInfo.ChargeStatus??0,
|
|
|
|
|
|
|
|
fs = 0,
|
|
|
|
|
|
|
|
@as = 0,
|
|
|
|
|
|
|
|
//fc = data.,
|
|
|
|
|
|
|
|
//st = data.,
|
|
|
|
|
|
|
|
ct = data.ChargingTime,
|
|
|
|
|
|
|
|
//ssoc = data.,
|
|
|
|
|
|
|
|
csoc = data.CurrentSoc,
|
|
|
|
|
|
|
|
//ssoe = data.,
|
|
|
|
|
|
|
|
//csoe = data.,
|
|
|
|
|
|
|
|
cvot = data.BmsChargingVoltage,
|
|
|
|
|
|
|
|
ccur = data.BmsChargingCurrent,
|
|
|
|
|
|
|
|
nvot = data.BmsNeedVoltage,
|
|
|
|
|
|
|
|
ncur = data.BmsNeedCurrent,
|
|
|
|
|
|
|
|
lsv = data.SingleBatteryMinVoltage,
|
|
|
|
|
|
|
|
hsv = data.SingleBatteryMaxVoltage,
|
|
|
|
|
|
|
|
lst = data.MinBatteryTemp,
|
|
|
|
|
|
|
|
hst = data.MaxBatteryTemp,
|
|
|
|
|
|
|
|
ws = 0xFF,
|
|
|
|
|
|
|
|
it = 0xFF,
|
|
|
|
|
|
|
|
ot = 0xFF,
|
|
|
|
|
|
|
|
bt = DateTime.Now
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
CloudClient?.SendChargeDevDataInfo(req);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|