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