SMS - Ajustes 2024.01.10 guardar material os tipo venta Consignación - Uso material
This commit is contained in:
@@ -1871,6 +1871,32 @@ Public Class ClsOS
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
Public Function AddOrdenesServicioMateriales(CveOS As Integer, CvePS As Integer, Cantidad As Decimal, Serie As String, Lote As String, FechaCaducidad As Date, CveUsuario As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_OS_OrdenesServicioMaterialesAdd")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveOS", SqlDbType.Int).Value = CveOS
|
||||||
|
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||||
|
.Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad
|
||||||
|
.Add("@Serie", SqlDbType.VarChar).Value = Serie
|
||||||
|
.Add("@Lote", SqlDbType.VarChar).Value = Lote
|
||||||
|
.Add("@FechaCaducidad", SqlDbType.Date).Value = FechaCaducidad
|
||||||
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al guardar el material.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
'Public Function GetCveCliente(CveVenta As Integer) As Boolean
|
'Public Function GetCveCliente(CveVenta As Integer) As Boolean
|
||||||
' Dim Retorno As Boolean = False
|
' Dim Retorno As Boolean = False
|
||||||
' DataAdapter("PA_OS_ClienteGet")
|
' DataAdapter("PA_OS_ClienteGet")
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ Imports Telerik.Web.UI
|
|||||||
Imports System.Data.SqlClient
|
Imports System.Data.SqlClient
|
||||||
Imports Stimulsoft.Report.StiOptions.Export
|
Imports Stimulsoft.Report.StiOptions.Export
|
||||||
Imports Modelos
|
Imports Modelos
|
||||||
|
Imports System.Runtime.InteropServices.ComTypes
|
||||||
|
Imports APP_Code_CSharp
|
||||||
|
|
||||||
Partial Class OS_OrdenesServicios
|
Partial Class OS_OrdenesServicios
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
@@ -670,7 +672,7 @@ Partial Class OS_OrdenesServicios
|
|||||||
' End If
|
' End If
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
ElseIf TipoEstatus = 4 Then
|
ElseIf TipoEstatus = 4 AndAlso Not UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||||
'DisableAll()
|
'DisableAll()
|
||||||
If SeFacturara = "True" Then
|
If SeFacturara = "True" Then
|
||||||
HplFacturar.Visible = True
|
HplFacturar.Visible = True
|
||||||
@@ -2955,6 +2957,20 @@ Partial Class OS_OrdenesServicios
|
|||||||
LnkModalMaterialUtilizado.Visible = True
|
LnkModalMaterialUtilizado.Visible = True
|
||||||
DTSolicitudDev = New DataTable
|
DTSolicitudDev = New DataTable
|
||||||
Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
|
Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Select Case DdlTipoVenta.SelectedValue.ToEntero
|
||||||
|
Case 2, 3
|
||||||
|
Opcion = 2
|
||||||
|
Exit Select
|
||||||
|
Case 5
|
||||||
|
Opcion = 3
|
||||||
|
Exit Select
|
||||||
|
Case Else
|
||||||
|
Opcion = 1
|
||||||
|
Exit Select
|
||||||
|
End Select
|
||||||
|
|
||||||
Dim ObjOS As New ClsOS
|
Dim ObjOS As New ClsOS
|
||||||
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, CveVenta, Opcion, UsuarioActual.CveEmpresa) Then
|
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, CveVenta, Opcion, UsuarioActual.CveEmpresa) Then
|
||||||
DTSolicitudDev = ObjOS.DtResultados
|
DTSolicitudDev = ObjOS.DtResultados
|
||||||
@@ -2996,18 +3012,74 @@ Partial Class OS_OrdenesServicios
|
|||||||
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
||||||
Dim CveAlmacenDestino As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyectoPedido}").ToEntero
|
Dim CveAlmacenDestino As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyectoPedido}").ToEntero
|
||||||
|
|
||||||
|
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||||
|
Dim TotalSeleccionado As Decimal = 0
|
||||||
|
|
||||||
|
For Each GVRow As GridViewRow In GvMU.Rows
|
||||||
|
TotalSeleccionado = TotalSeleccionado + GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||||
|
Next
|
||||||
|
|
||||||
|
If TotalSeleccionado = 0 Then
|
||||||
|
Alert("No se selecciono ningun material", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
|
||||||
If Not CveAlmacenDestino > 0 Then
|
If Not CveAlmacenDestino > 0 Then
|
||||||
Alert("No se encontró almacen de entrega por adelantado", TipoMensaje.MsgAdvertencia)
|
Alert("No se encontró almacen de entrega por adelantado", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim ProcesoOK As Boolean = True
|
Dim ProcesoOK As Boolean = True
|
||||||
Dim ObjV As New ClsVentas
|
Dim ObjV As New ClsVentas
|
||||||
Dim ClsOS As New ClsOS(ObjV.IniciaTransacSQL())
|
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||||
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
||||||
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
||||||
|
|
||||||
Dim GenrarRemisionMovimientos As Boolean = False
|
Dim GenrarRemisionMovimientos As Boolean = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||||
|
|
||||||
|
For Each GVRow As GridViewRow In GvMU.Rows
|
||||||
|
Dim CantidadRegistro As Decimal = GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||||
|
Dim CvePS As Integer = GVRow.DataKey("CvePS").ToEntero
|
||||||
|
|
||||||
|
If CantidadRegistro > 0 Then
|
||||||
|
|
||||||
|
Dim Serie As String = If(GVRow.DataKey("Serie") = "", "-1", GVRow.DataKey("Serie"))
|
||||||
|
Dim Lote As String = If(GVRow.DataKey("Lote") = "", "-1", GVRow.DataKey("Lote"))
|
||||||
|
Dim FechaCaducidad As DateTime = If(GVRow.DataKey("FechaCaducidad") = "", MinFecha, GVRow.DataKey("FechaCaducidad").ToDate)
|
||||||
|
|
||||||
|
If Not ObjOS.AddOrdenesServicioMateriales(CveOS, CvePS, CantidadRegistro, Serie, Lote, FechaCaducidad, UsuarioActual.CveUsuario) Then
|
||||||
|
Alert("Ocurrió un error al guardar el material.", TipoMensaje.MsgAdvertencia)
|
||||||
|
ProcesoOK = False
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
If ProcesoOK Then
|
||||||
|
|
||||||
|
Dim CveOSEstatusFinalizada As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero
|
||||||
|
|
||||||
|
If CveOSEstatusFinalizada > 0 Then
|
||||||
|
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOS) Then
|
||||||
|
ProcesoOK = False
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert("No se pudo obtener el estado para finalizar la orden de servicio.")
|
||||||
|
ProcesoOK = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
Else
|
||||||
If ProcesoOK Then
|
If ProcesoOK Then
|
||||||
Dim AplicaDevolucion As Boolean = False
|
Dim AplicaDevolucion As Boolean = False
|
||||||
For Each GvRow As GridViewRow In GvMU.Rows
|
For Each GvRow As GridViewRow In GvMU.Rows
|
||||||
@@ -3127,7 +3199,7 @@ Partial Class OS_OrdenesServicios
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If ProcesoOK Then
|
If ProcesoOK Then
|
||||||
If Not ClsOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa) Then
|
If Not ObjOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa) Then
|
||||||
ProcesoOK = False
|
ProcesoOK = False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -3151,21 +3223,30 @@ Partial Class OS_OrdenesServicios
|
|||||||
ProcesoOK = False
|
ProcesoOK = False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If ProcesoOK Then
|
If ProcesoOK Then
|
||||||
|
|
||||||
ObjV.Commit()
|
ObjV.Commit()
|
||||||
|
|
||||||
|
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||||
|
Dim Liga As String = $" document.location.href=""/OS/OrdenesServicios.aspx?CveOS={CveOS}""; "
|
||||||
|
Alert("El material utilizado se guardó correctamente", TipoMensaje.MsgInformacion, Liga)
|
||||||
|
Else
|
||||||
If GenrarRemisionMovimientos = False Then
|
If GenrarRemisionMovimientos = False Then
|
||||||
Alert("El material sera recibido en almacén.")
|
Alert("El material sera recibido en almacén.")
|
||||||
Else
|
Else
|
||||||
Alert("El material utilizado se guardó correctamente")
|
Alert("El material utilizado se guardó correctamente")
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
||||||
Else
|
Else
|
||||||
ObjV.RollBack()
|
ObjV.RollBack()
|
||||||
Alert("El material utilizado no se guardó correctamente", TipoMensaje.MsgAdvertencia)
|
Alert("Se presento un error al guardar el material", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjV.Dispose()
|
ObjV.Dispose()
|
||||||
|
|||||||
Reference in New Issue
Block a user