From e5341cfcff42415731aba34930438db6d8d9b3c9 Mon Sep 17 00:00:00 2001 From: bcastrogallardo Date: Thu, 17 Jul 2025 13:42:48 -0400 Subject: [PATCH 1/3] fix --- BLL/Recuperacion_DGA/EnvioDGA.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BLL/Recuperacion_DGA/EnvioDGA.cs b/BLL/Recuperacion_DGA/EnvioDGA.cs index 96a7863..351dc8e 100644 --- a/BLL/Recuperacion_DGA/EnvioDGA.cs +++ b/BLL/Recuperacion_DGA/EnvioDGA.cs @@ -43,7 +43,10 @@ namespace BLL.Recuperacion_DGA { var mediciones = await _dGAMedicionRepository.ObtenerMedicionesPorLoteAsync(pageNumber); - if (mediciones == null || !mediciones.Any()){ break; } + if (mediciones == null || mediciones.Count == 0) + { + break; + } foreach (var medicion in mediciones) { From d228cf71ddac55db0ff4153b37b9a9d05393a820 Mon Sep 17 00:00:00 2001 From: bcastrogallardo Date: Thu, 17 Jul 2025 14:00:21 -0400 Subject: [PATCH 2/3] cambios --- BLL/Recuperacion_DGA/EnvioDGA.cs | 3 ++- DAL/MedicionDGARepository.cs | 21 +++++-------------- .../Envios_DGA/MedicionSubterraneaRequest.cs | 2 -- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/BLL/Recuperacion_DGA/EnvioDGA.cs b/BLL/Recuperacion_DGA/EnvioDGA.cs index 351dc8e..7b8cbdc 100644 --- a/BLL/Recuperacion_DGA/EnvioDGA.cs +++ b/BLL/Recuperacion_DGA/EnvioDGA.cs @@ -38,10 +38,11 @@ namespace BLL.Recuperacion_DGA var logsEnviados = new List(); var pageNumber = 1; + var fechaInicio = DateTime.UtcNow; while (true) { - var mediciones = await _dGAMedicionRepository.ObtenerMedicionesPorLoteAsync(pageNumber); + var mediciones = await _dGAMedicionRepository.ObtenerMedicionesPorLoteAsync(pageNumber, fechaInicio); if (mediciones == null || mediciones.Count == 0) { diff --git a/DAL/MedicionDGARepository.cs b/DAL/MedicionDGARepository.cs index fa470f0..72ddb8d 100644 --- a/DAL/MedicionDGARepository.cs +++ b/DAL/MedicionDGARepository.cs @@ -8,27 +8,16 @@ namespace DAL { public class MedicionDGARepository { - public async Task> ObtenerMedicionesAsync() + public async Task> ObtenerMedicionesPorLoteAsync(int pageNumber, DateTime fecha) { - await using var connection = new SqlConnection(BdConexion.StringConnection); - - var result = await connection.QueryAsync( - "SP_OBTENER_DGA_DATOS", - commandType: CommandType.StoredProcedure); - - return result.ToList(); - } - - public async Task> ObtenerMedicionesPorLoteAsync(int pageNumber) - { - var nroPagina = new DynamicParameters(); - nroPagina.Add("@PageNumber", pageNumber); - + var parameters = new DynamicParameters(); + parameters.Add("@PageNumber", pageNumber); + parameters.Add("@FechaInicio", fecha); await using var connection = new SqlConnection(BdConexion.StringConnection); var resultado = await connection.QueryAsync( "SP_OBTENER_LOTE_DGA_DATOS", - nroPagina, + parameters, commandType: CommandType.StoredProcedure); return resultado.ToList(); diff --git a/SHARED/DTO/Envios_DGA/MedicionSubterraneaRequest.cs b/SHARED/DTO/Envios_DGA/MedicionSubterraneaRequest.cs index 001bb9e..7f9b2f2 100644 --- a/SHARED/DTO/Envios_DGA/MedicionSubterraneaRequest.cs +++ b/SHARED/DTO/Envios_DGA/MedicionSubterraneaRequest.cs @@ -20,7 +20,5 @@ public string? HoraMedicion { get; set; } public string? NivelFreaticoDelPozo { get; set; } public string? Totalizador { get; set; } - public string? TipoEmpresa { get; set; } - } } From 4df7d90f058e10c91e6e948f28b73aa97bb558ec Mon Sep 17 00:00:00 2001 From: bcastrogallardo Date: Thu, 17 Jul 2025 14:03:47 -0400 Subject: [PATCH 3/3] quitar url prueba --- DAL/LogEnvioRepository.cs | 2 +- DAS/RegistrarMedicion.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DAL/LogEnvioRepository.cs b/DAL/LogEnvioRepository.cs index a5434c4..45bae88 100644 --- a/DAL/LogEnvioRepository.cs +++ b/DAL/LogEnvioRepository.cs @@ -30,7 +30,7 @@ namespace DAL await connection.ExecuteAsync(sql, log); return true; } - catch (Exception ex) + catch (Exception) { return false; } diff --git a/DAS/RegistrarMedicion.cs b/DAS/RegistrarMedicion.cs index 3b4a0ad..bd0725f 100644 --- a/DAS/RegistrarMedicion.cs +++ b/DAS/RegistrarMedicion.cs @@ -28,7 +28,7 @@ namespace DAS var timeStamp = DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss-0000", CultureInfo.InvariantCulture); var json = JsonSerializer.Serialize(request); - var req = new HttpRequestMessage(HttpMethod.Post, $"{SubterraneaApiUrl.BaseUrl}{SubterraneaApiUrl.EndPoint}SSSSS"); + var req = new HttpRequestMessage(HttpMethod.Post, $"{SubterraneaApiUrl.BaseUrl}{SubterraneaApiUrl.EndPoint}"); req.Headers.Add("codigoObra", medicion.CODIGO_DGA); req.Headers.Add("timeStampOrigen", timeStamp); req.Content = new StringContent(json, Encoding.UTF8, "application/json"); @@ -55,7 +55,7 @@ namespace DAS log.ESTADO_ENVIO = "ERROR"; } - log.COMPROBANTE = apiResponse.Data.NumeroComprobante ?? null; + log.COMPROBANTE = apiResponse!.Data!.NumeroComprobante ?? null; log.ESTADO_ENVIO = "EXITO"; } catch (Exception)