|
|
|
@ -41,49 +41,56 @@ public class CloudClientMgr
|
|
|
|
|
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
|
|
|
|
|
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"receive UploadTelemetryData={value}");
|
|
|
|
|
if (value.HasValue)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
UploadTelemetryData? data = JsonConvert.DeserializeObject<UploadTelemetryData>(value.ToString());
|
|
|
|
|
if (data != null)
|
|
|
|
|
Log.Info($"receive UploadTelemetryData={value}");
|
|
|
|
|
if (value.HasValue)
|
|
|
|
|
{
|
|
|
|
|
BinInfo? binInfo = binInfoRepository.QueryByClause(it => it.ChargerNo == data.ChargerNo);
|
|
|
|
|
ChargeDevDataInfo req = new ChargeDevDataInfo()
|
|
|
|
|
UploadTelemetryData? data = JsonConvert.DeserializeObject<UploadTelemetryData>(value.ToString());
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Info("error", e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|