|
|
@ -9,6 +9,7 @@ using CORRESPONSALBackend.Repository.Corresponsalias; |
|
|
|
using CORRESPONSALBackend.DTO.Reportes; |
|
|
|
using CORRESPONSALBackend.DTO.Reportes; |
|
|
|
using CORRESPONSALBackend.Contracts.Corresponsalias.Services; |
|
|
|
using CORRESPONSALBackend.Contracts.Corresponsalias.Services; |
|
|
|
using CORRESPONSALBackend.Contracts.Catalogos; |
|
|
|
using CORRESPONSALBackend.Contracts.Catalogos; |
|
|
|
|
|
|
|
using System.Globalization; |
|
|
|
|
|
|
|
|
|
|
|
namespace CORRESPONSALBackend.Controllers.Corresponsalias |
|
|
|
namespace CORRESPONSALBackend.Controllers.Corresponsalias |
|
|
|
{ |
|
|
|
{ |
|
|
@ -164,17 +165,20 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias |
|
|
|
var proveedores = await _proveedoresRepository.GetAll(0); |
|
|
|
var proveedores = await _proveedoresRepository.GetAll(0); |
|
|
|
proveedores.ToList(); |
|
|
|
proveedores.ToList(); |
|
|
|
var facturas = await _traficosService.ReadTxtFacturasAlen(fileId); |
|
|
|
var facturas = await _traficosService.ReadTxtFacturasAlen(fileId); |
|
|
|
{ |
|
|
|
var facturasOrdenadas = facturas.OrderByDescending(x => DateTime.ParseExact(x[22].Replace(" "," "), "MM/dd/yyyy h:mm:ss tt", CultureInfo.InvariantCulture)).ToArray(); |
|
|
|
trafico.Pedimento = int.Parse(facturas[0][6]); |
|
|
|
{ |
|
|
|
trafico.FechaPago = DateTime.Parse(facturas[0][7]).ToString("yyyy/MM/dd"); |
|
|
|
trafico.Pedimento = int.Parse(facturasOrdenadas[0][6]); |
|
|
|
trafico.Clave = facturas[0][8]; |
|
|
|
trafico.FechaPago = facturasOrdenadas[0][7]; |
|
|
|
trafico.TipoCambio = double.Parse(facturas[0][15]); |
|
|
|
trafico.Clave = facturasOrdenadas[0][8]; |
|
|
|
trafico.CantidadFracciones = int.Parse(facturas[0][21]); |
|
|
|
trafico.TipoCambio = double.Parse(facturasOrdenadas[0][15]); |
|
|
|
trafico.DescripcionMercancia = facturas[0][14]; |
|
|
|
trafico.CantidadFracciones = int.Parse(facturasOrdenadas[0][21]); |
|
|
|
trafico.Observaciones = facturas[0][48]; |
|
|
|
trafico.DescripcionMercancia = facturasOrdenadas[0][14]; |
|
|
|
|
|
|
|
trafico.Observaciones = facturasOrdenadas[0][48]; |
|
|
|
|
|
|
|
trafico.FechaDesaduanamiento = facturasOrdenadas[0][22]; |
|
|
|
await _Repo.Append(trafico); |
|
|
|
await _Repo.Append(trafico); |
|
|
|
} |
|
|
|
} |
|
|
|
foreach(var factura in facturas){ |
|
|
|
foreach(var factura in facturasOrdenadas){ |
|
|
|
|
|
|
|
if (!new List<string>() { " ", "-", "_" }.Contains(factura[13]) && !String.IsNullOrEmpty(factura[13])){ |
|
|
|
//Crear modelo de contenedor y asignar los datos en la factura actual |
|
|
|
//Crear modelo de contenedor y asignar los datos en la factura actual |
|
|
|
CorresponsalesContenedores nuevoContenedor = new CorresponsalesContenedores(){ |
|
|
|
CorresponsalesContenedores nuevoContenedor = new CorresponsalesContenedores(){ |
|
|
|
id = 0, |
|
|
|
id = 0, |
|
|
@ -204,7 +208,7 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias |
|
|
|
IdContenedor = contenedorGuardado.id |
|
|
|
IdContenedor = contenedorGuardado.id |
|
|
|
}; |
|
|
|
}; |
|
|
|
await _facturasRepository.Append(nuevaFactura); |
|
|
|
await _facturasRepository.Append(nuevaFactura); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new OkObjectResult(new {trafico, facturas = await _facturasRepository.GetAll(idTrafico), contenedores = await _contenedoresRepository.GetAll(idTrafico)}); |
|
|
|
return new OkObjectResult(new {trafico, facturas = await _facturasRepository.GetAll(idTrafico), contenedores = await _contenedoresRepository.GetAll(idTrafico)}); |
|
|
|
}catch(Exception ex){ |
|
|
|
}catch(Exception ex){ |
|
|
|