Commit inicial: ITCA_API_SAP_WMS (.NET Core 3.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2b82744eb8
168 files changed
+11066
No files matched your search
@@ -0,0 +1,118 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Net.Business.Entities;
|
||||
using Net.Business.Entities.ServicesLayer;
|
||||
using Net.Business.Entities.ServicesLayer.Invoices;
|
||||
using Net.Connection;
|
||||
using Net.Connection.ServiceLayer;
|
||||
using Net.Constantes;
|
||||
using Net.CrossCotting;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Net.Data.ServicesLayer
|
||||
{
|
||||
public class InvoiceRepository : IInvoiceRepository
|
||||
{
|
||||
#region Variables Globales
|
||||
private string _aplicacionName;
|
||||
private string _metodoName;
|
||||
private readonly Regex regex = new Regex(@"<(\w+)>.*");
|
||||
|
||||
//Services Layer
|
||||
private readonly ConnectionServiceLayer _connectServiceLayer;
|
||||
private readonly IConnectionSQL _context;
|
||||
private readonly IHttpClientFactory _clientFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
#endregion
|
||||
|
||||
|
||||
public InvoiceRepository(IHttpClientFactory clientFactory, IConfiguration configuration, IConnectionSQL context)
|
||||
{
|
||||
_aplicacionName = this.GetType().Name;
|
||||
|
||||
//Inicializamos los servicios de services layer
|
||||
_connectServiceLayer = new ConnectionServiceLayer(configuration, clientFactory);
|
||||
_context = context;
|
||||
_clientFactory = clientFactory;
|
||||
_configuration = configuration;
|
||||
|
||||
}
|
||||
|
||||
// VENTAS PARA SAP
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> SetCreateInvoices(BE_Invoices entidad)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
|
||||
try
|
||||
{
|
||||
var cadena = "Invoices";
|
||||
var dataResponseInvoice = await _connectServiceLayer.PostAsync<BE_BaseResponseSap>(cadena, entidad);
|
||||
|
||||
if (!dataResponseInvoice.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, dataResponseInvoice.Mensaje);
|
||||
}
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se registró correctamento...!!!", dataResponseInvoice);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// GET INVOICES
|
||||
public async Task<BE_ResultadoTransaccion<BE_InvoicesConsulta>> GetInvoice(int docEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_InvoicesConsulta> resultadoTransaccion = new ResultadoTransaccion<BE_InvoicesConsulta>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"Invoices({docEntry})";
|
||||
int maxpagesize = 0;
|
||||
List<BE_InvoicesConsulta> objectList = await _connectServiceLayer.GetAsync<BE_InvoicesConsulta>(cadena, maxpagesize,true);
|
||||
|
||||
return resultadoTransaccion.GetInformacionResultado(0, 0, "Se Listo correctamento...!!!", objectList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BE_ResultadoTransaccion<BE_BaseResponseSap>> ReOpen(int docEntry)
|
||||
{
|
||||
_metodoName = regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name).Groups[1].Value.ToString();
|
||||
|
||||
ResultadoTransaccion<BE_BaseResponseSap> resultadoTransaccion = new ResultadoTransaccion<BE_BaseResponseSap>(_metodoName, _aplicacionName);
|
||||
try
|
||||
{
|
||||
|
||||
string cadena = $"Invoices({docEntry})/Reopen";
|
||||
var dataResponseInvoice = await _connectServiceLayer.PostReOpen<BE_BaseResponseSap>(cadena);
|
||||
|
||||
if (!dataResponseInvoice.Exito)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, dataResponseInvoice.Mensaje);
|
||||
}
|
||||
return resultadoTransaccion.GetInformacionResultado(0, "", "Se registró correctamento...!!!", dataResponseInvoice);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return resultadoTransaccion.GetInformacionResultado(-1, -1, ex.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user