Compare commits

...

4 commits

Author SHA1 Message Date
Leonel Toro
fb266caa62 Merge branch 'Desarrollo' into DEV-LT 2025-07-12 00:49:26 -04:00
Leonel Toro
3745a022d1 feat: se ajusta peticion para nuevo endpoint que obtiene los valores en tiempo real 2025-07-12 00:49:17 -04:00
bcastrogallardo
e7372f2ae6 Merge branch 'Desarrollo' into integracion-dga 2025-07-08 11:23:50 -04:00
bcastrogallardo
ca6f3cec82 fix log variables de entorno 2025-07-08 11:23:41 -04:00
6 changed files with 43 additions and 14 deletions

View file

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

View file

@ -14,6 +14,16 @@ namespace Integracion_DGA
{
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
{
Console.Write("Obteniendo variables de entorno...");
@ -35,9 +45,7 @@ namespace Integracion_DGA
using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
IConfiguration configuration = context.Configuration;
services.AddSingleton<IConfiguration>(configuration);
services.AddScoped<MedicionScadaRepository>();
services.AddScoped<EnvioDGA>();
services.AddHttpClient<RegistrarMedicion>();

View file

@ -14,6 +14,16 @@ namespace Recuperacion_DGA
{
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
{
Console.WriteLine("Obteniendo variables de entorno...");
@ -35,9 +45,7 @@ namespace Recuperacion_DGA
using IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
IConfiguration configuration = context.Configuration;
services.AddSingleton<IConfiguration>(configuration);
services.AddScoped<MedicionScadaRepository>();
services.AddScoped<EnvioDGA>();
services.AddHttpClient<RegistrarMedicion>();

View file

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

View file

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

View file

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