Compare commits
No commits in common. "d51d3e1f02b3c766573aac1450889c0f21c1d205" and "4b6204d9e75b25a61ff3cc7d7bc67e29a16810c9" have entirely different histories.
d51d3e1f02
...
4b6204d9e7
7 changed files with 56 additions and 54 deletions
|
@ -40,11 +40,11 @@ namespace BLL.Integracion_DGA
|
||||||
{
|
{
|
||||||
string apiUrlBase = NexusApiUrl.ApiUrl;
|
string apiUrlBase = NexusApiUrl.ApiUrl;
|
||||||
Dictionary<string, string> headers = new Dictionary<string, string>
|
Dictionary<string, string> headers = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "nexustoken", NexusApiUrl.ApiKey },
|
{ "nexustoken", NexusApiUrl.ApiKey },
|
||||||
{ "nexusapiversion", NexusApiUrl.Version },
|
{ "nexusapiversion", NexusApiUrl.Version },
|
||||||
{ "accept", "application/json" }
|
{ "accept", "application/json" }
|
||||||
};
|
};
|
||||||
|
|
||||||
WriteLineAndLog($"Obteniendo Documentos");
|
WriteLineAndLog($"Obteniendo Documentos");
|
||||||
string apiUrlDocuments = apiUrlBase + "/api/Documents";
|
string apiUrlDocuments = apiUrlBase + "/api/Documents";
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace BLL.Recuperacion_DGA
|
||||||
Caudal = medicion.Caudal.ToString() ?? "",
|
Caudal = medicion.Caudal.ToString() ?? "",
|
||||||
FechaMedicion = medicion.DateOrigen?.ToString("yyyy-MM-dd") ?? "",
|
FechaMedicion = medicion.DateOrigen?.ToString("yyyy-MM-dd") ?? "",
|
||||||
HoraMedicion = medicion.DateOrigen?.ToString("HH:mm:ss") ?? "",
|
HoraMedicion = medicion.DateOrigen?.ToString("HH:mm:ss") ?? "",
|
||||||
NivelFreaticoDelPozo = medicion.nivelFreaticoDelPozo?.ToString() ?? "",
|
NivelFreaticoDelPozo = medicion.Nivel.ToString() ?? "",
|
||||||
Totalizador = medicion.Totalizador.ToString() ?? "",
|
Totalizador = medicion.Totalizador.ToString() ?? "",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -75,52 +75,52 @@ namespace BLL.Recuperacion_DGA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//var medicionesVilos = await _dgaMedicionScadaVilosRepository.ObtenerMedicionesVilosAsync();
|
var medicionesVilos = await _dgaMedicionScadaVilosRepository.ObtenerMedicionesVilosAsync();
|
||||||
//foreach (var medicionVilos in medicionesVilos)
|
foreach (var medicionVilos in medicionesVilos)
|
||||||
//{
|
{
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// if (!string.IsNullOrEmpty(medicionVilos.Code))
|
if (!string.IsNullOrEmpty(medicionVilos.Code))
|
||||||
// {
|
{
|
||||||
// var rutEmpresa = string.Empty;
|
var rutEmpresa = string.Empty;
|
||||||
|
|
||||||
// if (medicionVilos.tipo_empresa.Equals("AV"))
|
if (medicionVilos.tipo_empresa.Equals("AV"))
|
||||||
// {
|
{
|
||||||
// rutEmpresa = CredencialDGA.RutAv;
|
rutEmpresa = CredencialDGA.RutAv;
|
||||||
// }
|
}
|
||||||
// else if (medicionVilos.tipo_empresa.Equals("EV"))
|
else if (medicionVilos.tipo_empresa.Equals("EV"))
|
||||||
// {
|
{
|
||||||
// rutEmpresa = CredencialDGA.RutEsval;
|
rutEmpresa = CredencialDGA.RutEsval;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// var body = new MedicionSubterraneaRequest
|
var body = new MedicionSubterraneaRequest
|
||||||
// {
|
{
|
||||||
// Autenticacion = new Autenticacion
|
Autenticacion = new Autenticacion
|
||||||
// {
|
{
|
||||||
// Password = CredencialDGA.Password,
|
Password = CredencialDGA.Password,
|
||||||
// RutEmpresa = rutEmpresa,
|
RutEmpresa = rutEmpresa,
|
||||||
// RutUsuario = CredencialDGA.RutUsuario
|
RutUsuario = CredencialDGA.RutUsuario
|
||||||
// },
|
},
|
||||||
// MedicionSubterranea = new Medicion
|
MedicionSubterranea = new Medicion
|
||||||
// {
|
{
|
||||||
// Caudal = medicionVilos.Caudal.ToString() ?? "",
|
Caudal = medicionVilos.Caudal.ToString() ?? "",
|
||||||
// FechaMedicion = medicionVilos.DateOrigen?.ToString("yyyy-MM-dd") ?? "",
|
FechaMedicion = medicionVilos.DateOrigen?.ToString("yyyy-MM-dd") ?? "",
|
||||||
// HoraMedicion = medicionVilos.DateOrigen?.ToString("HH:mm:ss") ?? "",
|
HoraMedicion = medicionVilos.DateOrigen?.ToString("HH:mm:ss") ?? "",
|
||||||
// NivelFreaticoDelPozo = medicionVilos?.nivelFreaticoDelPozo.ToString() ?? "",
|
NivelFreaticoDelPozo = medicionVilos.Nivel.ToString() ?? "",
|
||||||
// Totalizador = medicionVilos.Totalizador.ToString() ?? "",
|
Totalizador = medicionVilos.Totalizador.ToString() ?? "",
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// await _registrarMedicion.EnviarMedicionAsync(medicionVilos.Code, body, medicionVilos.Id);
|
await _registrarMedicion.EnviarMedicionAsync(medicionVilos.Code, body, medicionVilos.Id);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// }
|
}
|
||||||
// catch (Exception ex)
|
catch (Exception ex)
|
||||||
// {
|
{
|
||||||
// FileLoggerHelper.LogError($"[Error] {ex.Message}.", ex);
|
FileLoggerHelper.LogError($"[Error] {ex.Message}.", ex);
|
||||||
// WriteLineAndLog($"Error al enviar la medición vilos con ID {medicionVilos.Code}.", ConsoleColor.Red);
|
WriteLineAndLog($"Error al enviar la medición vilos con ID {medicionVilos.Code}.", ConsoleColor.Red);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,10 @@ namespace DAL
|
||||||
{
|
{
|
||||||
using (var connection = new SqlConnection(BdConexion.StringConnection))
|
using (var connection = new SqlConnection(BdConexion.StringConnection))
|
||||||
{
|
{
|
||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
|
|
||||||
|
// Truncar la tabla antes de insertar
|
||||||
|
await connection.ExecuteAsync("TRUNCATE TABLE DGA_LOGS_OPERACION");
|
||||||
// Insertar todos los datos de la lista usando Dapper
|
// Insertar todos los datos de la lista usando Dapper
|
||||||
var sql = @"INSERT INTO dbo.DGA_LOGS_OPERACION
|
var sql = @"INSERT INTO dbo.DGA_LOGS_OPERACION
|
||||||
(estado_envio, json_enviado, json_recibido, comprobante, fecha_envio, id_medicion_smartscada_operacion)
|
(estado_envio, json_enviado, json_recibido, comprobante, fecha_envio, id_medicion_smartscada_operacion)
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace DAS
|
||||||
content.Headers.Add("codigoObra", codigoObra);
|
content.Headers.Add("codigoObra", codigoObra);
|
||||||
content.Headers.Add("timeStampOrigen", timeStamp);
|
content.Headers.Add("timeStampOrigen", timeStamp);
|
||||||
|
|
||||||
var response = await _httpClient.PostAsync($"{SubterraneaApiUrl.BaseUrl}{SubterraneaApiUrl.EndPoint}SSSSSSSSSSSSSSSSS", content);
|
/*var response = await _httpClient.PostAsync($"{SubterraneaApiUrl.BaseUrl}{SubterraneaApiUrl.EndPoint}", content);
|
||||||
string jsonRecibido = await response.Content.ReadAsStringAsync();
|
string jsonRecibido = await response.Content.ReadAsStringAsync();
|
||||||
string estado = response.IsSuccessStatusCode ? "OK" : "ERROR";
|
string estado = response.IsSuccessStatusCode ? "OK" : "ERROR";
|
||||||
string comprobante = string.Empty;
|
string comprobante = string.Empty;
|
||||||
|
@ -57,8 +57,8 @@ namespace DAS
|
||||||
FechaEnvio = DateTime.UtcNow,
|
FechaEnvio = DateTime.UtcNow,
|
||||||
IdMedicionSmartscadaOperacion = idMedicion
|
IdMedicionSmartscadaOperacion = idMedicion
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
await _logMedicionScadaRepository.InsertarLogMedicionScadaAsync(logMedicionScada);
|
//await _logMedicionScadaRepository.InsertarLogMedicionScadaAsync(logMedicionScada);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ namespace Integracion_DGA
|
||||||
services.AddScoped<LogMedicionScadaRepository>();
|
services.AddScoped<LogMedicionScadaRepository>();
|
||||||
services.AddScoped<ApiService>();
|
services.AddScoped<ApiService>();
|
||||||
services.AddScoped<BusinessLogic>();
|
services.AddScoped<BusinessLogic>();
|
||||||
services.AddScoped<MedicionScadaVilosRepository>();
|
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace Recuperacion_DGA
|
||||||
services.AddScoped<MedicionScadaVilosRepository>();
|
services.AddScoped<MedicionScadaVilosRepository>();
|
||||||
services.AddScoped<EnvioDGA>();
|
services.AddScoped<EnvioDGA>();
|
||||||
services.AddHttpClient<RegistrarMedicion>();
|
services.AddHttpClient<RegistrarMedicion>();
|
||||||
|
|
||||||
services.AddScoped<LogMedicionScadaRepository>();
|
services.AddScoped<LogMedicionScadaRepository>();
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
|
@ -22,6 +22,5 @@
|
||||||
public decimal? Nivel { get; set; }
|
public decimal? Nivel { get; set; }
|
||||||
|
|
||||||
public string? tipo_empresa { get; set; }
|
public string? tipo_empresa { get; set; }
|
||||||
public string? nivelFreaticoDelPozo { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue