|
|
|
@ -36,6 +36,7 @@ public class CloudClientMgr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DateTime _dateTime = DateTime.Now.AddSeconds(-30);
|
|
|
|
|
private static DateTime _dateTime1 = DateTime.Now.AddSeconds(-30);
|
|
|
|
|
private static DateTime _dateTime2 = DateTime.Now.AddSeconds(-10);
|
|
|
|
|
private static DateTime _dateTime3 = DateTime.Now.AddSeconds(-10);
|
|
|
|
|
private static DateTime _dateTime4 = DateTime.Now.AddSeconds(-10);
|
|
|
|
@ -51,6 +52,8 @@ public class CloudClientMgr
|
|
|
|
|
|
|
|
|
|
private const int TimeSpan = 5;
|
|
|
|
|
|
|
|
|
|
private static ChargeDevDataInfo req = new ChargeDevDataInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async void Init()
|
|
|
|
|
{
|
|
|
|
@ -74,57 +77,84 @@ public class CloudClientMgr
|
|
|
|
|
|
|
|
|
|
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
|
|
|
|
|
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
|
|
|
|
|
|
|
|
|
|
#region 遥测合并上报
|
|
|
|
|
req.datainfo = new List<DataInfo>();
|
|
|
|
|
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
//ChargeDevDataInfo req = new ChargeDevDataInfo();
|
|
|
|
|
req.sn = StaticStationInfo.StationNo;
|
|
|
|
|
req.en = StaticStationInfo.StationNo + data.ChargerNo;
|
|
|
|
|
req.sd = "A" + int.Parse(binInfo.No);
|
|
|
|
|
req.mtp = StaticStationInfo.ChargePower;
|
|
|
|
|
req.mcr = 1;
|
|
|
|
|
req.hb = binInfo?.Exists ?? 0;
|
|
|
|
|
req.el = 0;
|
|
|
|
|
req.cno = int.Parse(binInfo.No);
|
|
|
|
|
req.cs = binInfo.ChargeStatus ?? 0;
|
|
|
|
|
req.fs = 0;
|
|
|
|
|
req.@as = 0;
|
|
|
|
|
//fc = data.,
|
|
|
|
|
//st = data.,
|
|
|
|
|
req.ct = data.ChargingTime;
|
|
|
|
|
//ssoc = data.,
|
|
|
|
|
req.csoc = data.CurrentSoc;
|
|
|
|
|
//ssoe = data.,
|
|
|
|
|
//csoe = data.,
|
|
|
|
|
req.cvot = data.BmsChargingVoltage;
|
|
|
|
|
req.ccur = data.BmsChargingCurrent;
|
|
|
|
|
req.nvot = data.BmsNeedVoltage;
|
|
|
|
|
req.ncur = data.BmsNeedCurrent;
|
|
|
|
|
req.lsv = data.SingleBatteryMinVoltage;
|
|
|
|
|
req.hsv = data.SingleBatteryMaxVoltage;
|
|
|
|
|
req.lst = data.MinBatteryTemp;
|
|
|
|
|
req.hst = data.MaxBatteryTemp;
|
|
|
|
|
req.ws = 0xFF;
|
|
|
|
|
req.it = 0xFF;
|
|
|
|
|
req.ot = 0xFF;
|
|
|
|
|
req.bt = DateTime.Now;
|
|
|
|
|
DataInfo dataInfo = new DataInfo();
|
|
|
|
|
dataInfo.en = StaticStationInfo.StationNo + data.ChargerNo;
|
|
|
|
|
|
|
|
|
|
var areNotEqual = !dataInfo.en.Equals(
|
|
|
|
|
req.datainfo.Select(d => d.en)
|
|
|
|
|
.ToList()
|
|
|
|
|
.Any(x => x == dataInfo.en));
|
|
|
|
|
if (areNotEqual)//如果没有重复的
|
|
|
|
|
{
|
|
|
|
|
dataInfo.sd = "A" + int.Parse(binInfo.No);
|
|
|
|
|
dataInfo.mtp = StaticStationInfo.ChargePower;
|
|
|
|
|
dataInfo.mcr = 1;
|
|
|
|
|
dataInfo.hb = binInfo?.Exists ?? 0;
|
|
|
|
|
dataInfo.el = 0;
|
|
|
|
|
dataInfo.cno = int.Parse(binInfo.No);
|
|
|
|
|
dataInfo.cs = binInfo.ChargeStatus ?? 0;
|
|
|
|
|
dataInfo.fs = 0;
|
|
|
|
|
dataInfo.@as = 0;
|
|
|
|
|
//fc = data.,
|
|
|
|
|
//st = data.,
|
|
|
|
|
dataInfo.ct = data.ChargingTime;
|
|
|
|
|
//ssoc = data.,
|
|
|
|
|
dataInfo.csoc = data.CurrentSoc;
|
|
|
|
|
//ssoe = data.,
|
|
|
|
|
//csoe = data.,
|
|
|
|
|
dataInfo.cvot = data.BmsChargingVoltage;
|
|
|
|
|
dataInfo.ccur = data.BmsChargingCurrent;
|
|
|
|
|
dataInfo.nvot = data.BmsNeedVoltage;
|
|
|
|
|
dataInfo.ncur = data.BmsNeedCurrent;
|
|
|
|
|
dataInfo.lsv = data.SingleBatteryMinVoltage;
|
|
|
|
|
dataInfo.hsv = data.SingleBatteryMaxVoltage;
|
|
|
|
|
dataInfo.lst = data.MinBatteryTemp;
|
|
|
|
|
dataInfo.hst = data.MaxBatteryTemp;
|
|
|
|
|
dataInfo.ws = 0xFF;
|
|
|
|
|
dataInfo.it = 0xFF;
|
|
|
|
|
dataInfo.ot = 0xFF;
|
|
|
|
|
dataInfo.bt = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
if (req.datainfo.Count < 7)
|
|
|
|
|
{
|
|
|
|
|
req.datainfo.Add(dataInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((DateTime.Now - _dateTime).TotalSeconds <= 30)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_dateTime = DateTime.Now;
|
|
|
|
|
CloudClient?.SendChargeDevDataInfo(req);
|
|
|
|
|
|
|
|
|
|
if (req.datainfo.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
CloudClient?.SendChargeDevDataInfo(req);
|
|
|
|
|
|
|
|
|
|
req = new ChargeDevDataInfo();
|
|
|
|
|
req.datainfo = new List<DataInfo>();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Log.Info($"receive UploadTelemetryData={value}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -133,6 +163,9 @@ public class CloudClientMgr
|
|
|
|
|
Log.Info("error", e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var sv = StaticStationInfo.StationSftVer.ToString();
|
|
|
|
|
|
|
|
|
|
redisHelper?.GetSubscriber().Subscribe("BatteryInfoUploadTask", (channel, value) =>
|
|
|
|
|
{
|
|
|
|
@ -144,6 +177,11 @@ public class CloudClientMgr
|
|
|
|
|
BatDataInfo? data = JsonConvert.DeserializeObject<BatDataInfo>(value.ToString());
|
|
|
|
|
if (data != null)
|
|
|
|
|
{
|
|
|
|
|
if ((DateTime.Now - _dateTime1).TotalSeconds <= 30)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_dateTime1 = DateTime.Now;
|
|
|
|
|
CloudClient?.SendBatDataInfo(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -173,7 +211,6 @@ public class CloudClientMgr
|
|
|
|
|
{
|
|
|
|
|
if (CloudClient.Connected)
|
|
|
|
|
{
|
|
|
|
|
//Log.Info("测试111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
|
|
|
|
CloudApi.SendStateLog(0);
|
|
|
|
|
|
|
|
|
|
TaskHostStatusReported();
|
|
|
|
@ -225,14 +262,15 @@ public class CloudClientMgr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_dateTime2 = DateTime.Now;
|
|
|
|
|
EquipAlarmRecordRepository equipAlarmRecordRepository = AppInfo.Container.Resolve<EquipAlarmRecordRepository>();
|
|
|
|
|
var EquipAlarm = equipAlarmRecordRepository.Query();
|
|
|
|
|
var ErrorLevel = Convert.ToInt32(EquipAlarm.Min(x => x.ErrorLevel));
|
|
|
|
|
|
|
|
|
|
//EquipAlarmRecordRepository equipAlarmRecordRepository = AppInfo.Container.Resolve<EquipAlarmRecordRepository>();
|
|
|
|
|
//var EquipAlarm = equipAlarmRecordRepository.Query();
|
|
|
|
|
//var ErrorLevel = Convert.ToInt32(EquipAlarm.Min(x => x.ErrorLevel));
|
|
|
|
|
StationRunStatus stationRunStatus = new()
|
|
|
|
|
{
|
|
|
|
|
rs = StaticStationInfo.StationStatus == 1 ? 1 : 2,
|
|
|
|
|
rs = StaticStationInfo.Sevstatus,
|
|
|
|
|
os = StaticStationInfo.StationStatus,
|
|
|
|
|
fl = ErrorLevel,
|
|
|
|
|
fl =Convert.ToInt32( StaticStationInfo.Faultlevel),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -641,8 +679,8 @@ public class CloudClientMgr
|
|
|
|
|
et = Convert.ToDateTime(exStationDayRunResult?.RunEndTime),
|
|
|
|
|
tt = Convert.ToInt32(exStationDayRunResult?.ToltalTimeCount),
|
|
|
|
|
//tt = 24 * 60,
|
|
|
|
|
ft = Convert.ToDateTime(exStationDayRunResult?.FristSwapTime),
|
|
|
|
|
sp = Convert.ToDateTime(exStationDayRunResult?.StopTime),
|
|
|
|
|
ft = exStationDayRunResult?.FristSwapTime,
|
|
|
|
|
sp = exStationDayRunResult?.StopTime,
|
|
|
|
|
ts = Convert.ToSingle(exStationDayRunResult?.ToltalSwapAllTime * 60),
|
|
|
|
|
tc = exStationDayRunResult.ToltalSwapCount,
|
|
|
|
|
cc = exStationDayRunResult.ChgCount,
|
|
|
|
|