ajustes
This commit is contained in:
parent
657fd50ac9
commit
b52be74bfa
9 changed files with 129 additions and 42 deletions
|
@ -1,9 +1,10 @@
|
|||
using System.Text.Json;
|
||||
using DAL;
|
||||
using DAL;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Shared.DTO;
|
||||
using Shared.DTO.Integracion_DGA;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
using Shared.Helper;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BLL.Integracion_DGA
|
||||
{
|
||||
|
@ -12,17 +13,25 @@ namespace BLL.Integracion_DGA
|
|||
private readonly IConfiguration _configuration;
|
||||
private readonly ApiService _apiService;
|
||||
private readonly JobsDgaRepository _jobs;
|
||||
private readonly LogEnvioRepository _logEnvioRepository;
|
||||
|
||||
public ObtencionDatosDga(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs)
|
||||
public ObtencionDatosDga(IConfiguration configuration, ApiService apiService, JobsDgaRepository jobs, LogEnvioRepository logEnvioRepository)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_apiService = apiService;
|
||||
_jobs = jobs;
|
||||
FileLoggerHelper.ConfigureLogger(_configuration);
|
||||
_logEnvioRepository = logEnvioRepository;
|
||||
}
|
||||
|
||||
public async Task ObtenerDatosDga()
|
||||
{
|
||||
await _logEnvioRepository.InsertarLogProcesoAsync(new LogProceso
|
||||
{
|
||||
FechaEjecucion = DateTime.UtcNow,
|
||||
NombreProceso = "OBTENCION DATOS DGA"
|
||||
});
|
||||
|
||||
DateTimeOffset dateEnd = DateTimeOffset.Now;
|
||||
DateTimeOffset dateStart = dateEnd.AddHours(-1);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.Text.Json;
|
||||
using DAL;
|
||||
using DAS;
|
||||
using Shared.DTO;
|
||||
using Shared.DTO.Envios_DGA;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
using Shared.Helper;
|
||||
|
@ -11,17 +12,25 @@ namespace BLL.Recuperacion_DGA
|
|||
{
|
||||
private readonly MedicionDGARepository _dGAMedicionRepository;
|
||||
private readonly RegistrarMedicion _registrarMedicion;
|
||||
private readonly LogEnvioRepository _logEnvioRepository;
|
||||
|
||||
public EnvioDGA(MedicionDGARepository dGAMedicionRepository, RegistrarMedicion registrarMedicion)
|
||||
public EnvioDGA(MedicionDGARepository dGAMedicionRepository, RegistrarMedicion registrarMedicion, LogEnvioRepository logEnvioRepository)
|
||||
{
|
||||
_dGAMedicionRepository = dGAMedicionRepository;
|
||||
_registrarMedicion = registrarMedicion;
|
||||
_logEnvioRepository = logEnvioRepository;
|
||||
}
|
||||
|
||||
public async Task<bool> RegistrarMedicionesAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await _logEnvioRepository.InsertarLogProcesoAsync(new LogProceso
|
||||
{
|
||||
FechaEjecucion = DateTime.UtcNow,
|
||||
NombreProceso = "ENVIO DATOS DGA"
|
||||
});
|
||||
|
||||
ConsoleLoggerHelper.WriteLineAndLogEventoAsync("INICIO", "Inicio proceso de recuperación DGA", "");
|
||||
ConsoleLoggerHelper.WriteLineAndLogInfo("Obteniendo Mediciones Scada", ConsoleColor.Green);
|
||||
|
||||
|
@ -51,9 +60,10 @@ namespace BLL.Recuperacion_DGA
|
|||
Totalizador = medicion.TOTALIZADOR_CAUDAL ?? "",
|
||||
}
|
||||
};
|
||||
await _registrarMedicion.EnviarMedicionAsync(medicion, body, fechaEnvio);
|
||||
|
||||
listaMediciones.Add(new {Id = medicion.ID,FechaEnvio = fechaEnvio.ToString("yyyy-MM-dd HH:mm:ss"), Enviado = medicion.ENVIADO + 1});
|
||||
var response = await _registrarMedicion.EnviarMedicionAsync(medicion, body, fechaEnvio);
|
||||
|
||||
listaMediciones.Add(new {Id = medicion.ID,FechaEnvio = fechaEnvio.ToString("yyyy-MM-dd HH:mm:ss"), Enviado = 1});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -76,6 +86,7 @@ namespace BLL.Recuperacion_DGA
|
|||
ConsoleLoggerHelper.WriteLineAndLogInfo($"Error al procesar las mediciones.", ConsoleColor.Red);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue