Merge branch 'Desarrollo' into DEV-LT
This commit is contained in:
commit
92ce18173e
27 changed files with 416 additions and 535 deletions
15
SHARED/DTO/Envios_DGA/ApiResponse.cs
Normal file
15
SHARED/DTO/Envios_DGA/ApiResponse.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class ApiResponse<T>
|
||||
{
|
||||
public string? Status { get; set; }
|
||||
public string? Message { get; set; }
|
||||
public T? Data { get; set; }
|
||||
}
|
||||
}
|
27
SHARED/DTO/Envios_DGA/DatoDGA.cs
Normal file
27
SHARED/DTO/Envios_DGA/DatoDGA.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class DatoDGA
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
public string? CODIGO_DGA { get; set; }
|
||||
|
||||
public string? MACRO { get; set; }
|
||||
|
||||
public string? SENSOR { get; set; }
|
||||
|
||||
public string? CAUDAL { get; set; }
|
||||
|
||||
public string? TOTALIZADOR_CAUDAL { get; set; }
|
||||
|
||||
public DateTime? FECHA_MEDICION_CAUDAL { get; set; }
|
||||
|
||||
public string? NIVEL_FREATICO_DEL_POZO { get; set; }
|
||||
|
||||
public DateTime? FECHA_MEDICION_NIVEL { get; set; }
|
||||
|
||||
public string? TIPO_EMPRESA { get; set; }
|
||||
|
||||
public int ENVIADO { get; set; } = 0;
|
||||
}
|
||||
}
|
18
SHARED/DTO/Envios_DGA/DatoDGATemporal.cs
Normal file
18
SHARED/DTO/Envios_DGA/DatoDGATemporal.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class DatoDGATemporal
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string? CODIGO_DGA { get; set; }
|
||||
|
||||
public string? CAUDAL { get; set; }
|
||||
|
||||
public string? TOTALIZADOR_CAUDAL { get; set; }
|
||||
|
||||
public DateTime? FECHA_MEDICION_CAUDAL { get; set; }
|
||||
|
||||
public string? NIVEL_FREATICO_DEL_POZO { get; set; }
|
||||
|
||||
public string? TIPO_EMPRESA { get; set; }
|
||||
}
|
||||
}
|
12
SHARED/DTO/Envios_DGA/LogMedicionEnvio.cs
Normal file
12
SHARED/DTO/Envios_DGA/LogMedicionEnvio.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class LogMedicionEnvio
|
||||
{
|
||||
public string ESTADO_ENVIO { get; set; } = string.Empty;
|
||||
public string? JSON_ENVIO { get; set; }
|
||||
public string? JSON_RESPUESTA { get; set; }
|
||||
public string? COMPROBANTE { get; set; }
|
||||
public DateTime FECHA_ENVIO { get; set; }
|
||||
public int ID_DGA_DATO { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class LogMedicionScada
|
||||
{
|
||||
public string EstadoEnvio { get; set; }
|
||||
public string JsonEnviado { get; set; }
|
||||
public string JsonRecibido { get; set; }
|
||||
public string Comprobante { get; set; }
|
||||
public DateTime FechaEnvio { get; set; }
|
||||
public long IdMedicionSmartscadaOperacion { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class MedicionScada
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Code { get; set; }
|
||||
|
||||
public DateTime? DateOrigen { get; set; }
|
||||
|
||||
public DateTime? DateMedicionSup { get; set; }
|
||||
|
||||
public decimal? Caudal { get; set; }
|
||||
|
||||
public decimal? Altura { get; set; }
|
||||
|
||||
public DateTime? DateMedicionSub { get; set; }
|
||||
|
||||
public decimal? Totalizador { get; set; }
|
||||
|
||||
public decimal? Caudalsub { get; set; }
|
||||
|
||||
public decimal? Nivel { get; set; }
|
||||
public DateTime? FechaEnvio { get; set; }
|
||||
public int Enviado { get; set; }
|
||||
public string? tipo_empresa { get; set; }
|
||||
public string? nivelFreaticoDelPozo { get; set; }
|
||||
}
|
||||
}
|
|
@ -2,25 +2,23 @@
|
|||
{
|
||||
public class MedicionSubterraneaRequest
|
||||
{
|
||||
public Autenticacion Autenticacion { get; set; }
|
||||
public Medicion MedicionSubterranea { get; set; }
|
||||
public Autenticacion Autenticacion { get; set; } = new();
|
||||
public Medicion MedicionSubterranea { get; set; } = new();
|
||||
}
|
||||
|
||||
public class Autenticacion
|
||||
{
|
||||
public string Password { get; set; }
|
||||
public string RutEmpresa { get; set; }
|
||||
public string RutUsuario { get; set; }
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string RutEmpresa { get; set; } = string.Empty;
|
||||
public string RutUsuario { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Medicion
|
||||
{
|
||||
public string Caudal { get; set; }
|
||||
public string FechaMedicion { get; set; }
|
||||
public string HoraMedicion { get; set; }
|
||||
public string NivelFreaticoDelPozo { get; set; }
|
||||
public string Totalizador { get; set; }
|
||||
public string? TipoEmpresa { get; set; }
|
||||
|
||||
public string? Caudal { get; set; }
|
||||
public string? FechaMedicion { get; set; }
|
||||
public string? HoraMedicion { get; set; }
|
||||
public string? NivelFreaticoDelPozo { get; set; }
|
||||
public string? Totalizador { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
13
SHARED/DTO/Envios_DGA/MedicionSubterraneaResponse.cs
Normal file
13
SHARED/DTO/Envios_DGA/MedicionSubterraneaResponse.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO.Envios_DGA
|
||||
{
|
||||
public class MedicionSubterraneaResponse
|
||||
{
|
||||
public string? NumeroComprobante { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultado
|
||||
{
|
||||
public string TagName { get; set; } = null!;
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
public double? Value { get; set; }
|
||||
|
||||
public string? Quality { get; set; }
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultadoSupFluj
|
||||
{
|
||||
public string TagName { get; set; } = null!;
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
public double? Value { get; set; }
|
||||
|
||||
public string? Quality { get; set; }
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaMacroResultadoSupFlujSuma
|
||||
{
|
||||
public string TagName { get; set; } = null!;
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
public double? Value { get; set; }
|
||||
|
||||
public string? Quality { get; set; }
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace Shared.DTO.Integracion_DGA;
|
||||
|
||||
public partial class DgaSensorResultado
|
||||
{
|
||||
public string TagName { get; set; } = null!;
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
|
||||
public double? Value { get; set; }
|
||||
|
||||
public string? Quality { get; set; }
|
||||
}
|
14
SHARED/DTO/LogProceso.cs
Normal file
14
SHARED/DTO/LogProceso.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTO
|
||||
{
|
||||
public class LogProceso
|
||||
{
|
||||
public string NombreProceso { get; set; } = string.Empty;
|
||||
public DateTime FechaEjecucion { get; set; }
|
||||
}
|
||||
}
|
39
SHARED/Helper/ConsoleLoggerHelper.cs
Normal file
39
SHARED/Helper/ConsoleLoggerHelper.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace Shared.Helper
|
||||
{
|
||||
public static class ConsoleLoggerHelper
|
||||
{
|
||||
public static void WriteLineAndLogInfo(string msj, ConsoleColor? color = null)
|
||||
{
|
||||
if (color.HasValue && Enum.IsDefined(typeof(ConsoleColor), color.Value))
|
||||
{
|
||||
Console.ForegroundColor = color.Value;
|
||||
Console.WriteLine(msj);
|
||||
Console.ResetColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(msj);
|
||||
}
|
||||
|
||||
FileLoggerHelper.LogInformation(msj);
|
||||
}
|
||||
|
||||
public static void WriteLineAndLogEventoAsync(string evento, string proceso, string operacion = "", ConsoleColor? color = null)
|
||||
{
|
||||
if (color.HasValue && Enum.IsDefined(typeof(ConsoleColor), color.Value))
|
||||
{
|
||||
Console.ForegroundColor = color.Value;
|
||||
Console.WriteLine(proceso);
|
||||
Console.ResetColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(proceso);
|
||||
}
|
||||
|
||||
FileLoggerHelper.LogInformation(proceso);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
using Dapper;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using Shared.DTO.VariablesEntorno;
|
||||
|
||||
|
@ -10,7 +8,7 @@ namespace Shared.Helper
|
|||
{
|
||||
public static void ConfigureLogger(IConfiguration configuration)
|
||||
{
|
||||
var logFilePath = configuration.GetSection("Logging:LogFile:Path").Value;
|
||||
var logFilePath = configuration.GetSection("Logging:LogFile:Path").Value ?? "";
|
||||
var logFileFullPath = Path.Combine(Directory.GetCurrentDirectory(), logFilePath);
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
|
@ -28,31 +26,5 @@ namespace Shared.Helper
|
|||
{
|
||||
Log.Error(ex, message);
|
||||
}
|
||||
|
||||
public static async Task<bool> InsertarLogsAsync(string evento, string proceso, string operacion)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var connection = new SqlConnection(BdConexion.StringConnection);
|
||||
await connection.OpenAsync();
|
||||
|
||||
string sql = @"INSERT INTO DGA_LOGS_REGISTROS_ENVIOS (evento, proceso, operacion)
|
||||
VALUES (@evento, @proceso, @operacion)";
|
||||
|
||||
await connection.ExecuteAsync(sql, new
|
||||
{
|
||||
evento,
|
||||
proceso,
|
||||
operacion
|
||||
});
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogError("Error al insertar logs", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.66" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.6" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue