Sync cambios recientes 3.20 -> migracion (10 programas)
This commit is contained in:
@@ -3319,6 +3319,12 @@ FUNCTION ipprad44()
|
||||
|
||||
PREPARE smt FROM procedimiento
|
||||
|
||||
# Guardia sobre el SP: por defecto WHENEVER ERROR STOP
|
||||
# detiene el programa si el SP lanza un error SQL (p.ej.
|
||||
# -3998 "transaccion no-confirmable"), sin llegar a la
|
||||
# validacion limpia de out_result. Lo capturamos para
|
||||
# revertir y avisar en vez de crashear.
|
||||
WHENEVER ERROR CONTINUE
|
||||
EXECUTE smt
|
||||
USING ordenx IN,
|
||||
--idx IN,
|
||||
@@ -3367,6 +3373,27 @@ FUNCTION ipprad44()
|
||||
out_cantidad_item OUT,
|
||||
out_cantidad_ubicacion OUT,
|
||||
out_msg OUT
|
||||
WHENEVER ERROR STOP
|
||||
|
||||
# Si el EXEC del SP fallo a nivel SQL (STATUS < 0), como el
|
||||
# -3998 que deja la transaccion doomed, revertir y avisar
|
||||
# limpiamente en vez de detener el programa.
|
||||
IF STATUS < 0 THEN
|
||||
DISPLAY "ERROR SQL sp_insert_inventario: ",
|
||||
STATUS, " ", SQLERRMESSAGE
|
||||
DISPLAY "ITEM: ",
|
||||
movi2[idx].cod_n, "-",
|
||||
movi2[idx].cod_grupo, "-",
|
||||
movi2[idx].cod_tipo, "-",
|
||||
movi2[idx].cod_sec
|
||||
DISPLAY "DOCUMENTO: ", otros_mov.num_doc,
|
||||
" MOV: ", otros_mov.cod_mov,
|
||||
" BODEGA: ", otros_mov.bodega
|
||||
ROLLBACK WORK
|
||||
LET numero_msg = 1679
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD cod_n
|
||||
END IF
|
||||
|
||||
IF out_result <> 0 THEN
|
||||
|
||||
@@ -3396,7 +3423,13 @@ FUNCTION ipprad44()
|
||||
|
||||
DISPLAY "============================================"
|
||||
|
||||
# El SP pudo haber revertido ya la transaccion si
|
||||
# quedo condenada (CATCH con XACT_STATE = -1). Hacemos
|
||||
# este ROLLBACK tolerante para no crashear si ya no
|
||||
# hay transaccion activa.
|
||||
WHENEVER ERROR CONTINUE
|
||||
ROLLBACK WORK
|
||||
WHENEVER ERROR STOP
|
||||
|
||||
IF out_msg IS NOT NULL THEN
|
||||
ERROR out_msg
|
||||
|
||||
Reference in New Issue
Block a user