From d0e6b39fb8d04d8db5cbc94d8ce4f156c88e42be Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 5 Oct 2022 15:22:30 -0700 Subject: [PATCH] Mostrar serie y producto con una entrada previa --- App_Code/ClsInventarios.vb | 14 ++++++-------- App_Code/modExtensiones.vb | 11 +++++++++++ Inventarios/RecepcionAlmacen.aspx.vb | 5 ++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 19c44dfe0..05c4a0abe 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1346,24 +1346,22 @@ Public Class ClsInventarios Retorno = True End If Catch Ex1 As SqlException - If Ex1.Message.Contains("50019") Then Me.OnError(" El producto no tiene existencia.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ElseIf Ex1.Message.Contains("CK_Inv_MovimientosDetalle_MetodoInventario") Then - Me.OnError("El movimiento debe de tener una Serie.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Else - If Ex1.Message.Contains("50021") Then - Me.OnError(" El producto ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + If Ex1.Message.Contains("50021;") Then + If String.IsNullOrEmpty(Serie) Then + Me.OnError("El producto ya fue ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + OnError(String.Format("El producto '{0}' con la serie: '{1}' ya fue ingresado previamente.", Ex1.Message.GetTagValue("codigops"), Serie), Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If Else Me.OnError("Ocurrió un error al guardar los detalles del movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End If End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los detalles del movimiento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 40e68aafc..045c1e753 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -150,6 +150,17 @@ Namespace Extensiones #Region "Log" + + Public Function GetTagValue(Obj As String, tag As String) As String + Try + Dim Regex = New Regex($"<{tag}>(.*)") + Dim match = Regex.Match(Obj) + Return match.Groups(1).ToString() + Catch ex As Exception + Return "" + End Try + End Function + Public Sub GuardaLog(Str As String) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 70d75f8be..b1be09e13 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -3869,7 +3869,10 @@ Partial Class Inventarios_RecepcionAlmacen If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() If ObjContaContPAQ IsNot Nothing Then ObjContaContPAQ.RollBack() RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Alert($"Ocurrió un error al guardar el movimiento de almacén. Por favor vuelva a intentar.

{MensajeError}", TipoMensaje.MsgError) + + If Not String.IsNullOrEmpty(MensajeError) Then + Alert($"Ocurrió un error al guardar el movimiento de almacén. Por favor vuelva a intentar.

{MensajeError}", TipoMensaje.MsgError) + End If End If ObjInventario.Dispose()