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:
GeorgeandClaude Sonnet 5.5 committed 2026-10-05 17:53:41 -05:00
commit 2b82744eb8
168 files changed
+11066

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
# Build
bin/
obj/
publish/
*.user
*.suo
# IDE
.vs/
.vscode/
.idea/
# OS
.DS_Store
# Logs
*.log
# Configuración con credenciales (usar appsettings.example.json como plantilla)
appsettings.json
appsettings.*.json
!appsettings.example.json
+100
View File
@@ -0,0 +1,100 @@
# ITCA_API_SAP_WMS (.NET) — proyecto principal
API de integración WMS ↔ SAP Business One, **ASP.NET Core 3.1**. Para
build/publish/despliegue en IIS ver [`README.md`](./README.md).
Esta carpeta (`backend_octubre`) es **el proyecto vigente**. Antes existía
una copia paralela, `ITCA_API_SAP_WMS`, con la funcionalidad nueva portada
desde la reescritura Python; se portó aquí y esa copia quedó **archivada en un
comprimido (versión antigua)**. No hay `git` en esta carpeta.
## Qué se portó desde `ITCA_API_SAP_WMS` (2026-10-05)
Detalle técnico en `docs/PORTE_FUNCIONALIDAD_NUEVA.md`,
`docs/SOLICITUD_TRANSFERENCIA.md` y `docs/PICKING.md`.
1. **SolicitudTransferencia**: `PATCH /api/SolicitudTransferencia/{docEntry}` y
`POST /api/SolicitudTransferencia/{docEntry}/cerrar`.
2. **Picking diurno/nocturno**: campo `Notificacion` (early-return en
`PickingRepository.Create` tras `HelperProcesoPiciking.Set`) y
`POST /api/Picking/HojaRuta/{docEntry}/Cerrar`.
3. **`ConnectionServiceLayer`**: `PatchNoContentAsync` y `PostActionAsync`
(métodos nuevos; los existentes no se tocaron).
## Cambios de configuración y correcciones hechas en esta carpeta
- **Credenciales y esquema HANA en `appsettings.json`**, sección `Hana`
(`server`, `user`, `password`, `schema` opcional), leída por
`LocalData.Configure` desde `Startup`. Antes estaban fijas en el código
(`LocalData.cs`, `Log/B_Log.cs`). El esquema sale de `Hana:schema` o, si no
está, de `SapServiceLayer:company`; **si falta la sección `Hana` o el
esquema, la app no arranca** (error claro). Ya no hay `DB_NAME` fijo.
- **Precio promedio solo en entradas** (`TipoMovimiento "01"`) en
`InventarioRepository.Create` (los dos chequeos: `SubAlmacen` y `Almacen`).
Si el artículo no tiene stock, se conserva el `PrecioPromedio` del request en
vez de abortar con *"No existe stock disponible para el articulo X"* (ese
error bloqueaba ingresos de artículos sin stock previo). En salidas ya no se
busca el promedio: `PriceAfterVAT` lleva el precio del request. El chequeo de
stock de la rama de **salida** de `PickingRepository` (~línea 363) no se tocó.
- **Lote de 100 líneas** (`InventarioRepository.Create`): `var Inventario =
entidad` reutilizaba el mismo objeto, y con más de 100 líneas se generaban N
documentos iguales con el último bloque. Ahora se crea una copia por bloque y
la rama de salida lee `entidad_inventario.Detalle`.
- **SQL injection**: parametrizadas las consultas de `HelperProcesoPiciking`,
`HelperStock`, `HelperInventario`, `HelperInvoice`, `HelperCorrelativo`,
`HelperHojaRuta` y `HelperProcesoPermitido` (`?` + `HanaParameter`).
El esquema sigue interpolado (viene de configuración, no del request).
- `ITCA_API_SAP_WMS.xml` ahora se genera también en Release (sin eso Swagger
revienta con `FileNotFoundException` en un `publish -c Release`).
## Funcionalidad propia de esta carpeta (no existe en la copia antigua)
Hoja de Ruta (`HojaRutaController`, `HRRepository`, `GlobalDataRepository`),
reapertura de facturas (`InvoiceRepository.ReOpen`, `PostReOpen`), notas de
crédito con documentos de referencia, cierre automático de la solicitud de
traslado en `Transferencia` (`PostClose`), `Latitud`/`Longitud` y reproceso en
Picking, columna `HORA` en `B_Log`. Lo que **no** se trajo: `Chatbots` y
`MessageController` (solo existen en la copia archivada).
## Sin verificar
- **Nada se probó contra SAP/HANA reales.** Solo se verificó que compila
(0 errores) y que el publish se genera.
- La sintaxis `CALL "esquema"."proc"(?, ?)` con parámetros no está probada con
el driver HANA 2.1; si falla con un error de parámetro, mirar primero ahí.
- Para probar el lote de 100: un inventario de >100 líneas (p. ej. 250) debe
generar 3 documentos (100/100/50) sin repetir ni perder líneas, tanto en
entradas como en salidas.
## Bugs conocidos, sin corregir
- `BE_ResultadoTransaccion<T>.NombreEstacion`: setter con recursión infinita
(bomba de tiempo; hoy nada lo asigna).
- `ConnectionServiceLayer.PatchAsyncSBA<T>`: con un `204` real devuelve `null`
sin marcar éxito. `Login()`/`LoginPost()` duplicados; `throw` inalcanzable
tras `return` en varios `catch`.
- `ValidarCertificado` acepta cualquier certificado TLS (siempre `true`).
- `HelperDB.SET(string query)` ejecuta SQL arbitrario; hoy sin llamadores
(candidato a borrar).
- `appsettings.json` versionado en texto plano con credenciales reales
(SAP Service Layer, **HANA `B1ADMIN`**, semilla JWT). Rotar la contraseña de
`B1ADMIN` (estuvo en el código fuente) y evaluar un usuario HANA de mínimos
permisos.
## Despliegue
Sitio IIS previsto: **`/integracion`** (antes `/integracion_wms`). Publicar con
el comando del README **sin pisar** el `appsettings.json` del servidor; agregar
a ese archivo la sección `Hana` y revisar `SapServiceLayer:company` (determina
contra qué base lee y escribe). El `web.config` generado por `dotnet publish`
usa `processPath=".\ITCA_API_SAP_WMS.exe"`; el del código fuente apunta a
`bin\Debug\...` (solo para sitios que corren desde el código compilado).
## Pendiente
- Probar en QA: endpoints nuevos (SolicitudTransferencia, `Notificacion`,
`HojaRuta/Cerrar`), un ingreso sin stock previo, el lote de 100 y las
consultas parametrizadas.
- Verificar que existan en el esquema del sitio los procedimientos `ITCA_*`
y las tablas `@ITCA_PROWMS`, `@SYP_MOTIVOS`, `@SYP_NUMDOC`.
- Decidir si se corrigen los bugs de la lista de arriba.
+73
View File
@@ -0,0 +1,73 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33829.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Business.DTO", "Net.Business.DTO\Net.Business.DTO.csproj", "{22BCC127-93B5-40DE-9678-A172AA8F542C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Business.Entities", "Net.Business.Entities\Net.Business.Entities.csproj", "{5B11F494-0091-4A4C-930A-90012AD4F695}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Connection", "Net.Connection\Net.Connection.csproj", "{F63F6FF0-BD00-4A28-84E7-ACA7CA40AC10}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Connection.Attributes", "Net.Connection.Attributes\Net.Connection.Attributes.csproj", "{540EEA77-9B44-4796-89EF-0ADDE3EE3825}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.CrossCotting", "Net.CrossCotting\Net.CrossCotting.csproj", "{CACDBD23-52C9-4533-B231-A7A59D0EDAF8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Data", "Net.Data\Net.Data.csproj", "{DC9B3CEE-7AF1-4421-8058-4D0244DD1CF5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Business.Services", "Net.Business.Services\Net.Business.Services.csproj", "{B4BE6148-6E1F-4BB9-B399-424C4E6BF4C0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Constantes", "Net.Constantes\Net.Constantes.csproj", "{05A306D4-ADBB-4205-A589-D692D1ACB954}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net.Connection.ServiceLayer", "Net.Connection.ServiceLayer\Net.Connection.ServiceLayer.csproj", "{21B28EDA-ED40-4886-B11F-37C5794A6E33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22BCC127-93B5-40DE-9678-A172AA8F542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22BCC127-93B5-40DE-9678-A172AA8F542C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22BCC127-93B5-40DE-9678-A172AA8F542C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22BCC127-93B5-40DE-9678-A172AA8F542C}.Release|Any CPU.Build.0 = Release|Any CPU
{5B11F494-0091-4A4C-930A-90012AD4F695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B11F494-0091-4A4C-930A-90012AD4F695}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B11F494-0091-4A4C-930A-90012AD4F695}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B11F494-0091-4A4C-930A-90012AD4F695}.Release|Any CPU.Build.0 = Release|Any CPU
{F63F6FF0-BD00-4A28-84E7-ACA7CA40AC10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F63F6FF0-BD00-4A28-84E7-ACA7CA40AC10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F63F6FF0-BD00-4A28-84E7-ACA7CA40AC10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F63F6FF0-BD00-4A28-84E7-ACA7CA40AC10}.Release|Any CPU.Build.0 = Release|Any CPU
{540EEA77-9B44-4796-89EF-0ADDE3EE3825}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{540EEA77-9B44-4796-89EF-0ADDE3EE3825}.Debug|Any CPU.Build.0 = Debug|Any CPU
{540EEA77-9B44-4796-89EF-0ADDE3EE3825}.Release|Any CPU.ActiveCfg = Release|Any CPU
{540EEA77-9B44-4796-89EF-0ADDE3EE3825}.Release|Any CPU.Build.0 = Release|Any CPU
{CACDBD23-52C9-4533-B231-A7A59D0EDAF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CACDBD23-52C9-4533-B231-A7A59D0EDAF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CACDBD23-52C9-4533-B231-A7A59D0EDAF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CACDBD23-52C9-4533-B231-A7A59D0EDAF8}.Release|Any CPU.Build.0 = Release|Any CPU
{DC9B3CEE-7AF1-4421-8058-4D0244DD1CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC9B3CEE-7AF1-4421-8058-4D0244DD1CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC9B3CEE-7AF1-4421-8058-4D0244DD1CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC9B3CEE-7AF1-4421-8058-4D0244DD1CF5}.Release|Any CPU.Build.0 = Release|Any CPU
{B4BE6148-6E1F-4BB9-B399-424C4E6BF4C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4BE6148-6E1F-4BB9-B399-424C4E6BF4C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4BE6148-6E1F-4BB9-B399-424C4E6BF4C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4BE6148-6E1F-4BB9-B399-424C4E6BF4C0}.Release|Any CPU.Build.0 = Release|Any CPU
{05A306D4-ADBB-4205-A589-D692D1ACB954}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05A306D4-ADBB-4205-A589-D692D1ACB954}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05A306D4-ADBB-4205-A589-D692D1ACB954}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05A306D4-ADBB-4205-A589-D692D1ACB954}.Release|Any CPU.Build.0 = Release|Any CPU
{21B28EDA-ED40-4886-B11F-37C5794A6E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21B28EDA-ED40-4886-B11F-37C5794A6E33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21B28EDA-ED40-4886-B11F-37C5794A6E33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21B28EDA-ED40-4886-B11F-37C5794A6E33}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {139784B0-0533-40EC-8A32-A4E3E7CA0A89}
EndGlobalSection
EndGlobal
@@ -0,0 +1,22 @@
using Net.Business.Entities.Authenticate;
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.DTO.Authenticate
{
public class Dto_AuthenticateRequest
{
public string client_id { get; set; }
public string client_secret { get; set; }
public BE_AuthenticateRequest RetornaModelo()
{
return new BE_AuthenticateRequest()
{
client_id = client_id,
client_secret = client_secret,
};
}
}
}
+16
View File
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Net.Business.Entities\Net.Business.Entities.csproj" />
<ProjectReference Include="..\Net.CrossCotting\Net.CrossCotting.csproj" />
</ItemGroup>
</Project>
@@ -0,0 +1,29 @@
using Net.Business.Entities.WMS.HojaRuta;
namespace Net.Business.DTO.WMS.HojaRuta
{
public class Dto_HojaRuta
{
public int DocEntry { get; set; }
public string CodEstado { get; set; }
public string Estado { get; set; }
public string Proceso { get; set; }
public int IdEstadoCubico { get; set; }
public string HoraInicio { get; set; }
public string FinRuta { get; set; }
public string CodMotivo { get; set; }
public BE_HojaRutaEntities RetornaModelo()
{
return new BE_HojaRutaEntities()
{
DocEntry = DocEntry,
IdEstadoCubico = IdEstadoCubico,
Estado = Estado,
Proceso = Proceso,
CodMotivo = CodMotivo,
FinRuta = FinRuta,
HoraInicio = HoraInicio
};
}
}
}
@@ -0,0 +1,40 @@
using iTextSharp.text;
using Net.Business.Entities.ServicesLayer.HR;
using System;
using System.Collections.Generic;
namespace Net.Business.DTO.WMS.HojaRuta
{
public class Dto_HojaRutaCreate
{
public string ModalidadTransporte { get; set; }
public string Zona { get; set; }
public string Territorio { get; set; }
public string Despachador { get; set; }
public DateTime FechaDespacho { get; set; }
public string AgenciaTransporte { get; set; }
public string NombreConductor { get; set; }
public string LicenciaConductor { get; set; }
public string PlacaVehiculo { get; set; }
public string Estado { get; set; }
public List<BE_HojaRutaCreateDetalle> Detalle { get; set; }
public BE_HojaRutaCreate RetornaModelo()
{
return new BE_HojaRutaCreate()
{
AgenciaTransporte = AgenciaTransporte,
Despachador = Despachador,
Detalle = Detalle,
Estado = Estado,
FechaDespacho = FechaDespacho,
LicenciaConductor = LicenciaConductor,
ModalidadTransporte = ModalidadTransporte,
NombreConductor = NombreConductor,
PlacaVehiculo = PlacaVehiculo,
Territorio = Territorio,
Zona = Zona
};
}
}
}
@@ -0,0 +1,35 @@
using Net.Business.Entities.WMS.Inventario;
using System;
using System.Collections.Generic;
namespace Net.Business.DTO.WMS.Inventario
{
public class Dto_Inventario
{
public DateTime Fecha { get; set; }
public DateTime FechaVencimiento { get; set; }
public string TipoMovimientoSAP { get; set; }
public string TipoMovimiento { get; set; }
public string TipoInventario { get; set; }
public string Almacen { get; set; }
public string SubAlmacen { get; set; }
public List<BE_InventarioItems> Detalle { get; set; }
public string NroInventario { get; set; }
public BE_Inventario RetornaModelo()
{
return new BE_Inventario()
{
Almacen = Almacen,
Detalle = Detalle,
Fecha = Fecha,
FechaVencimiento = FechaVencimiento,
SubAlmacen = SubAlmacen,
TipoMovimiento = TipoMovimiento,
NroInventario = NroInventario,
TipoInventario = TipoInventario,
TipoMovimientoSAP = TipoMovimientoSAP,
};
}
}
}
@@ -0,0 +1,60 @@
using Net.Business.Entities.WMS.Picking;
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.DTO.WMS.Picking
{
public class Dto_PickingRequest
{
public string NumOrden { get; set; }
public DateTime FechaOrden { get; set; }
public string FechaEntrega { get; set; }
public string CodigoAlmacen { get; set; }
public DateTime FechaLlegada { get; set; }
public string CodigoERPCliente { get; set; }
public string CodigoERPDireccion { get; set; }
public int IdTipo { get; set; }
public int IdTipoDoc { get; set; }
public string Observacion { get; set; }
public int IdCondicion { get; set; }
public int Accion { get; set; }
public int IdEstadoCubico { get; set; }
public int DocEntry { get; set; }
public string Proceso { get; set; }
public string CodMotivo { get; set; }
// "preliminar" | "cierre" - cualquier otro valor o ausente se trata como
// "preliminar" (default seguro, nunca crea documentos en SAP por accidente).
public string Notificacion { get; set; }
public List<BE_PickingDetalle> Detalle { get; set; }
public decimal Longitud { get; set; }
public decimal Latitud { get; set; }
public BE_PickingRequest RetornaModelo()
{
return new BE_PickingRequest()
{
Accion = Accion,
CodigoAlmacen = CodigoAlmacen,
CodigoERPCliente = CodigoERPCliente,
IdEstadoCubico = IdEstadoCubico,
CodigoERPDireccion = CodigoERPDireccion,
Detalle = Detalle,
FechaEntrega = FechaEntrega,
FechaLlegada = FechaLlegada,
FechaOrden = FechaOrden,
IdCondicion = IdCondicion,
IdTipo = IdTipo,
IdTipoDoc = IdTipoDoc,
NumOrden = NumOrden,
Observacion = Observacion,
DocEntry = DocEntry,
Proceso = Proceso,
CodMotivo = CodMotivo,
Notificacion = Notificacion,
Latitud = Latitud,
Longitud = Longitud,
};
}
}
}
@@ -0,0 +1,51 @@
using Net.Business.Entities.WMS.Recibo;
using System;
using System.Collections.Generic;
namespace Net.Business.DTO.WMS.Recibo
{
public class Dto_ReciboRequest
{
public string NumOrden { get; set; }
public DateTime FechaOrden { get; set; }
public string CodigoAlmacen { get; set; }
public DateTime FechaLlegada { get; set; }
public string CodigoERPProveedor { get; set; }
public int IdTipo { get; set; }
public int IdTipoDoc { get; set; }
public string Observacion { get; set; }
public int IdCuenta { get; set; }
public int Accion { get; set; }
public int DocEntry { get; set; }
public string DocImportacion { get; set; }
public string U_SYP_MDTD { get; set; }
public string U_SYP_MDSD { get; set; }
public string U_SYP_MDCD { get; set; }
public string Comentario { get; set; }
public List<BE_ReciboDetalle> Detalle { get; set; }
public BE_ReciboRequest RetornaModelo()
{
return new BE_ReciboRequest()
{
Accion = Accion,
CodigoAlmacen = CodigoAlmacen,
CodigoERPProveedor = CodigoERPProveedor,
Detalle = Detalle,
FechaLlegada = FechaLlegada,
FechaOrden = FechaOrden,
IdTipo = IdTipo,
IdTipoDoc = IdTipoDoc,
Observacion = Observacion,
IdCuenta = IdCuenta,
NumOrden = NumOrden,
DocEntry = DocEntry,
DocImportacion = DocImportacion,
Comentario = Comentario,
U_SYP_MDSD = U_SYP_MDSD,
U_SYP_MDCD = U_SYP_MDCD,
U_SYP_MDTD = U_SYP_MDTD
};
}
}
}
@@ -0,0 +1,31 @@
using Net.Business.Entities.WMS.SolicitudTransferencia;
using System.Collections.Generic;
using System.Linq;
namespace Net.Business.DTO.WMS.SolicitudTransferencia
{
public class Dto_SolicitudTransferenciaPatchDetalle
{
public int Linea { get; set; }
public double Cantidad { get; set; }
}
public class Dto_SolicitudTransferenciaPatchRequest
{
public string NumOrden { get; set; }
public List<Dto_SolicitudTransferenciaPatchDetalle> Detalle { get; set; }
public BE_SolicitudTransferenciaPatchRequest RetornaModelo()
{
return new BE_SolicitudTransferenciaPatchRequest()
{
NumOrden = NumOrden,
Detalle = Detalle?.Select(d => new BE_SolicitudTransferenciaPatchDetalle
{
Linea = d.Linea,
Cantidad = d.Cantidad,
}).ToList(),
};
}
}
}
@@ -0,0 +1,48 @@
using Net.Business.Entities.WMS.Transferencia;
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.DTO.WMS.Transferencia
{
public class Dto_TransferenciaRequest
{
public string NumOrden { get; set; }
public DateTime FechaOrden { get; set; }
public int IdTipo { get; set; }
public string CodigoAlmacenOrigen { get; set; }
public string CodigoSubAlmacenOrigen { get; set; }
public int IdCondicionOrigen { get; set; }
public string CodigoAlmacenDestino { get; set; }
public string CodigoSubAlmacenDestino { get; set; }
public int IdCondicionDestino { get; set; }
public string Observacion { get; set; }
public int IdCuenta { get; set; }
public int Accion { get; set; }
public int DocEntry { get; set; }
public int DocEntryEM { get; set; }
public List<BE_TransferenciaDetalle> Detalle { get; set; }
public BE_TransferenciaRequest RetornaModelo()
{
return new BE_TransferenciaRequest()
{
Accion = Accion,
TransferenciaDetalles = Detalle,
CodigoAlmacenDestino = CodigoAlmacenDestino,
CodigoAlmacenOrigen = CodigoAlmacenOrigen,
CodigoSubAlmacenDestino = CodigoSubAlmacenDestino,
CodigoSubAlmacenOrigen = CodigoSubAlmacenOrigen,
FechaOrden = FechaOrden,
IdCondicionDestino = IdCondicionDestino,
IdCondicionOrigen = IdCondicionOrigen,
IdCuenta = IdCuenta,
IdTipo = IdTipo,
NumOrden = NumOrden,
Observacion = Observacion,
DocEntry = DocEntry,
DocEntryEM = DocEntryEM
};
}
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.Authenticate
{
public class BE_AuthenticateRequest
{
public string client_id { get; set; }
public string client_secret { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.Authenticate
{
public class BE_AuthenticateResponse
{
public string Token { get; set; }
public string Type { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.Authenticate
{
public class ModelCredential
{
public string client_id { get; set; }
public string client_secret { get; set; }
}
}
@@ -0,0 +1,11 @@
namespace Net.Business.Entities
{
public class BE_EmailSenderOptions
{
public int Port { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public bool EnableSsl { get; set; }
public string Host { get; set; }
}
}
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Net.Connection.Attributes\Net.Connection.Attributes.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Email\" />
</ItemGroup>
</Project>
@@ -0,0 +1,45 @@
using System.Collections.Generic;
namespace Net.Business.Entities
{
public class BE_ResultadoTransaccion<T>
{
/// <summary>
/// ID de un nuevo registro o Id de registro actualizar
/// </summary>
public int? DocEntry { get; set; }
public string DocNum { get; set; }
/// <summary>
/// Resultado de Codigo, Obtenido de la Base de Datos
/// 0 => Correcto
/// -1 => Error
/// </summary>
public int StatusCode { get; set; }
/// <summary>
/// Descripcion de la acción al finalizar el metodo invocado
/// </summary>
public string Message { get; set; }
public string Error { get; set; }
/// <summary>
/// Nombre de la Aplicación
/// </summary>
public string AppName { get; set; }
/// <summary>
/// Nombre del Método
/// </summary>
public string MethodName { get; set; }
/// <summary>
/// Lista del Resultado al finalizar el método invocado
/// </summary>
public IEnumerable<T> ListData { get; set; }
/// <summary>
/// Data Resultado al finalizar el método invocado
/// </summary>
public T Data { get; set; }
/// <summary>
/// Nombre de la estación de trabajo
/// </summary>
public string NombreEstacion { get => System.Environment.MachineName; set => NombreEstacion = System.Environment.MachineName; }
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer
{
public class BE_BaseResponseSap
{
public decimal DocTotal { get; set; }
public decimal DocTotalSys { get; set; }
public long? TransNum { get; set; }
public long? DocEntry { get; set; }
public long? AbsoluteEntry { get; set; }
public long TransId { get; set; }
public long Number { get; set; }
public long Original { get; set; }
public long DocNum { get; set; }
public bool Exito { get; set; }
public string Mensaje { get; set; }
public string CodigoHttp { get; set; }
public string U_BPP_MDCD { get; set; }
public string Currency { get; set; }
public string DocumentStatus { get; set; }
}
}
@@ -0,0 +1,115 @@
using Net.Connection.Attributes;
using System.Data;
namespace Net.Business.Entities.ServicesLayer
{
public class BE_BusinessPartners
{
[DBParameter(SqlDbType.VarChar, 15, ActionType.Everything)]
public string CardCode { get; set; }
[DBParameter(SqlDbType.VarChar, 100, ActionType.Everything)]
public string CardType { get; set; }
[DBParameter(SqlDbType.VarChar, 100, ActionType.Everything)]
public string CardName { get; set; }
[DBParameter(SqlDbType.VarChar, 32, ActionType.Everything)]
public string FederalTaxID { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string Address { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string MailAddress { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string EmailAddress { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string Phone1 { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string U_BPP_BPTD { get; set; }
public string EstadoSocio { get; set; }
public string TablaEstadoSocioNegocio { get; set; }
public string EstadoSocioStyle { get; set; }
}
public class BE_BusinessPartnersCustomersUpdate
{
[DBParameter(SqlDbType.VarChar, 15, ActionType.Everything)]
public string CardCode { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string Address { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string MailAddress { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string EmailAddress { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string Phone1 { get; set; }
public int PriceListNum { get; set; }
}
public class BE_BusinessPartnersCustomers
{
[DBParameter(SqlDbType.VarChar, 15, ActionType.Everything)]
public string CardCode { get; set; }
[DBParameter(SqlDbType.VarChar, 100, ActionType.Everything)]
public string CardType { get; set; }
[DBParameter(SqlDbType.VarChar, 100, ActionType.Everything)]
public string CardName { get; set; }
[DBParameter(SqlDbType.VarChar, 32, ActionType.Everything)]
public string FederalTaxID { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string Address { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string MailAddress { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string EmailAddress { get; set; }
[DBParameter(SqlDbType.VarChar, 250, ActionType.Everything)]
public string Phone1 { get; set; }
[DBParameter(SqlDbType.Int, 0, ActionType.Everything)]
public int U_BPP_BPTD { get; set; }
public int PriceListNum { get; set; }
//U_BPP_BPTD = 6,
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.CreditNotes
{
public class BE_CreditNotesBatchNumbers
{
public string BatchNumber { get; set; }
public double Quantity { get; set; }
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.CreditNotes
{
public class BE_CreditNotesDocumentReferences
{
public int RefDocEntr { get; set; }
public string RefObjType { get; set; }
public DateTime IssueDate { get; set; }
public string Remark { get; set; }
}
}
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.CreditNotes
{
public class BE_CreditNotesLine
{
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public decimal Quantity { get; set; }
public decimal PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public int? BaseType { get; set; }
public int? BaseEntry { get; set; }
public int? BaseLine { get; set; }
public int LineNum { get; set; }
public string U_ITC_ALMDES { get; set; }
public List<BE_CreditNotesBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.CreditNotes
{
public class BE_CreditNotesNotes
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public string NumAtCard { get; set; }
public string U_SYP_MDSD { get; set; }
public string U_SYP_MDCD { get; set; }
public string U_SYP_MDTD { get; set; }
public string U_SYP_MDSO { get; set; }
public string U_SYP_MDCO { get; set; }
public string U_SYP_MDTO { get; set; }
public string U_SYP_FECHAREF { get; set; }
public string U_SYP_TPONC { get; set; }
public string U_SYP_MOTNC { get; set; }
public string U_SYP_FEESUNAT { get; set; } = "000";
public string U_SYP_FEEST { get; set; } = "PE";
public string U_SYP_FEMEX { get; set; } = "1";
public List<BE_CreditNotesLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,17 @@
using Net.Connection.Attributes;
using System.Data;
namespace Net.Business.Entities.ServicesLayer
{
public class FE_BusinessPartners
{
[DBParameter(SqlDbType.VarChar, 30, ActionType.Everything)]
public string CardCode { get; set; }
[DBParameter(SqlDbType.VarChar, 100, ActionType.Everything)]
public string CardName { get; set; }
[DBParameter(SqlDbType.VarChar, 32, ActionType.Everything)]
public string FederalTaxID { get; set; }
[DBParameter(SqlDbType.VarChar, 20, ActionType.Everything)]
public string Usuario { get; set; }
}
}
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.HR
{
public class BE_HojaRutaCreate
{
public string ModalidadTransporte { get; set; }
public string Zona { get; set; }
public string Territorio { get; set; }
public string Despachador { get; set; }
public DateTime FechaDespacho { get; set; }
public string AgenciaTransporte { get; set; }
public string NombreConductor { get; set; }
public string LicenciaConductor { get; set; }
public string PlacaVehiculo { get; set; }
public string Estado { get; set; }
public List<BE_HojaRutaCreateDetalle> Detalle { get; set; }
}
public class HojaRutaSAP
{
//public int DocEntry { get; set; }
//public int DocNum { get; set; }
public int U_ARD_PHR_CNTDOC { get; set; }
public string U_ARD_PHR_PLACA { get; set; }
public string U_ARD_PHR_LICCON { get; set; }
public string U_ARD_PHR_NOMCON { get; set; }
public string U_ARD_PHR_MARVEH { get; set; }
public DateTime U_ARD_PHR_FECCRE { get; set; }
public string U_ARD_PHR_CERINS { get; set; }
public string U_ARD_PHR_PLATOL { get; set; }
public string U_ARD_PHR_NOMDESP { get; set; }
public string U_ARD_PHR_ESTDESP { get; set; }
public string U_ARD_PHR_OBSERVA { get; set; }
public string U_ARD_PHR_ZONDIS { get; set; }
public string U_ARD_PHR_TERRI { get; set; }
public string U_ARD_PHR_MODTRANSP { get; set; }
public string U_ARD_PHR_NOMAGENTRANS { get; set; }
public string U_ARD_PHR_CODAGENTRANS { get; set; }
public string U_ARD_PHR_RUCAGENTRANS { get; set; }
public double U_MSV_PKH_PESM { get; set; }
public string Object { get; set; } = "ARD_PHR";
public string U_MSV_PKH_ORIG { get; set; }
public List<HojaRutaDetailsEntities> ARD_PCK_HJRT_DETCollection { get; set; }
}
public class HojaRutaDetailsEntities
{
public int DocEntry { get; set; }
public int LineId { get; set; }
public int VisOrder { get; set; }
public string U_ARD_PHR_NROPED { get; set; }
public string U_ARD_PHR_NOMCLI { get; set; }
public string U_ARD_PHR_RUCCLI { get; set; }
public string U_ARD_PHR_DIRDESP { get; set; }
public string U_ARD_PHR_FORPAG { get; set; }
public string U_ARD_PHR_NROGRE { get; set; }
public string U_ARD_PHR_NROFACT { get; set; }
public string U_ARD_PHR_ZONA { get; set; }
public string U_ARD_PHR_TERRIT { get; set; }
public DateTime U_ARD_PHR_FEENPED { get; set; }
public string U_ARD_PHR_MONED { get; set; }
public decimal U_ARD_TOTALFC { get; set; }
public decimal U_ARD_PHR_TOTALPD { get; set; }
public string U_MSV_PKH_DORV { get; set; }
public string U_MSV_PKH_DGRE { get; set; }
public string U_MSV_PKH_DCPE { get; set; }
public int U_MSV_PKH_PEOV { get; set; }
public string U_ITC_PHR_NOMVEN { get; set; }
public string U_MSV_PKH_CGUI { get; set; }
public string U_ARD_PHR_ESTDESP { get; set; } = "Embarcado";
public string U_MSV_PKH_APLG { get; set; }
public string Object { get; set; } = "ARD_PHR";
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.HR
{
public class BE_HojaRutaCreateDetalle
{
public string NumeroFactura { get; set; }
public string CodigoInterno { get; set; }
}
}
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer
{
public class ITC_SOLINGMER
{
public string U_ITC_MDTI { get; set; }
public string U_ITC_MDWC { get; set; }
public string U_ITC_USRSOL { get; set; }
public string U_ITC_MDCM { get; set; }
public List<ITC_SOLINGMER_Details> ITC_SOLINGMERDETCollection { get; set; }
}
public class ITC_SOLINGMER_Details
{
public int LineId { get; set; }
public string U_ITC_CCOSTO { get; set; }
public string U_ITC_ACCCODE { get; set; }
public string U_ITC_ITEMNAME { get; set; }
}
}
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer
{
public class ITC_SOLSALMER
{
public string U_ITC_MDTS { get; set; }
public string U_ITC_USRSOL { get; set; }
public string U_ITC_MDCM { get; set; }
public List<ITC_SOLSALMER_Details> ITCA_SOLSALMERDETCollection { get; set; }
}
public class ITC_SOLSALMER_Details
{
public int LineId { get; set; }
public string U_ITC_CCOST { get; set; }
public string U_ITC_AccCode { get; set; }
public string U_ITC_ItemName { get; set; }
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.InventoryGenEntries
{
public class BE_InventoryGenEntries
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public double DocRate { get; set; }
public string U_SYP_TPOENTME { get; set; }
public string U_ITC_WMS_NUMINV { get; set; }
public string U_ARD_PERSOLIC { get; set; }
public string Comments { get; set; }
public List<BE_InventoryGenEntriesLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.InventoryGenEntries
{
public class BE_InventoryGenEntriesBatchNumbers
{
public string BatchNumber { get; set; }
public double Quantity { get; set; }
}
}
@@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.InventoryGenEntries
{
public class BE_InventoryGenEntriesLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public double Quantity { get; set; }
public double PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public double LineTotal { get; set; }
public string AccountCode { get; set; }
public string CostingCode { get; set; } = "";
public List<BE_InventoryGenEntriesBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.InventoryGenExits
{
public class BE_InventoryGenExits
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
//public string DocObjectCode2 { get; set; }
public double DocRate { get; set; }
public string U_SYP_TPOSALME { get; set; }
public string U_ITC_WMS_NUMINV { get; set; }
public string U_ARD_PERSOLIC { get; set; }
public string Comments { get; set; }
public List<BE_InventoryGenExitsLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.InventoryGenExits
{
public class BE_InventoryGenExitsBatchNumbers
{
public string BatchNumber { get; set; }
public double Quantity { get; set; }
}
}
@@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.InventoryGenExits
{
public class BE_InventoryGenExitsLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public double Quantity { get; set; }
public double PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public double LineTotal { get; set; }
public string AccountCode { get; set; }
public string CostingCode { get; set; } = "";
public List<BE_InventoryGenExitsBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,21 @@
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.InventoryTransferRequest
{
// Shape minimo del GET InventoryTransferRequests({docEntry}) de Service Layer -
// solo lo que SolicitudTransferenciaRepository.Update necesita leer (el Rate
// real de cada linea antes del PATCH). Los campos del JSON de SAP que no estan
// mapeados aca se ignoran al deserializar (comportamiento default de
// Newtonsoft.Json), no hace falta mapear el documento completo.
public class BE_InventoryTransferRequest
{
public int DocEntry { get; set; }
public List<BE_InventoryTransferRequestLine> StockTransferLines { get; set; }
}
public class BE_InventoryTransferRequestLine
{
public int LineNum { get; set; }
public double Rate { get; set; }
}
}
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.Invoices
{
public class BE_Invoices
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public int DocEntry { get; set; }
public string U_SYP_MDSD { get; set; }
public string U_SYP_MDCD { get; set; }
public string U_SYP_MDTD { get; set; }
public List<BE_InvoicesLine> DocumentLines { get; set; }
}
public class BE_InvoicesConsulta
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public int DocEntry { get; set; }
public string DocumentStatus { get; set; }
public string U_SYP_MDSD { get; set; }
public string U_SYP_MDCD { get; set; }
public string U_SYP_MDTD { get; set; }
public List<BE_InvoicesLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.Invoices
{
public class BE_InvoicesBatchNumbers
{
public string BatchNumber { get; set; }
public double Quantity { get; set; }
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.Invoices
{
public class BE_InvoicesLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public decimal Quantity { get; set; }
public decimal PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public int? BaseLine { get; set; }
public List<BE_InvoicesBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,17 @@
using System;
namespace Net.Business.Entities.ServicesLayer.Items
{
public class BE_ItemStock
{
public string ItemCode { get; set; }
public string ItemName { get; set; }
public string WhsCode { get; set; }
public string WhsName { get; set; }
public string DistNumber { get; set; }
public DateTime ExpDate { get; set; }
public string BinCode { get; set; }
public double OnHandQty { get; set; }
public double AvgPrice { get; set; }
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.PurchaseDeliveryNotes
{
public class BE_PurchaseDeliveryNotes
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public string NumAtCard { get; set; }
public string U_SYP_MDTD { get; set; }
public string U_SYP_MDSD { get; set; }
public string U_SYP_MDCD { get; set; }
public List<BE_PurchaseDeliveryNotesLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseDeliveryNotes
{
public class BE_PurchaseDeliveryNotesBatchNumbers
{
public string BatchNumber { get; set; }
public double Quantity { get; set; }
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseDeliveryNotes
{
public class BE_PurchaseDeliveryNotesLine
{
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public double Quantity { get; set; }
public decimal PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public int? BaseType { get; set; }
public int? BaseEntry { get; set; }
public int? BaseLine { get; set; }
public int LineNum { get; set; }
public List<BE_PurchaseDeliveryNotesBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseInvoices
{
public class BE_PurchaseInvoices
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public int DocEntry { get; set; }
public List<BE_PurchaseInvoicesLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseInvoices
{
public class BE_PurchaseInvoicesBatchNumbers
{
public string BatchNumber { get; set; }
public string Quantity { get; set; }
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseInvoices
{
public class BE_PurchaseInvoicesLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public decimal Quantity { get; set; }
public decimal PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public List<BE_PurchaseInvoicesBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseOrders
{
public class BE_PurchaseOrders
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public int DocEntry { get; set; }
public List<BE_PurchaseOrdersLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseOrders
{
public class BE_PurchaseOrdersBatchNumbers
{
public string BatchNumber { get; set; }
public string Quantity { get; set; }
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.PurchaseOrders
{
public class BE_PurchaseOrdersLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public decimal Quantity { get; set; }
public decimal PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public List<BE_PurchaseOrdersBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.ReturnRequest
{
public class BE_ReturnRequest
{
public DateTime DocDate { get; set; }
public DateTime DocDueDate { get; set; }
public string CardCode { get; set; }
public string CardName { get; set; }
public string DocCurrency { get; set; }
public string PaymentGroupCode { get; set; }
public string DocObjectCode { get; set; }
public int DocEntry { get; set; }
public string U_SYP_TPONC { get; set; }
public string U_SYP_MOTNC { get; set; }
public string U_SYP_MDSO { get; set; }
public string U_SYP_MDCO { get; set; }
public string U_SYP_MDTO { get; set; }
public DateTime U_SYP_FECHAREF { get; set; }
public List<BE_ReturnRequestLine> DocumentLines { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.ReturnRequest
{
public class BE_ReturnRequestBatchNumbers
{
public string BatchNumber { get; set; }
public string Quantity { get; set; }
}
}
@@ -0,0 +1,21 @@
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.ReturnRequest
{
public class BE_ReturnRequestLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public decimal Quantity { get; set; }
public decimal PriceAfterVAT { get; set; }
public string WarehouseCode { get; set; }
public string Currency { get; set; }
public int? BaseEntry { get; set; }
public int? BaseLine { get; set; }
public int? BaseType { get; set; }
public string U_ITC_ALMDES { get;set; }
public List<BE_ReturnRequestBatchNumbers> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.StockTransfer
{
public class BE_StockTransfer
{
public DateTime DocDate { get; set; }
public DateTime DueDate { get; set; }
public string Comments { get; set; }
public string FromWarehouse { get; set; }
public string ToWarehouse { get; set; }
public DateTime TaxDate { get; set; }
public string U_SYP_MDTS { get; set; }
public string U_SYP_MDMT { get; set; }
public string U_ITC_WMS_NUMINV { get; set; }
public string U_SYP_TPOENTME { get; set; }
public List<BE_StockTransferLine> StockTransferLines { get; set; }
public List<BE_StockTransferDocumentReferences> DocumentReferences { get; set; }
}
public class BE_StockTransferAutomatico
{
public DateTime DocDate { get; set; }
public DateTime DueDate { get; set; }
public string Comments { get; set; }
public string FromWarehouse { get; set; }
public string ToWarehouse { get; set; }
public DateTime TaxDate { get; set; }
public string U_SYP_MDTS { get; set; }
public string U_SYP_MDMT { get; set; }
public string U_ITC_WMS_NUMINV { get; set; }
public string U_SYP_TPOENTME { get; set; }
public int PriceList { get; set; }
public List<BE_StockTransferLine> StockTransferLines { get; set; }
public List<BE_StockTransferDocumentReferences> DocumentReferences { get; set; }
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.StockTransfer
{
public class BE_StockTransferDocumentReferences
{
public int RefDocEntr { get; set; }
public string RefObjType { get; set; }
public string Remark { get; set; }
public DateTime IssueDate { get; set; } = DateTime.Now;
}
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
namespace Net.Business.Entities.ServicesLayer.StockTransfer
{
public class BE_StockTransferLine
{
public int LineNum { get; set; }
public string ItemCode { get; set; }
public string ItemDescription { get; set; }
public double Quantity { get; set; }
public string WarehouseCode { get; set; }
public string FromWarehouseCode { get; set; }
public int? BaseLine { get; set; }
public int? BaseEntry { get; set; }
public string BaseType { get; set; }
public List<BE_StockTransferLineBatchNumber> BatchNumbers { get; set; }
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.ServicesLayer.StockTransfer
{
public class BE_StockTransferLineBatchNumber
{
public string BatchNumber { get; set; }
public double Quantity { get; set; }
}
}
@@ -0,0 +1,13 @@
namespace Net.Business.Entities.WMS.HojaRuta
{
public class BE_HojaRutaEntities
{
public int DocEntry { get; set; }
public int IdEstadoCubico { get; set; }
public string Estado { get; set; }
public string Proceso { get; set; }
public string CodMotivo { get; set; }
public string HoraInicio { get; set; }
public string FinRuta { get; set; }
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace Net.Business.Entities.WMS.Inventario
{
public class BE_Inventario
{
public DateTime Fecha { get; set; }
public DateTime FechaVencimiento { get; set; }
public string TipoMovimientoSAP { get; set; }
public string TipoMovimiento { get; set; }
public string TipoInventario { get; set; }
public string Almacen { get; set; }
public string SubAlmacen { get; set; }
public string NroInventario { get; set; }
public List<BE_InventarioItems> Detalle { get; set; }
}
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace Net.Business.Entities.WMS.Inventario
{
public class BE_InventarioItems
{
public string CodigoArticulo { get; set; }
public string DescripcionArticulo { get; set; }
public decimal Cantidad { get; set; }
public string UnidadMedida { get; set; }
public double PrecioPromedio { get; set; }
public string CentroCosto { get; set; }
public List<BE_InventarioItemsLotes> Lotes { get; set; }
}
}
@@ -0,0 +1,11 @@
using System;
namespace Net.Business.Entities.WMS.Inventario
{
public class BE_InventarioItemsLotes
{
public string Lote { get; set; }
public DateTime FechaVencimiento { get; set; }
public decimal Cantidad { get; set; }
}
}
@@ -0,0 +1,14 @@
namespace Net.Business.Entities.WMS.Picking
{
public class BE_PickingDetalle
{
public int Item { get; set; }
public string CodigoArticulo { get; set; }
public string CodigoUM { get; set; }
public string LoteProducto { get; set; }
public decimal CantidadPedida { get; set; }
public string CodigoSubAlmacen { get; set; }
public string Estado { get; set; }
public double PrecioPromedio { get; set; }
}
}
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.WMS.Picking
{
public class BE_PickingRequest
{
public string NumOrden { get; set; }
public DateTime FechaOrden { get; set; }
public string FechaEntrega { get; set; }
public string CodigoAlmacen { get; set; }
public DateTime FechaLlegada { get; set; }
public string CodigoERPCliente { get; set; }
public string CodigoERPDireccion { get; set; }
public int IdTipo { get; set; }
public int IdTipoDoc { get; set; }
public string Observacion { get; set; }
public int IdCondicion { get; set; }
public int Accion { get; set; }
public int DocEntry { get; set; }
public int IdEstadoCubico { get; set; }
public string Proceso { get; set; }
public string CodMotivo { get; set; }
// "preliminar" | "cierre" - cualquier otro valor o ausente se trata como
// "preliminar" (default seguro, nunca crea documentos en SAP por accidente).
public string Notificacion { get; set; }
public decimal Longitud { get; set; }
public decimal Latitud { get; set; }
public List<BE_PickingDetalle> Detalle { get; set; }
}
}
@@ -0,0 +1,10 @@
namespace Net.Business.Entities.WMS.ProcesoPicking
{
public class BE_ProcesoPicking
{
public string Code { get; set; }
public string U_ITCA_PROCESO { get; set; }
public string U_ITCA_GNRPROC { get; set; }
public string U_ITCA_ESTADO { get; set; }
}
}
@@ -0,0 +1,11 @@
namespace Net.Business.Entities.WMS.Recibo
{
public class BE_ReciboDetalle
{
public int Item { get; set; }
public string CodigoArticulo { get; set; }
public string CodigoUM { get; set; }
public string LoteProducto { get; set; }
public decimal CantidadPedida { get; set; }
}
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.WMS.Recibo
{
public class BE_ReciboRequest
{
public string NumOrden { get; set; }
public DateTime FechaOrden { get; set; }
public string CodigoAlmacen { get; set; }
public DateTime FechaLlegada { get; set; }
public string CodigoERPProveedor { get; set; }
public int IdTipo { get; set; }
public int IdTipoDoc { get; set; }
public string Observacion { get; set; }
public int IdCuenta { get; set; }
public int DocEntry { get; set; }
public int Accion { get; set; }
public string DocImportacion { get; set; }
public string U_SYP_MDTD { get; set; }
public string U_SYP_MDSD { get; set; }
public string U_SYP_MDCD { get; set; }
public string Comentario { get; set; }
public List<BE_ReciboDetalle> Detalle { get; set; }
}
}
@@ -0,0 +1,22 @@
using System.Collections.Generic;
namespace Net.Business.Entities.WMS.SolicitudTransferencia
{
// Contrato propio del PATCH de SolicitudTransferencia - funcionalidad nueva, sin
// equivalente en el .NET original. El PATCH real SOLO actualiza cantidades de
// linea existentes en SAP (InventoryTransferRequests) y ELIMINA una linea
// cuando Cantidad = 0 - no toca fechas, almacenes ni ningun otro campo del
// documento, por eso no reusa BE_TransferenciaRequest.
public class BE_SolicitudTransferenciaPatchDetalle
{
public int Linea { get; set; }
public double Cantidad { get; set; }
}
public class BE_SolicitudTransferenciaPatchRequest
{
// No se usa para el PATCH a SAP - solo trazabilidad en el log de auditoria.
public string NumOrden { get; set; }
public List<BE_SolicitudTransferenciaPatchDetalle> Detalle { get; set; }
}
}
@@ -0,0 +1,12 @@
namespace Net.Business.Entities.WMS.Transferencia
{
public class BE_TransferenciaDetalle
{
public int Item { get; set; }
public string CodigoArticulo { get; set; }
public string CodigoUM { get; set; }
public string LoteProducto { get; set; }
public decimal CantidadPedida { get; set; }
public int Accion { get; set; }
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Net.Business.Entities.WMS.Transferencia
{
public class BE_TransferenciaRequest
{
public string NumOrden { get; set; }
public DateTime FechaOrden { get; set; }
public int IdTipo { get; set; }
public string CodigoAlmacenOrigen { get; set; }
public string CodigoSubAlmacenOrigen { get; set; }
public int IdCondicionOrigen { get; set; }
public string CodigoAlmacenDestino { get; set; }
public string CodigoSubAlmacenDestino { get; set; }
public int IdCondicionDestino { get; set; }
public string Observacion { get; set; }
public int IdCuenta { get; set; }
public int Accion { get; set; }
public int DocEntry { get; set; }
public int DocEntryEM { get; set; }
public List<BE_TransferenciaDetalle> TransferenciaDetalles { get; set; }
}
}
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "5.0.8",
"commands": [
"dotnet-ef"
]
}
}
}
@@ -0,0 +1,44 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO;
using Net.Business.DTO.Authenticate;
using Net.Data;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
public class AuthenticateController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public AuthenticateController(IRepositoryWrapper repository)
{
this._repository = repository;
}
/// <summary>
/// Obtiene Token de Acceso
/// </summary>
/// <param name="value">Parametros de filtros</param>
/// <returns>Devuelve Token de Acceso</returns>
[HttpPost]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> Token([FromBody] Dto_AuthenticateRequest value)
{
var objectGetAll = await _repository.Authenticate.GetToken(value.RetornaModelo());
if (objectGetAll.StatusCode == -1)
{
return BadRequest(objectGetAll);
}
return Ok(objectGetAll.Data);
}
}
}
@@ -0,0 +1,58 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO.WMS.HojaRuta;
using Net.Business.DTO.WMS.Picking;
using Net.Business.Services.Log;
using Net.Data;
using Newtonsoft.Json;
using System.Text;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class HojaRutaController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public HojaRutaController(IRepositoryWrapper repository)
{
this._repository = repository;
}
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> POST([FromBody] Dto_HojaRutaCreate value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Hoja Ruta", "", "", "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Hoja Ruta", "", "", "0", "0");
return BadRequest("Invalid model object");
}
var ObjectNew = await _repository.HR.SetCreateHojaRuta(value.RetornaModelo());
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", "", "", "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", "", "", ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
}
}
@@ -0,0 +1,58 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO.WMS.Inventario;
using Net.Business.Services.Log;
using Net.Data;
using Newtonsoft.Json;
using System.Text;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class InventarioController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public InventarioController(IRepositoryWrapper repository)
{
this._repository = repository;
}
/// <summary>
/// Registra Proceso de Inventario
/// </summary>
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Inventario([FromBody] Dto_Inventario value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Inventario", "0", "0", "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Inventario", "0", "0", "0", "0");
return BadRequest("Invalid model object");
}
var ObjectNew = await _repository.Inventario.Create(value.RetornaModelo());
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Inventario", "0", "0", "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Inventario", "0", "0", ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
}
}
@@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Data;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class ItemController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public ItemController(IRepositoryWrapper repository)
{
this._repository = repository;
}
[HttpGet]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Stock()
{
var ObjectNew = await _repository.Items.GetStockItem();
if (ObjectNew.StatusCode != 0)
{
return BadRequest(ObjectNew);
}
return Ok(ObjectNew);
}
}
}
@@ -0,0 +1,104 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO.WMS.HojaRuta;
using Net.Business.DTO.WMS.Picking;
using Net.Business.Services.Log;
using Net.Data;
using Newtonsoft.Json;
using System.Text;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class PickingController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public PickingController(IRepositoryWrapper repository)
{
this._repository = repository;
}
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> POST([FromBody] Dto_PickingRequest value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Picking", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Picking", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest("Invalid model object");
}
var ObjectNew = await _repository.Picking.Create(value.RetornaModelo());
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Picking", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Picking", value.NumOrden, value.DocEntry.ToString(), ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
[HttpPost]
[Route("[action]")]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Ruta([FromBody] Dto_HojaRuta value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Hoja Ruta", value.DocEntry.ToString(), value.DocEntry.ToString(), "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Hoja Ruta", value.DocEntry.ToString(), value.DocEntry.ToString(), "0", "0");
return BadRequest("Invalid model object");
}
var ObjectNew = await _repository.Picking.CreateHojaRuta(value.RetornaModelo());
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", value.DocEntry.ToString(), value.DocEntry.ToString(), "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", value.DocEntry.ToString(), value.DocEntry.ToString(), ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
[HttpPost]
[Route("HojaRuta/{docEntry}/Cerrar")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> CerrarHojaRuta(int docEntry)
{
var ObjectNew = await _repository.Picking.CerrarHojaRuta(docEntry);
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { docEntry })), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", docEntry.ToString(), docEntry.ToString(), "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { docEntry })), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Hoja Ruta", docEntry.ToString(), docEntry.ToString(), ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
}
}
@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO.WMS.Recibo;
using Net.Business.Services.Log;
using Net.Data;
using Newtonsoft.Json;
using System.Text;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class ReciboController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public ReciboController(IRepositoryWrapper repository)
{
this._repository = repository;
}
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> POST([FromBody] Dto_ReciboRequest value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Recibo", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Recibo", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest("Invalid model object");
}
var ObjectNew = await _repository.Recibo.Create(value.RetornaModelo());
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Recibo", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Recibo", value.NumOrden, value.DocEntry.ToString(), ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
}
}
@@ -0,0 +1,100 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO.WMS.SolicitudTransferencia;
using Net.Business.Entities;
using Net.Business.Services.Log;
using Net.Data;
using Newtonsoft.Json;
using System.Text;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
// Modulo 100% nuevo (sin equivalente en el .NET original) - ver
// docs/SOLICITUD_TRANSFERENCIA.md para el contrato completo.
[Route("api/[controller]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class SolicitudTransferenciaController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public SolicitudTransferenciaController(IRepositoryWrapper repository)
{
this._repository = repository;
}
// Responde 200 con el BE_ResultadoTransaccion completo en vez de 204 -
// decision deliberada: un 204 no puede llevar body (RFC 7231 §6.3.5) y
// muchos clientes HTTP, incluido HttpClient de .NET, no lo leen si el
// status es 204 - ver docs/SOLICITUD_TRANSFERENCIA.md.
[HttpPatch]
[Route("{docEntry}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Patch(int docEntry, [FromBody] Dto_SolicitudTransferenciaPatchRequest value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "SolicitudTraslado", "0", docEntry.ToString(), "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "SolicitudTraslado", value.NumOrden, docEntry.ToString(), "0", "0");
return BadRequest("Invalid model object");
}
var error = await _repository.SolicitudTransferencia.Update(docEntry, value.RetornaModelo());
var result = error ?? new BE_ResultadoTransaccion<object>
{
DocEntry = docEntry,
StatusCode = 200,
Message = "Registrado Correctamente",
AppName = "SolicitudTransferenciaRepository",
MethodName = "Update",
Data = value,
};
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(result)), "SolicitudTraslado", value.NumOrden, docEntry.ToString(), result.DocNum, result.DocEntry?.ToString());
if (error != null)
{
return BadRequest(result);
}
return Ok(result);
}
[HttpPost]
[Route("{docEntry}/cerrar")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Cerrar(int docEntry)
{
var error = await _repository.SolicitudTransferencia.Cerrar(docEntry);
var result = error ?? new BE_ResultadoTransaccion<object>
{
DocEntry = docEntry,
StatusCode = 200,
Message = "Cerrado Correctamente",
AppName = "SolicitudTransferenciaRepository",
MethodName = "Cerrar",
};
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { docEntry })), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(result)), "SolicitudTraslado", "0", docEntry.ToString(), result.DocNum, result.DocEntry?.ToString());
if (error != null)
{
return BadRequest(result);
}
return Ok(result);
}
}
}
@@ -0,0 +1,55 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Net.Business.DTO.WMS.Transferencia;
using Net.Business.Services.Log;
using Net.Data;
using Newtonsoft.Json;
using System.Text;
using System.Threading.Tasks;
namespace Net.Business.Services.Controllers
{
[Route("api/[controller]")]
[ApiController]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ApiExplorerSettings(GroupName = "ApiSAPWMS")]
[Authorize(AuthenticationSchemes = "Bearer")]
public class TransferenciaController : ControllerBase
{
private readonly IRepositoryWrapper _repository;
public TransferenciaController(IRepositoryWrapper repository)
{
this._repository = repository;
}
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> POST([FromBody] Dto_TransferenciaRequest value)
{
if (value == null)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Master object is null"), "Transferencia", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest("Master object is null");
}
if (!ModelState.IsValid)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes("Invalid model object"), "Transferencia", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest("Invalid model object");
}
var ObjectNew = await _repository.Transferencia.Create(value.RetornaModelo());
if (ObjectNew.StatusCode != 200)
{
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Transferencia", value.NumOrden, value.DocEntry.ToString(), "0", "0");
return BadRequest(ObjectNew);
}
B_Log.Add("Cubico", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(value)), Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ObjectNew)), "Transferencia", value.NumOrden, value.DocEntry.ToString(), ObjectNew?.DocNum.ToString(), ObjectNew?.DocEntry.ToString());
return Ok(ObjectNew);
}
}
}
@@ -0,0 +1,45 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using System.Net;
namespace Net.Business.Services
{
public static class ExceptionMiddlewareExtensions
{
public static void ConfigureExceptionHandler(this IApplicationBuilder app)
{
app.UseExceptionHandler(appError =>
{
appError.Run(async context =>
{
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
context.Response.ContentType = "application/json";
var contextFeature = context.Features.Get<IExceptionHandlerFeature>();
if (contextFeature != null)
{
await context.Response.WriteAsync(new DtoErrorDetails()
{
StatusCode = context.Response.StatusCode,
ErrorMessage = contextFeature.Error.Message.ToString()
}.ToString());
}
});
});
}
}
}
public class DtoErrorDetails
{
public int StatusCode { get; set; }
public string ErrorMessage { get; set; }
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
@@ -0,0 +1,54 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Net.Connection;
using Net.Data;
using System.Net.Http;
namespace Net.Business.Services
{
public static class ServiceExtensions
{
public static void ConfigureCors(this IServiceCollection services)
{
services.AddCors(opt =>
{
opt.AddPolicy("CorsPolicy",
builder => builder.WithOrigins("http://192.168.1.4", "http://localhost:4200")
.AllowAnyHeader()
.WithMethods("GET", "POST", "PUT", "PATH")
.AllowCredentials());
});
}
public static void ConfigureIISIntegration(this IServiceCollection services)
{
services.Configure<IISOptions>(options =>
{
});
}
public static void ConfigureSQLConnection(this IServiceCollection services)
{
services.AddScoped<IConnectionSQL, ConnectionSQL>();
}
public static void ConfigureRepositoryWrapper(this IServiceCollection services)
{
services.AddScoped<IRepositoryWrapper, RepositoryWrapper>();
}
public static void ConfigureHttpClientServiceLayer(this IServiceCollection services)
{
services.AddHttpClient("bypass-ssl-validation")
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (
httpRequestMessage, cert, certChain, policyErrors) =>
{
return true;
}
});
}
}
}
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>ITCA_API_SAP_WMS</name>
</assembly>
<members>
<member name="M:Net.Business.Services.Controllers.AuthenticateController.Token(Net.Business.DTO.Authenticate.Dto_AuthenticateRequest)">
<summary>
Obtiene Token de Acceso
</summary>
<param name="value">Parametros de filtros</param>
<returns>Devuelve Token de Acceso</returns>
</member>
<member name="M:Net.Business.Services.Controllers.InventarioController.Inventario(Net.Business.DTO.WMS.Inventario.Dto_Inventario)">
<summary>
Registra Proceso de Inventario
</summary>
</member>
</members>
</doc>
+35
View File
@@ -0,0 +1,35 @@
using Sap.Data.Hana;
using System;
namespace Net.Business.Services.Log
{
public class B_Log
{
public static string Add(string Origen, byte[] Trama_Origen, byte[] Trama_Respuesta, string Proceso, string Nro_Orden, string DocEntry, string DocNumSAP, string DocEntrySAP)
{
string DB = "ITCA_LOG_INTEGRACION";
string Code = System.Guid.NewGuid().ToString();
string Fecha = DateTime.Now.ToString("yyyy-MM-dd");
HanaConnection hana = new HanaConnection(Net.Data.LocalData.ConnectionString);
hana.Open();
HanaCommand hanaCommand = hana.CreateCommand();
hanaCommand.CommandText = $"INSERT INTO \"ITC_WMS_SAP\".\"{DB}\" (\"CODIGO\", \"ORIGEN\", \"TRAMA_ORIGEN\" , \"TRAMA_RESPUESTA\", \"PROCESO\", \"FECHA\", \"NRO_ORDEN\", \"DOCENTRY\", \"DOCNUMSAP\", \"DOCENTRYSAP\", \"HORA\") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
hanaCommand.Parameters.Add("CODIGO", HanaDbType.VarChar).Value = Code;
hanaCommand.Parameters.Add("ORIGEN", HanaDbType.VarChar).Value = Origen;
hanaCommand.Parameters.Add("TRAMA_ORIGEN", HanaDbType.Blob).Value = Trama_Origen;
hanaCommand.Parameters.Add("TRAMA_RESPUESTA", HanaDbType.Blob).Value = Trama_Respuesta;
hanaCommand.Parameters.Add("PROCESO", HanaDbType.VarChar).Value = Proceso;
hanaCommand.Parameters.Add("FECHA", HanaDbType.Date).Value = Fecha;
hanaCommand.Parameters.Add("NRO_ORDEN", HanaDbType.VarChar).Value = Nro_Orden;
hanaCommand.Parameters.Add("DOCENTRY", HanaDbType.VarChar).Value = DocEntry;
hanaCommand.Parameters.Add("DOCNUMSAP", HanaDbType.VarChar).Value = DocNumSAP;
hanaCommand.Parameters.Add("DOCENTRYSAP", HanaDbType.VarChar).Value = DocEntrySAP;
hanaCommand.Parameters.Add("HORA", HanaDbType.VarChar).Value = DateTime.Now.ToString("HH:mm:ss");
hanaCommand.CommandType = System.Data.CommandType.Text;
hanaCommand.ExecuteNonQuery();
hana.Close();
return Code;
}
}
}
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>ITCA_API_SAP_WMS</AssemblyName>
<UserSecretsId>24763424-3300-4c85-87e3-503f8fdebd14</UserSecretsId>
<!-- Antes solo estaba condicionado a Debug|AnyCPU - un "dotnet publish -c Release"
(lo normal para IIS) se quedaba sin este archivo, y Startup.cs revienta con
FileNotFoundException al armar Swagger (IncludeXmlComments) si no existe. -->
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>ITCA_API_SAP_WMS.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Net.Business.DTO\Net.Business.DTO.csproj" />
<ProjectReference Include="..\Net.Connection\Net.Connection.csproj" />
<ProjectReference Include="..\Net.Data\Net.Data.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="resources\img\" />
<Folder Include="resources\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Sap.Data.Hana.Core.v2.1">
<HintPath>..\..\..\..\..\..\..\..\Program Files\sap\hdbclient\dotnetcore\v2.1\Sap.Data.Hana.Core.v2.1.dll</HintPath>
</Reference>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>
+47
View File
@@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Net.Business.Services
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
//public static IHostBuilder CreateHostBuilder(string[] args) =>
// Host.CreateDefaultBuilder(args)
// .ConfigureWebHostDefaults(webBuilder =>
// {
// webBuilder.
// UseStartup<Startup>()
// .UseContentRoot(Directory.GetCurrentDirectory())
// .UseKestrel(options =>
// {
// options.Limits.MaxRequestBodySize = long.MaxValue;
// })
// .UseIISIntegration();
// //.UseKestrel(options =>
// //{
// // options.Limits.MaxRequestBodySize = long.MaxValue;
// //})
// });
}
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Debug\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>b4be6148-6e1f-4bb9-b399-424c4e6bf4c0</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Debug\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>b4be6148-6e1f-4bb9-b399-424c4e6bf4c0</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Debug\netcoreapp3.1\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>b4be6148-6e1f-4bb9-b399-424c4e6bf4c0</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
@@ -0,0 +1,38 @@
{
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Net.Business.Services": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
},
"IIS Desarrollo": {
"commandName": "IIS",
"workingDirectory": "C:\\inetpub\\wwwroot\\integracion",
"launchUrl": "http://localhost/integracion"
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iis": {
"applicationUrl": "http://localhost/integracion",
"sslPort": 0
},
"iisExpress": {
"applicationUrl": "http://localhost:54791",
"sslPort": 0
}
}
}
+141
View File
@@ -0,0 +1,141 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
namespace Net.Business.Services
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
Net.Data.LocalData.Configure(configuration);
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.ConfigureCors();
services.ConfigureIISIntegration();
services.ConfigureSQLConnection();
services.ConfigureHttpClientServiceLayer();
/*Linea con el cual obtenemos datos de la cabecera*/
services.AddSingleton<Microsoft.AspNetCore.Http.IHttpContextAccessor, Microsoft.AspNetCore.Http.HttpContextAccessor>();
//Autenticacion
string semilla = Configuration.GetSection("ParametrosTokenConfig").GetValue<string>("Semilla");
string emisor = Configuration.GetSection("ParametrosTokenConfig").GetValue<string>("Emisor");
string destinatario = Configuration.GetSection("ParametrosTokenConfig").GetValue<string>("Destinatario");
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(semilla));
services.AddAuthentication
(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(opt => {
opt.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidIssuer = emisor,
ValidAudience = destinatario,
IssuerSigningKey = key
};
});
services.ConfigureRepositoryWrapper();
/*De aqui en adelante configuracion de documentacion de nuestra API*/
services.AddSwaggerGen(options => {
options.SwaggerDoc("ApiSAPWMS", new Microsoft.OpenApi.Models.OpenApiInfo()
{
Title = "API SAP - WMS",
Version = "1",
Description = "API Integración SAP / WMS",
Contact = new Microsoft.OpenApi.Models.OpenApiContact()
{
Name = "IT Consultores Asociados",
},
License = new Microsoft.OpenApi.Models.OpenApiLicense()
{
Name = "MIT License",
}
});
var archivoXmlComentarios = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var rutaApiComentarios = Path.Combine(AppContext.BaseDirectory, archivoXmlComentarios);
options.IncludeXmlComments(rutaApiComentarios);
/*Primero definir el esquema de seguridad*/
options.AddSecurityDefinition("Bearer", new Microsoft.OpenApi.Models.OpenApiSecurityScheme
{
Description = "Autenticacion JWT (Bearer)",
Type = Microsoft.OpenApi.Models.SecuritySchemeType.Http,
Scheme = "bearer"
});
options.AddSecurityRequirement(new Microsoft.OpenApi.Models.OpenApiSecurityRequirement {
{
new Microsoft.OpenApi.Models.OpenApiSecurityScheme
{
Reference = new Microsoft.OpenApi.Models.OpenApiReference
{
Id = "Bearer",
Type = Microsoft.OpenApi.Models.ReferenceType.SecurityScheme
}
}, new List<string>()
}
});
});
services.AddControllers();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.ConfigureExceptionHandler();
//Linea para documentacion api
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("swagger/ApiSAPWMS/swagger.json", "API SAP - WMS");
options.RoutePrefix = "";
});
app.UseRouting();
app.UseCors("CorsPolicy");
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
@@ -0,0 +1,55 @@
{
"Logging": {
"LogLevel": {
"Default": "",
"Microsoft": "",
"Microsoft.Hosting.Lifetime": ""
}
},
"AllowedHosts": "",
"ConnectionStrings": {
"cnnSql": ""
},
"EntornoConection": {
"Entorno": "",
"EntornoSAP": ""
},
"ParametersConectionDev": {
"Source": "",
"Catalog": "",
"User": "",
"Password": ""
},
"ParametersConectionProd": {
"Source": "",
"Catalog": "",
"User": "",
"Password": ""
},
"ParametrosTokenConfig": {
"Semilla": "",
"Emisor": "",
"Destinatario": ""
},
"SapServiceLayer": {
"url": "",
"company": "",
"user": "",
"password": ""
},
"Hana": {
"server": "",
"user": "",
"password": ""
},
"EmailSenderOptions": {
"Port": "",
"Password": "",
"EnableSsl": "",
"Email": "",
"Host": ""
},
"RutaAnexo": {
"UbicacionAdjunto": ""
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="bin\Debug\netcoreapp3.1\ITCA_API_SAP_WMS.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: b4be6148-6e1f-4bb9-b399-424c4e6bf4c0-->
+11
View File
@@ -0,0 +1,11 @@
namespace Net.Connection.Attributes
{
public enum ActionType
{
Everything,
View,
Insert,
Update,
Delete
}
}
+64
View File
@@ -0,0 +1,64 @@
using System;
using System.Data;
namespace Net.Connection.Attributes
{
public class DBParameter : Attribute
{
public string name { get; set; }
public int size { get; set; }
public SqlDbType dbType { get; set; }
public ParameterDirection direction { get; set; }
public ActionType actionType;
public Boolean Key { get; set; }
/// <summary>
/// Asignacion del Tipo de Dato
/// </summary>
/// <param name="dbType">Tipo de dato</param>
/// <param name="actionType">Accion a realizar Everything, View, Insert, Update, Delete</param>
/// <param name="Key">Primary Key</param>
public DBParameter(SqlDbType dbType, ActionType actionType, Boolean Key)
{
DBParameterMethod(dbType, 0, ParameterDirection.Input, "", actionType, Key);
}
//public DBParameter(SqlDbType dbType, ActionType actionType)
//{
// DBParameterMethod(dbType, 0, ParameterDirection.Input, "", actionType, false);
//}
//public DBParameter(SqlDbType dbType, ActionType actionType, ParameterDirection direction)
//{
// DBParameterMethod(dbType, 0, direction, "", actionType, false);
//}
/// <summary>
/// Asignacion del Tipo de Dato
/// </summary>
/// <param name="dbType">Tipo de Dato</param>
/// <param name="size">Tamano</param>
/// <param name="actionType">Accion a realizar Everything, View, Insert, Update, Delete</param>
public DBParameter(SqlDbType dbType, int size, ActionType actionType)
{
DBParameterMethod(dbType, size, ParameterDirection.Input, "", actionType, false);
}
//public DBParameter(SqlDbType dbType, int size, ParameterDirection direction, ActionType actionType)
//{
// DBParameterMethod(dbType, size, direction, "", actionType, false);
//}
//public DBParameter(SqlDbType dbType, int size, ParameterDirection direction, string name, ActionType actionType)
//{
// DBParameterMethod(dbType, size, direction, name, actionType, false);
//}
private void DBParameterMethod(SqlDbType dbType, int size, ParameterDirection direction, string name, ActionType actionType, Boolean Key)
{
this.dbType = dbType;
this.direction = direction;
this.size = size;
this.name = name;
this.actionType = actionType;
this.Key = Key;
}
}
}
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Net.Business.Entities\Net.Business.Entities.csproj" />
</ItemGroup>
</Project>
@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace Net.Connection.ServiceLayer
{
public class ResponseGetServiceLayer<T>
{
public List<T> value { get; set; }
}
}
@@ -0,0 +1,27 @@
using System;
namespace Net.Connection.ServiceLayer
{
public class ResponseLoginServiceLayer
{
public string SessionId { get; set; }
public string Version { get; set; }
public int? SessionTimeout { get; set; }
public Boolean ServicioActivo { get; set; }
public string MensajeLogin { get; set; }
public ErrorServiceLayer error { get; set; }
}
public class ErrorServiceLayer
{
public string code { get; set; }
public object message { get; set; }
//public string? message { get; set; }
}
public class ErrorMensajeServiceLayer
{
public string lang { get; set; }
public string value { get; set; }
}
}
+372
View File
@@ -0,0 +1,372 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Net.Connection.Attributes;
using Net.CrossCotting;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
namespace Net.Connection
{
public class ConnectionSQL : IConnectionSQL
{
public string _cnx { get; set; }
public ConnectionSQL(IConfiguration configuration, IServiceProvider serviceProvider)
{
}
public ConnectionSQL()
{
}
public string DevuelveConnectionSQL()
{
return _cnx;
}
public IEnumerable<T> ExecuteSqlViewFindByCondition<T>(string procedureName, object parameters)
{
return ExecuteSqlQuery<T>(procedureName, GetParametersSqlQueryAnotation(parameters, ActionType.View).ToArray());
}
public T ExecuteSqlViewId<T>(string procedureName, object parameters)
{
return ExecuteSqlQuery<T>(procedureName, GetParametersSqlQueryAnotation(parameters, ActionType.Everything).ToArray()).FirstOrDefault();
}
public IEnumerable<T> ExecuteSqlViewAll<T>(string procedureName, T parameters)
{
return ExecuteSqlQuery<T>(procedureName, GetParametersSqlQueryAnotation(parameters, ActionType.Everything).ToArray());
}
public object ExecuteSqlInsert<T>(string procedureName, object parameters)
{
return ExecuteSqlNonQuery(procedureName, GetParametersSqlQueryAnotation(parameters, ActionType.Insert).ToArray())[0].valor;
}
public object ExecuteSqlUpdate<T>(string procedureName, object parameters)
{
return ExecuteSqlNonQuery(procedureName, GetParametersSqlQueryAnotation(parameters, ActionType.Update).ToArray());
}
public object ExecuteSqlDelete<T>(string procedureName, T parameters)
{
return ExecuteSqlNonQuery(procedureName, GetParametersSqlQueryAnotation(parameters, ActionType.Delete).ToArray());
}
public DbParametro[] ExecuteSqlNonQuery(string procedureName, DbParametro[] parameters)
{
SqlConnection cnx = new SqlConnection(_cnx);
SqlCommand cmd = cnx.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = procedureName;
cmd.CommandTimeout = 0;
try
{
foreach (DbParametro parametro in parameters)
{
SqlParameter prm = new SqlParameter();
prm.ParameterName = parametro.nombre;
if (!parametro.dbType.Equals (System.Data.SqlDbType.VarBinary))
{
prm.SqlDbType = parametro.dbType;
prm.Size = (parametro.size == 0) ? prm.Size : parametro.size;
}
prm.Direction = parametro.direccion;
prm.Value = parametro.valor;
cmd.Parameters.Add(prm);
}
if (cmd.Connection.State.HasFlag(ConnectionState.Closed))
cmd.Connection.Open();
cmd.Transaction = cmd.Connection.BeginTransaction();
cmd.ExecuteNonQuery();
if (parameters != null)
{
SqlParameterCollection sqlParameters = cmd.Parameters;
for (int i = 0; i < parameters.Length; i++)
{
parameters[i].valor = sqlParameters[parameters[i].nombre.ToUpper().Trim()].Value;
}
}
cmd.Transaction.Commit();
}
catch (SqlException ex)
{
if (cmd.Transaction != null)
{
cmd.Transaction.Rollback();
}
throw ex;
}
catch (Exception ex)
{
if (cmd.Transaction != null)
{
cmd.Transaction.Rollback();
}
throw ex;
}
finally
{
if (cmd.Connection != null && cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
}
}
return parameters;
}
public IEnumerable<T> ExecuteSqlQuery<T>(string comandSql)
{
return ExecuteSqlQuery<T>(comandSql, null);
}
public IEnumerable<T> ExecuteSqlQuery<T>(string procedureName, DbParametro[] parameters)
{
IEnumerable<T> queryResult;
SqlCommand cmd = new SqlCommand(procedureName);
cmd.CommandText = procedureName;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 0;
try
{
// Asignamos los parámetros
if (parameters != null)
{
foreach (DbParametro parametro in parameters)
{
SqlParameter prm = new SqlParameter();
prm.ParameterName = parametro.nombre;
prm.SqlDbType = parametro.dbType;
prm.Size = parametro.size;
prm.Direction = parametro.direccion;
prm.Value = parametro.valor;
cmd.Parameters.Add(prm);
}
}
// Creamos la Conexion
cmd.Connection = new SqlConnection(_cnx);
if (cmd.Connection.State.HasFlag(ConnectionState.Closed))
cmd.Connection.Open();
DataTable dataTable = new DataTable();
cmd.Transaction = cmd.Connection.BeginTransaction();
using (IDataReader reader = cmd.ExecuteReader())
{
dataTable.Load(reader);
queryResult = ConvertTo<T>(dataTable);
}
cmd.Transaction.Commit();
}
catch (SqlException ex)
{
if (cmd.Transaction != null)
{
cmd.Transaction.Rollback();
}
throw ex;
}
finally
{
if (cmd.Connection != null && cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
}
}
return queryResult;
}
//private static SqlParameterCollection CreateParametros(string procedureName, string conexion)
//{
// SqlCommand cmd = new SqlCommand(procedureName.Trim());
// try
// {
// cmd.CommandType = CommandType.StoredProcedure;
// cmd.Connection = new SqlConnection(conexion);
// if (cmd.Connection.State == ConnectionState.Closed)
// {
// cmd.Connection.Open();
// }
// SqlCommandBuilder.DeriveParameters(cmd);
// for (int i = 0; i < cmd.Parameters.Count; i++)
// {
// string Nombre = cmd.Parameters[i].ParameterName;
// if (Nombre.Substring(0, 1) == "@")
// {
// Nombre = Nombre.Substring(1);
// }
// cmd.Parameters[i].ParameterName = Nombre.ToUpper();
// }
// return cmd.Parameters;
// }
// catch (Exception ex)
// {
// throw ex;
// }
// finally
// {
// cmd.Connection.Dispose();
// cmd.Dispose();
// }
//}
//private static IList<DbParametro> GetParametersSqlQuery(Object parameters)
//{
// IList<DbParametro> listaParametro = new List<DbParametro>();
// foreach (PropertyInfo prop in parameters.GetType().GetProperties())
// {
// dynamic valor = prop.GetValue(parameters, null);
// Type type = Nullable.GetUnderlyingType(prop.PropertyType);
// if (valor != null)
// {
// type = (type == null) ? prop.PropertyType : type;
// if (type != typeof(System.Collections.Generic.ICollection<>))
// {
// listaParametro.Add(new DbParametro() { nombre = prop.Name, valor = valor });
// }
// }
// }
// return listaParametro;
//}
private static IList<DbParametro> GetParametersSqlQueryAnotation<T>(T parameters, ActionType actionType)
{
IList<DbParametro> listaParametro = new List<DbParametro>();
foreach (PropertyInfo prop in parameters.GetType().GetProperties())
{
dynamic valor = prop.GetValue(parameters, null);
Type type = Nullable.GetUnderlyingType(prop.PropertyType);
if (valor != null)
{
type = (type == null) ? prop.PropertyType : type;
var attributes = prop.GetCustomAttributes(false);
var columnMapping = attributes.FirstOrDefault(a => a.GetType() == typeof(DBParameter));
if (columnMapping != null)
{
DbParametro parametro = new DbParametro() { valor = valor };
var mapsto = columnMapping as DBParameter;
switch (actionType)
{
case ActionType.Insert:
if (mapsto.actionType == ActionType.Everything)
{
mapsto.actionType = ActionType.Insert;
}
break;
case ActionType.Update:
if (mapsto.actionType == ActionType.Everything)
{
mapsto.actionType = ActionType.Update;
}
break;
case ActionType.Delete:
if (mapsto.actionType == ActionType.Everything)
{
mapsto.actionType = ActionType.Delete;
}
break;
case ActionType.View:
if (mapsto.actionType == ActionType.View ||
mapsto.actionType == ActionType.Everything)
{
mapsto.actionType = ActionType.View;
}
break;
default:
break;
}
if (mapsto.actionType == actionType)
{
parametro.nombre = (mapsto.name == "") ? prop.Name : mapsto.name;
parametro.direccion = (mapsto.Key == true && mapsto.actionType == ActionType.Insert) ? ParameterDirection.Output : mapsto.direction;
parametro.dbType = mapsto.dbType;
parametro.size = mapsto.size;
listaParametro.Add(parametro);
}
}
}
}
return listaParametro;
}
public static IList<T> ConvertTo<T>(DataTable table)
{
if (table == null)
return null;
List<DataRow> rows = new List<DataRow>();
foreach (DataRow row in table.Rows)
rows.Add(row);
return ConvertTo<T>(rows);
}
public static IList<T> ConvertTo<T>(IList<DataRow> rows)
{
IList<T> list = null;
if (rows != null)
{
list = new List<T>();
foreach (DataRow row in rows)
{
T item = CreateItem<T>(row);
list.Add(item);
}
}
return list;
}
public static T CreateItem<T>(DataRow row)
{
string columnName;
T obj = default(T);
if (row != null)
{
obj = Activator.CreateInstance<T>();
foreach (DataColumn column in row.Table.Columns)
{
columnName = column.ColumnName;
//Get property with same columnName
PropertyInfo prop = obj.GetType().GetProperty(columnName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
try
{
if (prop != null)
{
//Get value for the column
object value = (row[columnName].GetType() == typeof(DBNull)) ? null : row[columnName];
//Set property value
prop.SetValue(obj, value, null);
}
}
catch
{
throw;
//Catch whatever here
}
}
}
return obj;
}
}
}
+35
View File
@@ -0,0 +1,35 @@
using System.Data;
namespace Net.Connection
{
public class DbParametro
{
public string nombre { get; set; }
public object valor { get; set; }
public int size { get; set; }
public ParameterDirection direccion { get; set; }
public SqlDbType dbType { get; set; }
public DbParametro()
{
nombre = "";
valor = null;
direccion = ParameterDirection.Input;
}
public DbParametro(string Nombre, object Valor, ParameterDirection Direccion)
{
nombre = Nombre;
valor = Valor;
direccion = Direccion;
}
public DbParametro(string Nombre, object Valor)
{
nombre = Nombre;
valor = Valor;
direccion = ParameterDirection.Input;
}
}
}
Loaded 100 of 168 files, more files were not shown because too many files have changed in this diff. Show more