From 767d3ea97f0e2b4e6caefc157a9a0ebf918cc9f4 Mon Sep 17 00:00:00 2001 From: Felix Morales Date: Fri, 1 Dec 2023 11:18:42 -0600 Subject: [PATCH] Endpoint que usaran los usuarios de los clientes para consultar sus traficos --- Contracts/IClientesRepository.cs | 3 +++ Controllers/ClientesController.cs | 8 ++++++++ DTO/Reportes/DTOFiltrosTraficosClientes.cs | 16 ++++++++++++++++ Repository/ClientesRepository.cs | 22 ++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 DTO/Reportes/DTOFiltrosTraficosClientes.cs diff --git a/Contracts/IClientesRepository.cs b/Contracts/IClientesRepository.cs index cd2f1a6..89c178a 100644 --- a/Contracts/IClientesRepository.cs +++ b/Contracts/IClientesRepository.cs @@ -1,4 +1,6 @@ using CORRESPONSALBackend.DTO.Cliente; +using CORRESPONSALBackend.DTO.Corresponsales; +using CORRESPONSALBackend.DTO.Reportes; using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.Models; @@ -12,5 +14,6 @@ namespace CORRESPONSALBackend.Contracts public Task> addCliente(DTOClienteUsuario CU); public Task> asignaClienteProveedor(DTOClienteProveedor cp); public Task> asignaUsuarioTransportista(DTOUsuarioTransportista t); + public Task> GetTraficos(DTOFiltrosTraficosClientes data); } } \ No newline at end of file diff --git a/Controllers/ClientesController.cs b/Controllers/ClientesController.cs index 3dc9648..dfa7e14 100644 --- a/Controllers/ClientesController.cs +++ b/Controllers/ClientesController.cs @@ -1,5 +1,7 @@ using CORRESPONSALBackend.Contracts; using CORRESPONSALBackend.DTO.Cliente; +using CORRESPONSALBackend.DTO.Corresponsales; +using CORRESPONSALBackend.DTO.Reportes; using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.Models; using Microsoft.AspNetCore.Authorization; @@ -97,5 +99,11 @@ namespace CORRESPONSALBackend.Controllers return StatusCode(500, ex.Message); } } + + [HttpGet("Traficos")] + public async Task> GetTraficosClientes([FromQuery] DTOFiltrosTraficosClientes data){ + var entrada = await _clientesRepo.GetTraficos(data); + return entrada; + } } } \ No newline at end of file diff --git a/DTO/Reportes/DTOFiltrosTraficosClientes.cs b/DTO/Reportes/DTOFiltrosTraficosClientes.cs new file mode 100644 index 0000000..d8ee96e --- /dev/null +++ b/DTO/Reportes/DTOFiltrosTraficosClientes.cs @@ -0,0 +1,16 @@ +namespace CORRESPONSALBackend.DTO.Reportes +{ + public class DTOFiltrosTraficosClientes + { + public string? Inicio { get; set; } = null!; + public string? Fin { get; set; } = null!; + public int? TipoOperacion { get; set; } = 0; + public int? NoCliente { get; set; } = 0; + public int IdCorresponsal { get; set; } = 0; + public int Pedimento {get;set;} = 0; + public int Patente {get;set;} = 0; + public int Aduana {get;set;} = 0; + public string? Referencia { get; set; } = null!; + public int IdUsuario {get;set;} = 0; + } +} \ No newline at end of file diff --git a/Repository/ClientesRepository.cs b/Repository/ClientesRepository.cs index 9cb562f..de2b9da 100644 --- a/Repository/ClientesRepository.cs +++ b/Repository/ClientesRepository.cs @@ -5,6 +5,8 @@ using CORRESPONSALBackend.Contracts; using CORRESPONSALBackend.DTO.Cliente; using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.Models; +using CORRESPONSALBackend.DTO.Corresponsales; +using CORRESPONSALBackend.DTO.Reportes; namespace CORRESPONSALBackend.Repository { @@ -77,5 +79,25 @@ namespace CORRESPONSALBackend.Repository } } + public async Task> GetTraficos(DTOFiltrosTraficosClientes data) + { + var query = "[Reportes.Web.Clientes.Traficos.Get]"; + using var connection = _context.CreateConnection(); + var entrada = await connection.QueryAsync(query, new + { + @Inicio = data.Inicio, + @Fin = data.Fin, + @NoCliente = data.NoCliente, + @TipoOperacion = data.TipoOperacion, + @IdCorresponsal = data.IdCorresponsal, + @Patente = data.Patente, + @Aduana = data.Aduana, + @Pedimento = data.Pedimento, + @Referencia = data.Referencia, + @idUsuario = data.IdUsuario + }, + commandType: CommandType.StoredProcedure); + return entrada; + } } }