merge
This commit is contained in:
@@ -5105,6 +5105,12 @@ Namespace Modelos
|
|||||||
Dim ValidaVirtual = True
|
Dim ValidaVirtual = True
|
||||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||||
|
|
||||||
|
Dim tCveAlmacen As Integer = -1
|
||||||
|
|
||||||
|
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
|
tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then
|
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then
|
||||||
DtPSVirtual = ObjInventario.DtResultados
|
DtPSVirtual = ObjInventario.DtResultados
|
||||||
End If
|
End If
|
||||||
@@ -5113,7 +5119,7 @@ Namespace Modelos
|
|||||||
Dim CveAlmacenVirtual As Integer = -1
|
Dim CveAlmacenVirtual As Integer = -1
|
||||||
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
||||||
|
|
||||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||||
|
|
||||||
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
|
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
|
||||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1,
|
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1,
|
||||||
|
|||||||
457
Ashx/E141.ashx
457
Ashx/E141.ashx
@@ -1,14 +1,13 @@
|
|||||||
<%@ WebHandler Language="VB" Class="E141" %>
|
<%@ WebHandler Language="VB" Class="E141" %>
|
||||||
|
|
||||||
Imports System
|
Option Strict On
|
||||||
Imports System.Web
|
Option Explicit On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports System.Net.Http
|
Imports System.Net.Http
|
||||||
Imports System.Net
|
|
||||||
Imports Newtonsoft.Json
|
Imports Newtonsoft.Json
|
||||||
Imports Newtonsoft.Json.Linq
|
Imports Newtonsoft.Json.Linq
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports System.IO
|
|
||||||
|
|
||||||
Public Class E141 : Implements IHttpHandler
|
Public Class E141 : Implements IHttpHandler
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
Public ReadOnly Property TokenAutorizacion As String
|
Public ReadOnly Property TokenAutorizacion As String
|
||||||
Get
|
Get
|
||||||
If EsProduccion Then
|
If EsProduccion Then
|
||||||
Return "$2y$10$AGCCDbEoGEpd0ys89fuBXedtWlunwUeLRlo4MdeLyxDvJF4GwpL7a"
|
Return "$2y$10$8Mk3YeIkJESilIwD.U5dG.SsA4JloycJKbaGls8TNEw/AKBE1qane"
|
||||||
Else
|
Else
|
||||||
Return "$2y$10$8Mk3YeIkJESilIwD.U5dG.SsA4JloycJKbaGls8TNEw/AKBE1qane"
|
Return "$2y$10$8Mk3YeIkJESilIwD.U5dG.SsA4JloycJKbaGls8TNEw/AKBE1qane"
|
||||||
End If
|
End If
|
||||||
@@ -60,7 +59,7 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
Public ReadOnly Property URLBase As String
|
Public ReadOnly Property URLBase As String
|
||||||
Get
|
Get
|
||||||
If EsProduccion Then
|
If EsProduccion Then
|
||||||
Return "https://services.fidelityapps.mx/"
|
Return "https://econollantas-pruebas.fidelityapps.mx"
|
||||||
Else
|
Else
|
||||||
Return "https://econollantas-pruebas.fidelityapps.mx/"
|
Return "https://econollantas-pruebas.fidelityapps.mx/"
|
||||||
End If
|
End If
|
||||||
@@ -68,11 +67,11 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||||
context.Response.ContentType = "application/json"
|
Dim retorno As String = ""
|
||||||
Dim retorno As String = "no se encontro la variable"
|
|
||||||
Try
|
Try
|
||||||
Dim Params = If(context.Request("P") = Nothing, "", context.Request("P").ToString())
|
Dim Params = If(context.Request("P") = Nothing, "", context.Request("P").ToString())
|
||||||
|
|
||||||
|
'DESCARGA DEL PDF
|
||||||
If Not String.IsNullOrEmpty(Params) Then
|
If Not String.IsNullOrEmpty(Params) Then
|
||||||
Dim UrlParametros As Hashtable = Parametros(Decripta(Params))
|
Dim UrlParametros As Hashtable = Parametros(Decripta(Params))
|
||||||
|
|
||||||
@@ -80,41 +79,54 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
If Not String.IsNullOrEmpty(File) Then
|
If Not String.IsNullOrEmpty(File) Then
|
||||||
ImprimirbytesPDF(context, DescargarFactura(File), File)
|
ImprimirbytesPDF(context, DescargarFactura(File), File)
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
|
||||||
End If
|
Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString())
|
||||||
|
'OBTENER EXISTENCIAS
|
||||||
|
If Metodo = "GetExistencia" Then
|
||||||
|
context.Response.ContentType = "application/json"
|
||||||
|
|
||||||
Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString())
|
Dim Codigo = If(context.Request("Sku") = Nothing, "", context.Request("Sku").ToString())
|
||||||
|
retorno = GetExistencia(context, Codigo)
|
||||||
|
|
||||||
Dim FiltrarTodos = If(context.Request("FiltrarTodos") = Nothing, "", context.Request("FiltrarTodos").ToString())
|
Else
|
||||||
|
context.Response.ContentType = "text/html"
|
||||||
|
|
||||||
If Metodo = "CrearActualizarProductos" Then
|
Dim FiltrarTodos = If(context.Request("FiltrarTodos") = Nothing, "", context.Request("FiltrarTodos").ToString())
|
||||||
retorno = CrearActualizarProductos(If(FiltrarTodos = "1", True, False))
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Metodo = "ActualizarPrecios" Then
|
Dim respuesta As Boolean = False
|
||||||
retorno = ActualizarPrecios(If(FiltrarTodos = "1", True, False))
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Metodo = "ActualizarExistencias" Then
|
'TAREAS PROGRAMADAS
|
||||||
retorno = ActualizarExistencias(If(FiltrarTodos = "1", True, False))
|
Select Case Metodo
|
||||||
End If
|
Case "CrearActualizarProductos"
|
||||||
|
respuesta = CrearActualizarProductos(If(FiltrarTodos = "1", True, False))
|
||||||
|
Case "ActualizarPrecios"
|
||||||
|
respuesta = ActualizarPrecios(If(FiltrarTodos = "1", True, False))
|
||||||
|
Case "ActualizarExistencias"
|
||||||
|
respuesta = ActualizarExistencias()
|
||||||
|
Case "ActualizarVendedores"
|
||||||
|
respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False))
|
||||||
|
End Select
|
||||||
|
|
||||||
If Metodo = "ActualizarVendedores" Then
|
If respuesta Then
|
||||||
retorno = ActualizarVendedores(If(FiltrarTodos = "1", True, False))
|
retorno = "True"
|
||||||
End If
|
Else
|
||||||
|
retorno = "False"
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
context.Response.Write(retorno)
|
||||||
|
|
||||||
If Metodo = "GetExistencia" Then
|
|
||||||
Dim Codigo = If(context.Request("Sku") = Nothing, "", context.Request("Sku").ToString())
|
|
||||||
retorno = GetExistencia(context, Codigo)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
context.Response.ContentType = "text/html"
|
||||||
retorno = ex.ToString()
|
retorno = ex.ToString()
|
||||||
ex.GuardaLog(ex.ToString())
|
ex.GuardaLog(ex.ToString())
|
||||||
|
|
||||||
|
context.Response.Write(retorno)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
context.Response.Write(retorno)
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function GetExistencia(ByVal context As HttpContext, Codigo As String) As String
|
Private Function GetExistencia(ByVal context As HttpContext, Codigo As String) As String
|
||||||
@@ -157,17 +169,23 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
Using ObjPS As New ClsProductosServicios()
|
Using ObjPS As New ClsProductosServicios()
|
||||||
If ObjPS.GetExistenciasEmpresa(Codigo, CveEmpresa) Then
|
If ObjPS.GetExistenciasEmpresa(Codigo, CveEmpresa) Then
|
||||||
Dim ArrayPS As New JArray
|
Dim ArrayPS As New JArray
|
||||||
For Each RowPS As DataRow In ObjPS.DtResultados.Rows
|
If ObjPS.DtResultados.Rows.Count > 0 Then
|
||||||
Dim producto As New JObject(
|
For Each RowPS As DataRow In ObjPS.DtResultados.Rows
|
||||||
New JProperty("sku", RowPS("Codigo")),
|
Dim producto As New JObject(
|
||||||
New JProperty("stock", RowPS("Existencia"))
|
New JProperty("sku", RowPS("Codigo")),
|
||||||
)
|
New JProperty("stock", RowPS("Existencia"))
|
||||||
ArrayPS.Add(producto)
|
)
|
||||||
Next
|
ArrayPS.Add(producto)
|
||||||
|
Next
|
||||||
|
respuesta.isSuccess = True
|
||||||
|
respuesta.message = "La existencia se obtuvo correctamente"
|
||||||
|
Else
|
||||||
|
respuesta.isSuccess = True
|
||||||
|
respuesta.message = "No se encontro ningun producto"
|
||||||
|
End If
|
||||||
|
|
||||||
respuesta.products = ArrayPS
|
respuesta.products = ArrayPS
|
||||||
respuesta.isSuccess = True
|
|
||||||
respuesta.message = "La existencia se obtuvo correctamente"
|
|
||||||
Else
|
Else
|
||||||
respuesta.isSuccess = False
|
respuesta.isSuccess = False
|
||||||
respuesta.message = "Ocurrió un error al obtener la existencia"
|
respuesta.message = "Ocurrió un error al obtener la existencia"
|
||||||
@@ -182,6 +200,7 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
Dim Retorno As String = "{}"
|
Dim Retorno As String = "{}"
|
||||||
Try
|
Try
|
||||||
Using httpClient = New HttpClient()
|
Using httpClient = New HttpClient()
|
||||||
|
httpClient.Timeout = New TimeSpan(0, 5, 0)
|
||||||
Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url))
|
Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url))
|
||||||
request.Headers.Add("token", TokenAutorizacion)
|
request.Headers.Add("token", TokenAutorizacion)
|
||||||
|
|
||||||
@@ -233,12 +252,10 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
' Return Retorno
|
' Return Retorno
|
||||||
'End Function
|
'End Function
|
||||||
#Region "C R E A C I Ó N / A C T U A L I Z A C I Ó N - P R O D U C T O S"
|
#Region "C R E A C I Ó N / A C T U A L I Z A C I Ó N - P R O D U C T O S"
|
||||||
Private Function CrearActualizarProductos(Todos As Boolean) As String
|
|
||||||
Return EnviarInformacion($"{Me.URLBase}api/services/products/import", GetProductosModificados(Todos))
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function GetProductosModificados(Todos As Boolean) As String
|
Private Function CrearActualizarProductos(Todos As Boolean) As Boolean
|
||||||
Dim Retorno As String = "{}"
|
Dim Retorno As Boolean = False
|
||||||
|
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
|
||||||
|
|
||||||
Dim DtPS As DataTable = Nothing
|
Dim DtPS As DataTable = Nothing
|
||||||
Using ObjPS As New ClsProductosServicios
|
Using ObjPS As New ClsProductosServicios
|
||||||
@@ -250,59 +267,124 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
|
|
||||||
If DtPS IsNot Nothing Then
|
If DtPS IsNot Nothing Then
|
||||||
|
|
||||||
Dim ArrayPS As New JArray
|
If DtPS.Rows.Count > 0 AndAlso DtPS.Rows.Count = 1 Then
|
||||||
For Each RowPS As DataRow In DtPS.Rows
|
Dim Dt As DataTable = DtPS.FiltraPorIndices(0, 0)
|
||||||
|
Dim payload = New JObject()
|
||||||
|
|
||||||
Dim PSData As String() = RowPS("PS").ToString().Split(" ".ToCharArray())
|
payload.Add(New JProperty("products", GenerarPayloadProductos(Dt)))
|
||||||
|
|
||||||
Dim Measurement As String = "", Size As String = "", alt_code As String = ""
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/services/products/import", payload.ToString())
|
||||||
|
|
||||||
If PSData.Length > 0 Then
|
CountPeticiones += 1
|
||||||
Measurement = PSData(0)
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If PSData.Length > 1 Then
|
Else
|
||||||
Size = PSData(1)
|
Dim TotalIndex As Integer = DtPS.Rows.Count - 1
|
||||||
End If
|
Dim TotaRegistrosPorPeticion As Integer = 500
|
||||||
|
Dim PrevIndex As Integer = 0
|
||||||
|
Dim CurrentIndex As Integer = 0
|
||||||
|
|
||||||
alt_code = String.Concat(Measurement, Size)
|
While PrevIndex < TotalIndex
|
||||||
|
CurrentIndex += TotaRegistrosPorPeticion
|
||||||
|
|
||||||
Dim producto As New JObject(
|
If CurrentIndex > TotalIndex Then
|
||||||
New JProperty("clasificacion", RowPS("Clasificacion")),
|
CurrentIndex = TotalIndex
|
||||||
New JProperty("category", "Prod"),
|
End If
|
||||||
New JProperty("pza", RowPS("Unidad")),
|
|
||||||
New JProperty("sku", RowPS("Codigo")),
|
|
||||||
New JProperty("name", RowPS("PS")),
|
|
||||||
New JProperty("measurement", Measurement),
|
|
||||||
New JProperty("size", Size),
|
|
||||||
New JProperty("brand", RowPS("Marca")),
|
|
||||||
New JProperty("price", RowPS("Precio")),
|
|
||||||
New JProperty("active", RowPS("Estado")),
|
|
||||||
New JProperty("user", RowPS("UsuarioModifico")),
|
|
||||||
New JProperty("alt_code", alt_code),
|
|
||||||
New JProperty("short_description", ""),
|
|
||||||
New JProperty("description", ""),
|
|
||||||
New JProperty("currency", 1),
|
|
||||||
New JProperty("promo_price", RowPS("PrecioPromocion"))
|
|
||||||
)
|
|
||||||
|
|
||||||
ArrayPS.Add(producto)
|
Dim Dt As DataTable = DtPS.FiltraPorIndices(PrevIndex, CurrentIndex)
|
||||||
Next
|
Dim payload = New JObject()
|
||||||
Retorno = New JObject(New JProperty("products", ArrayPS)).ToString()
|
|
||||||
|
'If Not EsProduccion Then
|
||||||
|
' payload.Add(New JProperty("deleteNotIncluded", True))
|
||||||
|
'End If
|
||||||
|
|
||||||
|
payload.Add(New JProperty("products", GenerarPayloadProductos(Dt)))
|
||||||
|
|
||||||
|
PrevIndex = CurrentIndex
|
||||||
|
|
||||||
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/services/products/import", payload.ToString())
|
||||||
|
|
||||||
|
CountPeticiones += 1
|
||||||
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Threading.Thread.Sleep(3000)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
If CountPeticionesExitosas = CountPeticiones Then
|
||||||
|
Retorno = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GenerarPayloadProductos(DtPS As DataTable) As JArray
|
||||||
|
Dim ArrayPS As New JArray
|
||||||
|
For Each RowPS As DataRow In DtPS.Rows
|
||||||
|
|
||||||
|
Dim PSData As String() = RowPS("PS").ToString().Split(" ".ToCharArray())
|
||||||
|
|
||||||
|
Dim Measurement As String = "", Size As String = "", alt_code As String = ""
|
||||||
|
|
||||||
|
If PSData.Length > 0 Then
|
||||||
|
Measurement = PSData(0)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If PSData.Length > 1 Then
|
||||||
|
Size = PSData(1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
alt_code = String.Concat(Measurement, Size)
|
||||||
|
|
||||||
|
Dim producto As New JObject(
|
||||||
|
New JProperty("clasificacion", RowPS("Clasificacion")),
|
||||||
|
New JProperty("category", "Prod"),
|
||||||
|
New JProperty("pza", RowPS("Unidad")),
|
||||||
|
New JProperty("sku", RowPS("Codigo")),
|
||||||
|
New JProperty("name", RowPS("PS")),
|
||||||
|
New JProperty("measurement", Measurement),
|
||||||
|
New JProperty("size", Size),
|
||||||
|
New JProperty("brand", RowPS("Marca")),
|
||||||
|
New JProperty("price", RowPS("Precio")),
|
||||||
|
New JProperty("active", RowPS("Estado")),
|
||||||
|
New JProperty("user", RowPS("UsuarioModifico")),
|
||||||
|
New JProperty("alt_code", alt_code),
|
||||||
|
New JProperty("short_description", ""),
|
||||||
|
New JProperty("description", ""),
|
||||||
|
New JProperty("currency", 1),
|
||||||
|
New JProperty("promo_price", RowPS("PrecioPromocion"))
|
||||||
|
)
|
||||||
|
|
||||||
|
ArrayPS.Add(producto)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return ArrayPS
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "A C T U A L I Z A R - P R E C I O S"
|
#Region "A C T U A L I Z A R - P R E C I O S"
|
||||||
|
|
||||||
Private Function ActualizarPrecios(Todos As Boolean) As String
|
'Private Function ActualizarPrecios(Todos As Boolean) As String
|
||||||
Return EnviarInformacion($"{Me.URLBase}api/services/products/price-import", GetPreciosModificados(Todos))
|
' Return EnviarInformacion($"{Me.URLBase}api/services/products/price-import", GetPreciosModificados(Todos))
|
||||||
End Function
|
'End Function
|
||||||
|
|
||||||
Private Function GetPreciosModificados(Todos As Boolean) As String
|
Private Function ActualizarPrecios(Todos As Boolean) As Boolean
|
||||||
Dim Retorno As String = "{}"
|
Dim Retorno As Boolean = False
|
||||||
|
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
|
||||||
|
|
||||||
Dim DtPS As DataTable = Nothing
|
Dim DtPS As DataTable = Nothing
|
||||||
Using ObjPS As New ClsProductosServicios
|
Using ObjPS As New ClsProductosServicios
|
||||||
@@ -314,32 +396,90 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
|
|
||||||
If DtPS IsNot Nothing Then
|
If DtPS IsNot Nothing Then
|
||||||
|
|
||||||
Dim ArrayPS As New JArray
|
If DtPS.Rows.Count > 0 AndAlso DtPS.Rows.Count = 1 Then
|
||||||
For Each RowPS As DataRow In DtPS.Rows
|
Dim Dt As DataTable = DtPS.FiltraPorIndices(0, 0)
|
||||||
|
Dim payload = New JObject()
|
||||||
|
|
||||||
Dim producto As New JObject(
|
payload.Add(New JProperty("products", GenerarPayloadPrecios(Dt)))
|
||||||
New JProperty("sku", RowPS("Codigo")),
|
|
||||||
New JProperty("price", RowPS("Precio")),
|
|
||||||
New JProperty("promo_price", RowPS("PrecioPromocion"))
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/services/products/price-import", payload.ToString())
|
||||||
)
|
|
||||||
|
CountPeticiones += 1
|
||||||
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
Dim TotalIndex As Integer = DtPS.Rows.Count - 1
|
||||||
|
Dim TotaRegistrosPorPeticion As Integer = 500
|
||||||
|
Dim PrevIndex As Integer = 0
|
||||||
|
Dim CurrentIndex As Integer = 0
|
||||||
|
|
||||||
|
While PrevIndex < TotalIndex
|
||||||
|
CurrentIndex += TotaRegistrosPorPeticion
|
||||||
|
|
||||||
|
If CurrentIndex > TotalIndex Then
|
||||||
|
CurrentIndex = TotalIndex
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim Dt As DataTable = DtPS.FiltraPorIndices(PrevIndex, CurrentIndex)
|
||||||
|
Dim payload = New JObject()
|
||||||
|
|
||||||
|
payload.Add(New JProperty("products", GenerarPayloadPrecios(Dt)))
|
||||||
|
|
||||||
|
PrevIndex = CurrentIndex
|
||||||
|
|
||||||
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/services/products/price-import", payload.ToString())
|
||||||
|
|
||||||
|
CountPeticiones += 1
|
||||||
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Threading.Thread.Sleep(3000)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
|
||||||
ArrayPS.Add(producto)
|
|
||||||
Next
|
|
||||||
Retorno = New JObject(New JProperty("products", ArrayPS)).ToString()
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GenerarPayloadPrecios(DtPS As DataTable) As JArray
|
||||||
|
Dim ArrayPS As New JArray
|
||||||
|
For Each RowPS As DataRow In DtPS.Rows
|
||||||
|
|
||||||
|
Dim producto As New JObject(
|
||||||
|
New JProperty("sku", RowPS("Codigo")),
|
||||||
|
New JProperty("price", RowPS("Precio")),
|
||||||
|
New JProperty("promo_price", RowPS("PrecioPromocion"))
|
||||||
|
)
|
||||||
|
|
||||||
|
ArrayPS.Add(producto)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return ArrayPS
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "A C T U A L I Z A R - E X I S T E N C I A S"
|
#Region "A C T U A L I Z A R - E X I S T E N C I A S"
|
||||||
|
|
||||||
Private Function ActualizarExistencias() As String
|
'Private Function ActualizarExistencias() As String
|
||||||
Return EnviarInformacion($"{Me.URLBase}api/services/products/stock", GetPSExistencias())
|
' Return EnviarInformacion($"{Me.URLBase}api/services/products/stock", GetPSExistencias())
|
||||||
End Function
|
'End Function
|
||||||
|
|
||||||
Private Function GetPSExistencias() As String
|
Private Function ActualizarExistencias() As Boolean
|
||||||
Dim Retorno As String = "{}"
|
Dim Retorno As Boolean = False
|
||||||
|
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
|
||||||
|
|
||||||
Dim DtPS As DataTable = Nothing
|
Dim DtPS As DataTable = Nothing
|
||||||
Using ObjPS As New ClsProductosServicios
|
Using ObjPS As New ClsProductosServicios
|
||||||
@@ -350,34 +490,90 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
End Using
|
End Using
|
||||||
|
|
||||||
If DtPS IsNot Nothing Then
|
If DtPS IsNot Nothing Then
|
||||||
|
If DtPS.Rows.Count > 0 AndAlso DtPS.Rows.Count = 1 Then
|
||||||
|
|
||||||
Dim ArrayPS As New JArray
|
Dim Dt As DataTable = DtPS.FiltraPorIndices(0, 0)
|
||||||
For Each RowPS As DataRow In DtPS.Rows
|
Dim payload = New JObject()
|
||||||
|
|
||||||
Dim producto As New JObject(
|
payload.Add(New JProperty("stock", GenerarPayloadExistencias(Dt)))
|
||||||
New JProperty("sku", RowPS("Codigo")),
|
|
||||||
New JProperty("branch_office_code", "01"),
|
|
||||||
New JProperty("stock", RowPS("Existencia"))
|
|
||||||
)
|
|
||||||
|
|
||||||
ArrayPS.Add(producto)
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/services/products/stock", payload.ToString())
|
||||||
Next
|
|
||||||
Retorno = New JObject(New JProperty("stock", ArrayPS)).ToString()
|
CountPeticiones += 1
|
||||||
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
Dim TotalIndex As Integer = DtPS.Rows.Count - 1
|
||||||
|
Dim TotaRegistrosPorPeticion As Integer = 500
|
||||||
|
Dim PrevIndex As Integer = 0
|
||||||
|
Dim CurrentIndex As Integer = 0
|
||||||
|
|
||||||
|
While PrevIndex < TotalIndex
|
||||||
|
CurrentIndex += TotaRegistrosPorPeticion
|
||||||
|
|
||||||
|
If CurrentIndex > TotalIndex Then
|
||||||
|
CurrentIndex = TotalIndex
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim Dt As DataTable = DtPS.FiltraPorIndices(PrevIndex, CurrentIndex)
|
||||||
|
Dim payload = New JObject()
|
||||||
|
|
||||||
|
payload.Add(New JProperty("stock", GenerarPayloadExistencias(Dt)))
|
||||||
|
|
||||||
|
PrevIndex = CurrentIndex
|
||||||
|
|
||||||
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/services/products/stock", payload.ToString())
|
||||||
|
|
||||||
|
CountPeticiones += 1
|
||||||
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Threading.Thread.Sleep(3000)
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If CountPeticionesExitosas = CountPeticiones Then
|
||||||
|
Retorno = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function GenerarPayloadExistencias(DtPS As DataTable) As JArray
|
||||||
|
Dim ArrayPS As New JArray
|
||||||
|
For Each RowPS As DataRow In DtPS.Rows
|
||||||
|
|
||||||
|
Dim producto As New JObject(
|
||||||
|
New JProperty("sku", RowPS("Codigo")),
|
||||||
|
New JProperty("branch_office_code", "01"),
|
||||||
|
New JProperty("stock", RowPS("Existencia").ToString())
|
||||||
|
)
|
||||||
|
|
||||||
|
ArrayPS.Add(producto)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return ArrayPS
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
#Region "A C T U A L I Z A R - E X I S T E N C I A S"
|
#Region "A C T U A L I Z A R - E X I S T E N C I A S"
|
||||||
|
|
||||||
Private Function ActualizarVendedores(Todos As Boolean) As String
|
Private Function ActualizarVendedores(Todos As Boolean) As Boolean
|
||||||
Return EnviarInformacion($"{Me.URLBase}api/v1/sellers/import", GetVendedores(Todos))
|
Dim Retorno As Boolean = False
|
||||||
End Function
|
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
|
||||||
|
|
||||||
Private Function GetVendedores(Todos As Boolean) As String
|
|
||||||
Dim Retorno As String = "{}"
|
|
||||||
|
|
||||||
Dim DtVendedores As DataTable = Nothing
|
Dim DtVendedores As DataTable = Nothing
|
||||||
Using ObjPS As New ClsProductosServicios
|
Using ObjPS As New ClsProductosServicios
|
||||||
@@ -410,6 +606,11 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
Apellido = String.Concat(VendedorData(0), " ", VendedorData(1))
|
Apellido = String.Concat(VendedorData(0), " ", VendedorData(1))
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
If VendedorData.Length > 4 Then
|
||||||
|
Nombre = String.Concat(VendedorData(VendedorData.Length - 1), " ", VendedorData(VendedorData.Length))
|
||||||
|
Apellido = String.Concat(VendedorData(0), " ", VendedorData(1))
|
||||||
|
End If
|
||||||
|
|
||||||
Dim vendedor As New JObject(
|
Dim vendedor As New JObject(
|
||||||
New JProperty("email", RowVendedor("Correo")),
|
New JProperty("email", RowVendedor("Correo")),
|
||||||
New JProperty("password", RowVendedor("Correo")),
|
New JProperty("password", RowVendedor("Correo")),
|
||||||
@@ -426,7 +627,19 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
|
|
||||||
ArrayVendedores.Add(vendedor)
|
ArrayVendedores.Add(vendedor)
|
||||||
Next
|
Next
|
||||||
Retorno = New JObject(New JProperty("sellers", ArrayVendedores)).ToString()
|
|
||||||
|
Dim payload = New JObject(New JProperty("sellers", ArrayVendedores)).ToString()
|
||||||
|
|
||||||
|
Dim resp = EnviarInformacion($"{Me.URLBase}api/v1/sellers/import", payload)
|
||||||
|
|
||||||
|
CountPeticiones += 1
|
||||||
|
|
||||||
|
If IsValidJson(resp) Then
|
||||||
|
Dim respuesta = JObject.Parse(resp)
|
||||||
|
If respuesta("status").ToString() = "success" Then
|
||||||
|
CountPeticionesExitosas += 1
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
@@ -495,4 +708,28 @@ Public Class E141 : Implements IHttpHandler
|
|||||||
Return URLParametros
|
Return URLParametros
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Shared Function IsValidJson(ByVal strInput As String) As Boolean
|
||||||
|
If String.IsNullOrWhiteSpace(strInput) Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
strInput = strInput.Trim()
|
||||||
|
|
||||||
|
If (strInput.StartsWith("{") AndAlso strInput.EndsWith("}")) OrElse (strInput.StartsWith("[") AndAlso strInput.EndsWith("]")) Then
|
||||||
|
|
||||||
|
Try
|
||||||
|
Dim obj = JToken.Parse(strInput)
|
||||||
|
Return True
|
||||||
|
Catch jex As JsonReaderException
|
||||||
|
Console.WriteLine(jex.Message)
|
||||||
|
Return False
|
||||||
|
Catch ex As Exception
|
||||||
|
Console.WriteLine(ex.ToString())
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
Else
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
@@ -2663,7 +2663,12 @@ Partial Class Inventarios_EntregaAlmacen
|
|||||||
|
|
||||||
' COMIENZA: VIRTUAL
|
' COMIENZA: VIRTUAL
|
||||||
If Not ErrorMovInv AndAlso TipoDocto.Contiene("Ing", "Dev") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso CveMovimiento > 0 Then
|
If Not ErrorMovInv AndAlso TipoDocto.Contiene("Ing", "Dev") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso CveMovimiento > 0 Then
|
||||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||||
|
Dim tCveAlmacen As Integer = -1
|
||||||
|
|
||||||
|
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
|
tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||||
DtPSVirtual = ObjInventario.DtResultados
|
DtPSVirtual = ObjInventario.DtResultados
|
||||||
@@ -2685,7 +2690,7 @@ Partial Class Inventarios_EntregaAlmacen
|
|||||||
Dim CveAlmacenVirtual As Integer = -1
|
Dim CveAlmacenVirtual As Integer = -1
|
||||||
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
|
||||||
Dim ValidaVirtual As Boolean = False
|
Dim ValidaVirtual As Boolean = False
|
||||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||||
|
|
||||||
If TipoMovimiento = 1 Then
|
If TipoMovimiento = 1 Then
|
||||||
CveConceptoMovimientoVirtual = 37
|
CveConceptoMovimientoVirtual = 37
|
||||||
|
|||||||
@@ -2702,6 +2702,12 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
|
|
||||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||||
|
|
||||||
|
Dim tCveAlmacen As Integer = -1
|
||||||
|
|
||||||
|
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
|
tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||||
DtPSVirtual = ObjInventario.DtResultados
|
DtPSVirtual = ObjInventario.DtResultados
|
||||||
End If
|
End If
|
||||||
@@ -2711,7 +2717,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
|
|
||||||
Dim CveTipoAlmacenFiltro As Integer = If(CveTipoCompra = 9, 25, 24)
|
Dim CveTipoAlmacenFiltro As Integer = If(CveTipoCompra = 9, 25, 24)
|
||||||
|
|
||||||
Dim CveAlmacenVirutal As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacenFiltro).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
Dim CveAlmacenVirutal As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||||
|
|
||||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirutal, If(TipoMovimiento > 1, 13, 2), 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, CveMovimientoRelacionado:=CveMovimiento, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/G4")
|
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirutal, If(TipoMovimiento > 1, 13, 2), 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraSurtir, -1, -1, -1, CveMovimientoRelacionado:=CveMovimiento, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="RA/G4")
|
||||||
FolioVirtual = ObjInventario.Folio
|
FolioVirtual = ObjInventario.Folio
|
||||||
|
|||||||
@@ -686,6 +686,9 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
Dim CveSubProyectoOrigen, CveSubProyectoDestino As Integer
|
Dim CveSubProyectoOrigen, CveSubProyectoDestino As Integer
|
||||||
Dim IdCtaContableOrigen, IdCtaContableDestino As Integer
|
Dim IdCtaContableOrigen, IdCtaContableDestino As Integer
|
||||||
|
|
||||||
|
Dim CveAlmacenVirtualSalida As Integer = -1
|
||||||
|
Dim CveAlmacenVirtualEntrada As Integer = -1
|
||||||
|
|
||||||
DrAlmO = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenOrigen.SelectedValue.ToEntero).FiltroPrimero("")
|
DrAlmO = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenOrigen.SelectedValue.ToEntero).FiltroPrimero("")
|
||||||
DrAlmD = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDestino.SelectedValue.ToEntero).FiltroPrimero("")
|
DrAlmD = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDestino.SelectedValue.ToEntero).FiltroPrimero("")
|
||||||
|
|
||||||
@@ -694,11 +697,14 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
TipoAlmacenOrigen = DrAlmO("CveTipoAlmacen").ToString.ToEntero
|
TipoAlmacenOrigen = DrAlmO("CveTipoAlmacen").ToString.ToEntero
|
||||||
CveSubProyectoOrigen = DrAlmO("CveSubProyecto").ToString.ToEntero
|
CveSubProyectoOrigen = DrAlmO("CveSubProyecto").ToString.ToEntero
|
||||||
IdCtaContableOrigen = DrAlmO("IdCtaContable").ToString.ToEntero
|
IdCtaContableOrigen = DrAlmO("IdCtaContable").ToString.ToEntero
|
||||||
|
CveAlmacenVirtualSalida = DrAlmO("CveAlmacenVirtual").ToString.ToEntero
|
||||||
|
|
||||||
|
|
||||||
CveSucursalDestino = DrAlmD("CveSubProyecto").ToString.ToEntero
|
CveSucursalDestino = DrAlmD("CveSubProyecto").ToString.ToEntero
|
||||||
TipoAlmacenDestino = DrAlmD("CveTipoAlmacen").ToString.ToEntero
|
TipoAlmacenDestino = DrAlmD("CveTipoAlmacen").ToString.ToEntero
|
||||||
CveSubProyectoDestino = DrAlmD("CveSubProyecto").ToString.ToEntero
|
CveSubProyectoDestino = DrAlmD("CveSubProyecto").ToString.ToEntero
|
||||||
IdCtaContableDestino = DrAlmO("IdCtaContable").ToString.ToEntero
|
IdCtaContableDestino = DrAlmD("IdCtaContable").ToString.ToEntero
|
||||||
|
CveAlmacenVirtualEntrada = DrAlmD("CveAlmacenVirtual").ToString.ToEntero
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -863,7 +869,11 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
'VIRTUAL SALIDA
|
'VIRTUAL SALIDA
|
||||||
If RealizarMovimientoVirtual Then
|
If RealizarMovimientoVirtual Then
|
||||||
|
|
||||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveSubProyectoOrigen).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero()
|
'If TipoAlmacenOrigen = 27 Then
|
||||||
|
' CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 25).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyectoOrigen}").ToEntero()
|
||||||
|
'Else
|
||||||
|
' CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyectoOrigen}").ToEntero()
|
||||||
|
'End If
|
||||||
|
|
||||||
Dim dtvirtual As DataTable = Nothing
|
Dim dtvirtual As DataTable = Nothing
|
||||||
|
|
||||||
@@ -889,7 +899,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero)
|
AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero)
|
||||||
@@ -955,70 +965,70 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
|
|
||||||
Else
|
Else
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
Dim Concepto As String = TxtObservaciones.Text
|
||||||
|
If Concepto = "" Then Concepto = "Traspaso"
|
||||||
|
'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO:
|
||||||
|
If Not ErrorMovInv Then
|
||||||
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||||
|
|
||||||
|
Dim resultado As DataTable = ObjInventario.DtResultados
|
||||||
|
Dim importe As Decimal = resultado.SUMD("Total").RoundSQL
|
||||||
|
'Dim IdCtaContableSalida As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenOrigen.SelectedValue.ToEntero)).ToEntero
|
||||||
|
'Dim IdCtaContableEntrada As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenDestino.SelectedValue.ToEntero)).ToEntero
|
||||||
|
Dim Contabilizable As Boolean = True
|
||||||
|
|
||||||
|
If IdCtaContableOrigen = IdCtaContableDestino And TipoAlmacenDestino <> 26 Then Contabilizable = False
|
||||||
|
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableOrigen, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
||||||
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
Dim Concepto As String = TxtObservaciones.Text
|
|
||||||
If Concepto = "" Then Concepto = "Traspaso"
|
|
||||||
'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO:
|
|
||||||
If Not ErrorMovInv Then
|
|
||||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
|
||||||
|
|
||||||
Dim resultado As DataTable = ObjInventario.DtResultados
|
'si el tipo de almacen de entrada es Almacen sin costo, se registra al costo, la salida.
|
||||||
Dim importe As Decimal = resultado.SUMD("Total").RoundSQL
|
If TipoAlmacenOrigen <> 26 AndAlso TipoAlmacenDestino = 26 Then
|
||||||
'Dim IdCtaContableSalida As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenOrigen.SelectedValue.ToEntero)).ToEntero
|
|
||||||
'Dim IdCtaContableEntrada As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenDestino.SelectedValue.ToEntero)).ToEntero
|
|
||||||
Dim Contabilizable As Boolean = True
|
|
||||||
|
|
||||||
If IdCtaContableOrigen = IdCtaContableDestino And TipoAlmacenDestino <> 26 Then Contabilizable = False
|
Dim tCveClasificacion As Integer = DtMovimientos.MAX("CveClasificacion").ToEntero
|
||||||
|
Dim dr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=tCveClasificacion).FiltroPrimero("")
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableOrigen, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
Dim IdCuentaCostos As Integer = -1
|
||||||
ErrorMovInv = True
|
If dr IsNot Nothing Then
|
||||||
End If
|
IdCuentaCostos = dr("IdCuentaCostos").ToString.ToEntero
|
||||||
|
|
||||||
'si el tipo de almacen de entrada es Almacen sin costo, se registra al costo, la salida.
|
|
||||||
If TipoAlmacenOrigen <> 26 AndAlso TipoAlmacenDestino = 26 Then
|
|
||||||
|
|
||||||
Dim tCveClasificacion As Integer = DtMovimientos.MAX("CveClasificacion").ToEntero
|
|
||||||
Dim dr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=tCveClasificacion).FiltroPrimero("")
|
|
||||||
Dim IdCuentaCostos As Integer = -1
|
|
||||||
If dr IsNot Nothing Then
|
|
||||||
IdCuentaCostos = dr("IdCuentaCostos").ToString.ToEntero
|
|
||||||
End If
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 69, TxtObservaciones.Text, Fecha, IdCuentaCostos, -1, CveClasificacion:=tCveClasificacion, CveSubProyecto:=CveSubProyectoOrigen, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
|
||||||
ErrorMovInv = True
|
|
||||||
End If
|
|
||||||
Contabilizable = False
|
|
||||||
importe = 0
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableDestino, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
|
||||||
ErrorMovInv = True
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 69, TxtObservaciones.Text, Fecha, IdCuentaCostos, -1, CveClasificacion:=tCveClasificacion, CveSubProyecto:=CveSubProyectoOrigen, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
||||||
|
ErrorMovInv = True
|
||||||
|
End If
|
||||||
|
Contabilizable = False
|
||||||
|
importe = 0
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContableDestino, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable, ImporteMX:=importe) Then
|
||||||
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
If Not ErrorMovInv Then
|
If Not ErrorMovInv Then
|
||||||
Dim Concepto As String = TxtObservaciones.Text
|
Dim Concepto As String = TxtObservaciones.Text
|
||||||
If Concepto = "" Then Concepto = "Traspaso"
|
If Concepto = "" Then Concepto = "Traspaso"
|
||||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen2", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen2", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||||
|
|
||||||
Dim resultado As DataTable = ObjInventario.DtResultados
|
Dim resultado As DataTable = ObjInventario.DtResultados
|
||||||
Dim importe As Decimal = resultado.SUMD("Total").RoundSQL
|
Dim importe As Decimal = resultado.SUMD("Total").RoundSQL
|
||||||
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorio.SelectedValue.ToEntero)).ToEntero
|
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorio.SelectedValue.ToEntero)).ToEntero
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then
|
||||||
ErrorMovInv = True
|
ErrorMovInv = True
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1688,6 +1698,14 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
|
|
||||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero()
|
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero()
|
||||||
|
|
||||||
|
'SI EL ALMACEN ORIGEN ES DE APOPYO LOGISTICO EL ALMACEN VIRTUAL DEBE SER DE APOYO LOGISTICO
|
||||||
|
'Dim CveAlmacenVirtual As Integer = -1
|
||||||
|
'If CveTipoAlmacenOrigen = 27 Then
|
||||||
|
' CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen =25 AND CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||||
|
'Else
|
||||||
|
' CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen =24 AND CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||||
|
'End If
|
||||||
|
|
||||||
If CveAlmacenVirtual > 0 Then
|
If CveAlmacenVirtual > 0 Then
|
||||||
|
|
||||||
Dim dtvirtual As DataTable = Nothing
|
Dim dtvirtual As DataTable = Nothing
|
||||||
@@ -2833,7 +2851,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
|||||||
|
|
||||||
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
|
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
|
||||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||||
Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath)
|
Dim excelFile As ExcelFile = excelFile.Load(flatFilePath)
|
||||||
|
|
||||||
Dim unnamed As Integer = 0
|
Dim unnamed As Integer = 0
|
||||||
Dim cols As Integer
|
Dim cols As Integer
|
||||||
|
|||||||
@@ -5176,6 +5176,10 @@ Partial Class Ventas
|
|||||||
DdlAlmacenAsignado.DataBind()
|
DdlAlmacenAsignado.DataBind()
|
||||||
DdlAlmacenAsignado.SelectedValueExist(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero())
|
DdlAlmacenAsignado.SelectedValueExist(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero())
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
ddlAlmacen.DataSource = Nothing
|
||||||
|
ddlAlmacen.DataBind()
|
||||||
|
End If
|
||||||
|
|
||||||
UpINV.Update()
|
UpINV.Update()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -13355,7 +13359,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
|
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
|
||||||
Anticipos()
|
Anticipos()
|
||||||
@@ -18025,7 +18029,7 @@ Partial Class Ventas
|
|||||||
CveMovimientoEntradaDev = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
CveMovimientoEntradaDev = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||||
Dim tCveAlmacen = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
Dim tCveAlmacen = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||||
CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {tCveAlmacen}").ToEntero()
|
CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen= {tCveAlmacen}").ToEntero()
|
||||||
CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen = 24 AND CveSubProyecto={CveSubProyecto}").ToEntero()
|
CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||||
|
|
||||||
Else
|
Else
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
@@ -18366,20 +18370,20 @@ Partial Class Ventas
|
|||||||
|
|
||||||
|
|
||||||
If Con.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then
|
If Con.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then
|
||||||
GvEst.DataSource = Con.DtResultados
|
GvEst.DataSource = Con.DtResultados
|
||||||
If Con.DtResultados.Rows.Count > 0 Then
|
If Con.DtResultados.Rows.Count > 0 Then
|
||||||
'BtnEstimacion.Visible = True
|
'BtnEstimacion.Visible = True
|
||||||
DdlContrato.Items.Clear()
|
DdlContrato.Items.Clear()
|
||||||
DdlContrato.Items.Add(New ListItem("Todos", "-1"))
|
DdlContrato.Items.Add(New ListItem("Todos", "-1"))
|
||||||
DdlContrato.DataSource = Con.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"})
|
DdlContrato.DataSource = Con.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"})
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
UPEstimaciones.Update()
|
UPEstimaciones.Update()
|
||||||
Con.Dispose()
|
Con.Dispose()
|
||||||
DdlContrato.DataBind()
|
DdlContrato.DataBind()
|
||||||
GvEst.DataBind()
|
GvEst.DataBind()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -20890,7 +20894,7 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
Else
|
Else
|
||||||
CancelarDocumento()
|
CancelarDocumento()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user