feature/creacion del reporte semanal de newell

feature/Reporte_Relacion_Facturas_Alen
Felix Morales 1 year ago
parent 2ece74d717
commit 6eb89d4e69
  1. 2
      Contracts/Corresponsalias/ICorresponsaliasTraficosRepository.cs
  2. 9
      Controllers/Corresponsalias/TraficosController.cs
  3. 64
      Controllers/FileManagerController.cs
  4. 10
      DTO/Reportes/DTOReporteSemanalNewel.cs
  5. 13
      Repository/Corresponsalias/CorresponsaliasTraficosRepository.cs

@ -2,12 +2,14 @@ using CORRESPONSALBackend.Models;
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.Models.Corresponsales;
using CORRESPONSALBackend.Repository.Corresponsalias;
using CORRESPONSALBackend.DTO.Reportes;
namespace CORRESPONSALBackend.Contracts.Corresponsalias
{
public interface ICorresponsaliasTraficosRepository
{
public Task<ITrafico> Get(int id);
public Task<DTOReporteSemanalNewell> GetByPedimento(int pedimento);
public Task<DashboardTotal> GetAll(int Mode);
public Task<IEnumerable<ICorRectificaciones>> GetRectificaciones(int id);
public Task<ICorRectificaciones> AddRectificacion(int id);

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using CORRESPONSALBackend.Services.C1896;
using CORRESPONSALBackend.Repository.Corresponsalias;
using CORRESPONSALBackend.DTO.Reportes;
namespace CORRESPONSALBackend.Controllers.Corresponsalias
{
@ -45,6 +46,14 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
return entrada;
}
[HttpGet]
[Route("GetByPedimento")]
public async Task<DTOReporteSemanalNewell> GetByPedimento([FromQuery] int pedimento)
{
var entrada = await _Repo.GetByPedimento(pedimento);
return entrada;
}
[HttpPut("AddRectificacion/{id}")]
public async Task<ICorRectificaciones> AddRectificacion(int id)
{

@ -7,6 +7,7 @@ using CORRESPONSALBackend.Contracts.Utils;
using CORRESPONSALBackend.Models.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.HttpResults;
namespace CORRESPONSALBackend.Controllers
{
@ -57,41 +58,46 @@ namespace CORRESPONSALBackend.Controllers
[Route("AppendFileByProcess")]
[HttpPost]
public async Task<FileManager> AppendFileByProcess(IFormFile file, int IdUsuario, int Proceso, string Tags, int crud)
public async Task<dynamic> AppendFileByProcess(IFormFile file, int IdUsuario, int Proceso, string Tags, int crud)
{
DateTime time = DateTime.Now;
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
string fullPath = "";
fullPath = RootPathCorresponsales + RelativePath.Path;
string fileMime = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1);
string newFileName = file.FileName.Replace("." + fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + "." + fileMime;
FileManager data = new FileManager();
data.id = 0;
data.IdUsuario = IdUsuario;
data.NombreArchivo = newFileName;
data.Proceso = Proceso;
data.FechaRegistro = "";
data.Tags = Tags;
data.Activo = 1;
long fileLength = 0;
if (@crud == 1)
{
if (file.Length > 0)
try{
DateTime time = DateTime.Now;
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
string fullPath = "";
fullPath = RootPathCorresponsales + RelativePath.Path;
string fileMime = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1);
string newFileName = file.FileName.Replace("." + fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + "." + fileMime;
FileManager data = new FileManager();
data.id = 0;
data.IdUsuario = IdUsuario;
data.NombreArchivo = newFileName;
data.Proceso = Proceso;
data.FechaRegistro = "";
data.Tags = Tags;
data.Activo = 1;
long fileLength = 0;
if (@crud == 1)
{
var filePath = fullPath + newFileName;
using (var stream = System.IO.File.Create(filePath))
{
await file.CopyToAsync(stream);
}
fileLength = new System.IO.FileInfo(filePath).Length / 1024;
data.Size = fileLength;
if (fileLength > 0)
if (file.Length > 0)
{
return await _Repo.FileManager(data);
var filePath = fullPath + newFileName;
using (var stream = System.IO.File.Create(filePath))
{
await file.CopyToAsync(stream);
}
fileLength = new System.IO.FileInfo(filePath).Length / 1024;
data.Size = fileLength;
if (fileLength > 0)
{
return await _Repo.FileManager(data);
}
}
}
return data;
}catch(Exception ex){
return Ok(ex.Message);
}
return data;
}

@ -0,0 +1,10 @@
namespace CORRESPONSALBackend.DTO.Reportes
{
public class DTOReporteSemanalNewell{
public string GC {get;set;}
public string Contenedor { get; set; }
public string CuentaDeGastos { get; set; }
public string Razon { get; set; }
public float Maniobras { get; set; }
}
}

@ -6,6 +6,7 @@ using CORRESPONSALBackend.Models;
using CORRESPONSALBackend.DTO.Corresponsales;
using System.Data;
using CORRESPONSALBackend.Models.Corresponsales;
using CORRESPONSALBackend.DTO.Reportes;
namespace CORRESPONSALBackend.Repository.Corresponsalias
{
@ -38,6 +39,18 @@ namespace CORRESPONSALBackend.Repository.Corresponsalias
return entrada.FirstOrDefault(new ITrafico { });
}
public async Task<DTOReporteSemanalNewell> GetByPedimento(int pedimento)
{
var query = "[Corresponsales.Trafico.GetByPedimento]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<DTOReporteSemanalNewell>(query, new
{
@pedimento
},
commandType: CommandType.StoredProcedure);
return entrada.FirstOrDefault(new DTOReporteSemanalNewell { });
}
public async Task<IEnumerable<ICorRectificaciones>> GetRectificaciones(int id)
{
var query = "[Corresponsales.Trafico.Rectificacion.GetAll]";

Loading…
Cancel
Save