|
|
|
@ -34,6 +34,8 @@ public class EmeterEnergyRecordTask : ITask
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<EmeterEnergy> list = new List<EmeterEnergy>();
|
|
|
|
|
List<EmeterEnergyChange> listEmeterEnergyChanges = new List<EmeterEnergyChange>();
|
|
|
|
|
foreach (var keyValuePair in ClientMgr.Dictionary)
|
|
|
|
|
{
|
|
|
|
|
var chargerClient = keyValuePair.Value;
|
|
|
|
@ -41,27 +43,43 @@ public class EmeterEnergyRecordTask : ITask
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string id = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
|
|
string code = StaticStationInfo.StationNo + "_" + chargerClient.Sn;
|
|
|
|
|
id = id + "_" + chargerClientSn;
|
|
|
|
|
EmeterEnergy emeterEnergy = new()
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
UploadFlag = 0,
|
|
|
|
|
Value = chargerClient.UploadTelemetryData.DcMeterCurrentPower,
|
|
|
|
|
Code = StaticStationInfo.StationNo + "_" + chargerClient.Sn,
|
|
|
|
|
Code =code ,
|
|
|
|
|
UploadTime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
EmeterEnergyRepository.Insert(emeterEnergy);
|
|
|
|
|
list.Add(emeterEnergy);
|
|
|
|
|
|
|
|
|
|
EmeterEnergyChange emeterEnergyChange = new()
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
UploadFlag = 0,
|
|
|
|
|
Value = chargerClient.UploadTelemetryData.ACMeterCurrentBatteryValue,
|
|
|
|
|
Code = StaticStationInfo.StationNo + "_" + chargerClient.Sn,
|
|
|
|
|
Code = code,
|
|
|
|
|
UploadTime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
EmeterEnergyChangeRepository.Insert(emeterEnergyChange);
|
|
|
|
|
listEmeterEnergyChanges.Add(emeterEnergyChange);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
EmeterEnergyRepository.Insert(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (listEmeterEnergyChanges.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
EmeterEnergyChangeRepository.Insert(listEmeterEnergyChanges);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|