Compare commits

..

No commits in common. "fb266caa62e88a07496a1e8433822331055bd75e" and "90ec8dd3440978fe08942d1087b166c1c5d2ec7a" have entirely different histories.

6 changed files with 14 additions and 43 deletions

View file

@ -64,16 +64,16 @@ namespace BLL.Integracion_DGA
listTagsID.Add(tag.Uid); listTagsID.Add(tag.Uid);
} }
//HistoricRequest historicRequest = new HistoricRequest(); HistoricRequest historicRequest = new HistoricRequest();
//historicRequest.DataSource = NexusApiUrl.DataSource; historicRequest.DataSource = NexusApiUrl.DataSource;
//historicRequest.Resolution = NexusApiUrl.Resolution; historicRequest.Resolution = NexusApiUrl.Resolution;
//historicRequest.Uids = listTagsID; historicRequest.Uids = listTagsID;
//historicRequest.StartTs = dateStart.ToUnixTimeSeconds(); historicRequest.StartTs = dateStart.ToUnixTimeSeconds();
//historicRequest.EndTs = dateEnd.ToUnixTimeSeconds(); historicRequest.EndTs = dateEnd.ToUnixTimeSeconds();
WriteLineAndLog($"Obteniendo Tagviews Historic"); WriteLineAndLog($"Obteniendo Tagviews Historic");
string apiUrlHistoric = $"{apiUrlBase}/api/Documents/tagviews/{item.uid}/realtime"; string apiUrlHistoric = $"{apiUrlBase}/api/Documents/tagviews/{item.uid}/historic";
responseData = await _apiService.PostApiResponseAsync(apiUrlHistoric, headers, listTagsID); responseData = await _apiService.PostApiResponseAsync(apiUrlHistoric, headers, historicRequest);
List<HistoricResponse> historicResponse = JsonSerializer.Deserialize<List<HistoricResponse>>(responseData, options); List<HistoricResponse> historicResponse = JsonSerializer.Deserialize<List<HistoricResponse>>(responseData, options);
List<DgaMacroResultado> listDgaMacroResultados = new List<DgaMacroResultado>(); List<DgaMacroResultado> listDgaMacroResultados = new List<DgaMacroResultado>();
@ -88,7 +88,7 @@ namespace BLL.Integracion_DGA
DgaMacroResultado dgaMacroResultado = new DgaMacroResultado(); DgaMacroResultado dgaMacroResultado = new DgaMacroResultado();
dgaMacroResultado.TagName = tag.Name; dgaMacroResultado.TagName = $"SCADA001.{tag.Name}.F_CV";
dgaMacroResultado.Value = historic.Value; dgaMacroResultado.Value = historic.Value;
//dgaMacroResultado.TimeStamp = new DateTime(historic.TimeStamp); //dgaMacroResultado.TimeStamp = new DateTime(historic.TimeStamp);
dgaMacroResultado.TimeStamp = fechaHoraChile; dgaMacroResultado.TimeStamp = fechaHoraChile;

View file

@ -14,16 +14,6 @@ namespace Integracion_DGA
{ {
static async Task Main(string[] args) static async Task Main(string[] args)
{ {
IConfiguration configuration;
configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
FileLoggerHelper.ConfigureLogger(configuration);
try try
{ {
Console.Write("Obteniendo variables de entorno..."); Console.Write("Obteniendo variables de entorno...");
@ -45,7 +35,9 @@ namespace Integracion_DGA
using IHost host = Host.CreateDefaultBuilder(args) using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) => .ConfigureServices((context, services) =>
{ {
IConfiguration configuration = context.Configuration;
services.AddSingleton<IConfiguration>(configuration); services.AddSingleton<IConfiguration>(configuration);
services.AddScoped<MedicionScadaRepository>(); services.AddScoped<MedicionScadaRepository>();
services.AddScoped<EnvioDGA>(); services.AddScoped<EnvioDGA>();
services.AddHttpClient<RegistrarMedicion>(); services.AddHttpClient<RegistrarMedicion>();

View file

@ -14,16 +14,6 @@ namespace Recuperacion_DGA
{ {
static async Task Main(string[] args) static async Task Main(string[] args)
{ {
IConfiguration configuration;
configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
FileLoggerHelper.ConfigureLogger(configuration);
try try
{ {
Console.WriteLine("Obteniendo variables de entorno..."); Console.WriteLine("Obteniendo variables de entorno...");
@ -45,7 +35,9 @@ namespace Recuperacion_DGA
using IHost host = Host.CreateDefaultBuilder(args) using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) => .ConfigureServices((context, services) =>
{ {
IConfiguration configuration = context.Configuration;
services.AddSingleton<IConfiguration>(configuration); services.AddSingleton<IConfiguration>(configuration);
services.AddScoped<MedicionScadaRepository>(); services.AddScoped<MedicionScadaRepository>();
services.AddScoped<EnvioDGA>(); services.AddScoped<EnvioDGA>();
services.AddHttpClient<RegistrarMedicion>(); services.AddHttpClient<RegistrarMedicion>();

View file

@ -20,10 +20,4 @@
<ProjectReference Include="..\SHARED\Shared.csproj" /> <ProjectReference Include="..\SHARED\Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View file

@ -1,7 +0,0 @@
{
"Logging": {
"LogFile": {
"Path": "logs/log.txt"
}
}
}

View file

@ -4,6 +4,6 @@
{ {
public string Uid { get; set; } public string Uid { get; set; }
public double? Value { get; set; } public double? Value { get; set; }
public double TimeStamp { get; set; } public long TimeStamp { get; set; }
} }
} }