Compare commits
4 commits
90ec8dd344
...
fb266caa62
Author | SHA1 | Date | |
---|---|---|---|
|
fb266caa62 | ||
|
3745a022d1 | ||
|
e7372f2ae6 | ||
|
ca6f3cec82 |
6 changed files with 43 additions and 14 deletions
|
@ -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}/historic";
|
string apiUrlHistoric = $"{apiUrlBase}/api/Documents/tagviews/{item.uid}/realtime";
|
||||||
responseData = await _apiService.PostApiResponseAsync(apiUrlHistoric, headers, historicRequest);
|
responseData = await _apiService.PostApiResponseAsync(apiUrlHistoric, headers, listTagsID);
|
||||||
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 = $"SCADA001.{tag.Name}.F_CV";
|
dgaMacroResultado.TagName = tag.Name;
|
||||||
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;
|
||||||
|
|
|
@ -14,6 +14,16 @@ 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...");
|
||||||
|
@ -35,9 +45,7 @@ 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>();
|
||||||
|
|
|
@ -14,6 +14,16 @@ 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...");
|
||||||
|
@ -35,9 +45,7 @@ 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>();
|
||||||
|
|
|
@ -20,4 +20,10 @@
|
||||||
<ProjectReference Include="..\SHARED\Shared.csproj" />
|
<ProjectReference Include="..\SHARED\Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
7
Recuperacion_DGA/appsettings.json
Normal file
7
Recuperacion_DGA/appsettings.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogFile": {
|
||||||
|
"Path": "logs/log.txt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 long TimeStamp { get; set; }
|
public double TimeStamp { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue