JSOTO Arreglo programa ipprmt005, quitando la conexion IFMX
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
WANDY TIENE 2 SALIDAS 1 CARRERAS
|
|
||||||
JOSE HERNANDEZ 13 ENTRADA DE 14 PONCHES
|
|
||||||
STRABURG 2-0 FRENTE A SFO
|
|
||||||
CAIN HA GANADO LOS
|
|
||||||
|
|
||||||
LE VA MA FRENTE ATLANTA.
|
|
||||||
LE VA BIEN A MINESOTA.
|
|
||||||
PHIL HUGES 13 CARRERAS
|
|
||||||
KLUBER
|
|
||||||
|
|
||||||
TAMPA 8-1 CON
|
|
||||||
|
|
||||||
STL
|
|
||||||
ATL 77
|
|
||||||
PIRATAS 77
|
|
||||||
CINCINATA 77
|
|
||||||
LAA
|
|
||||||
PHILS
|
|
||||||
KC
|
|
||||||
LAD
|
|
||||||
DET
|
|
||||||
SFO
|
|
||||||
COLORADO
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
database marmotech
|
database smarmotech
|
||||||
screen size 24 by 80
|
screen size 24 by 80
|
||||||
{
|
{
|
||||||
Codigo del movimiento [f0] Material[f002 ]
|
Codigo del movimiento [f0] Material[f002 ]
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ END RECORD
|
|||||||
DEFINE balance DECIMAL(12,5)
|
DEFINE balance DECIMAL(12,5)
|
||||||
DEFINE cod_mov_ant LIKE iptb00006.cod_mov
|
DEFINE cod_mov_ant LIKE iptb00006.cod_mov
|
||||||
DEFINE existe_comp,suplidor1,doc_existe,actual,mat_prima CHAR (1000)
|
DEFINE existe_comp,suplidor1,doc_existe,actual,mat_prima CHAR (1000)
|
||||||
DEFINE opt1,opt4,opt,existe,ya ,opera1,cambio CHAR(3)
|
DEFINE opt1,opt4,opt,ya ,opera1,cambio CHAR(3)
|
||||||
DEFINE medida CHAR (3)
|
DEFINE medida CHAR (3)
|
||||||
DEFINE fila smallint
|
DEFINE fila smallint
|
||||||
DEFINE m_articulos RECORD LIKE iptb00002.*
|
DEFINE m_articulos RECORD LIKE iptb00002.*
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ MAIN
|
|||||||
CALL ARG_VAL(2) RETURNING clave
|
CALL ARG_VAL(2) RETURNING clave
|
||||||
|
|
||||||
CONNECT to "smarmotech" AS "MSSQL" USER usuarios USING clave
|
CONNECT to "smarmotech" AS "MSSQL" USER usuarios USING clave
|
||||||
CONNECT TO "marmotech" AS "IFMX" USER usuarios USING clave
|
-- Migracion Genero 6.0: se elimina la conexion IFMX (EXTERIOR).
|
||||||
|
-- La replicacion de iptb00020 a exterior.dbo.iptb00020 ahora la hace
|
||||||
|
-- un trigger en marmotech.dbo.iptb00020 (ver ipprmt005_trg_exterior.sql).
|
||||||
|
|
||||||
CALL ipprmt005()
|
CALL ipprmt005()
|
||||||
END MAIN
|
END MAIN
|
||||||
|
|
||||||
@@ -81,11 +83,8 @@ FUNCTION ippcad012()
|
|||||||
VALUES (p_iptb20.cod_n,p_iptb20.producto,usuarios,getdate(),p_iptb20.comentario,p_iptb20.genera_orden,p_iptb20.instalacion)
|
VALUES (p_iptb20.cod_n,p_iptb20.producto,usuarios,getdate(),p_iptb20.comentario,p_iptb20.genera_orden,p_iptb20.instalacion)
|
||||||
|
|
||||||
INSERT INTO iptb00035 (cod_n,cod_cat) VALUES (p_iptb20.cod_n,p_iptb20.cod_cat)
|
INSERT INTO iptb00035 (cod_n,cod_cat) VALUES (p_iptb20.cod_n,p_iptb20.cod_cat)
|
||||||
COMMIT WORK
|
COMMIT WORK
|
||||||
SET CONNECTION "IFMX"
|
-- La replica a EXTERIOR la realiza el trigger en iptb00020.
|
||||||
INSERT INTO iptb00020 (cod_n,producto,us_crea,fech_crea,instalacion) VALUES
|
|
||||||
(p_iptb20.cod_n,p_iptb20.producto,usuarios,getdate(),p_iptb20.instalacion)
|
|
||||||
|
|
||||||
LET numero_msg = 1
|
LET numero_msg = 1
|
||||||
CALL msg(numero_msg)
|
CALL msg(numero_msg)
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
@@ -230,16 +229,9 @@ SET CONNECTION "MSSQL"
|
|||||||
WHERE cod_n = p_iptb20.cod_n
|
WHERE cod_n = p_iptb20.cod_n
|
||||||
DELETE FROM iptb00035 WHERE cod_n = p_iptb20.cod_n
|
DELETE FROM iptb00035 WHERE cod_n = p_iptb20.cod_n
|
||||||
INSERT INTO iptb00035 (cod_cat,cod_n) VALUES (p_iptb20.cod_cat,p_iptb20.cod_n)
|
INSERT INTO iptb00035 (cod_cat,cod_n) VALUES (p_iptb20.cod_cat,p_iptb20.cod_n)
|
||||||
COMMIT WORK
|
COMMIT WORK
|
||||||
SET CONNECTION "IFMX"
|
-- La replica a EXTERIOR la realiza el trigger en iptb00020.
|
||||||
UPDATE iptb00020 SET producto = p_iptb20.producto,
|
LET numero_msg = 13
|
||||||
us_mod = usuarios,
|
|
||||||
fech_mod = getdate(),
|
|
||||||
instalacion = p_iptb20.instalacion
|
|
||||||
WHERE cod_n = p_iptb20.cod_n
|
|
||||||
|
|
||||||
SET CONNECTION "MSSQL"
|
|
||||||
LET numero_msg = 13
|
|
||||||
CALL msg(numero_msg)
|
CALL msg(numero_msg)
|
||||||
|
|
||||||
EXIT INPUT
|
EXIT INPUT
|
||||||
@@ -257,12 +249,7 @@ END INPUT
|
|||||||
fech_mod = GETDATE()
|
fech_mod = GETDATE()
|
||||||
WHERE cod_n = p_iptb20.cod_n
|
WHERE cod_n = p_iptb20.cod_n
|
||||||
|
|
||||||
SET CONNECTION "IFMX"
|
-- La replica del "borrado logico" a EXTERIOR la realiza el trigger.
|
||||||
UPDATE iptb00020 SET status_t = "E",
|
|
||||||
us_mod = usuarios
|
|
||||||
|
|
||||||
WHERE cod_n = p_iptb20.cod_n
|
|
||||||
|
|
||||||
LET numero_msg = 39
|
LET numero_msg = 39
|
||||||
CALL msg(numero_msg)
|
CALL msg(numero_msg)
|
||||||
ELSE
|
ELSE
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/* =====================================================================
|
||||||
|
TRIGGER DE REPLICACION iptb00020 (Grupos / Clases)
|
||||||
|
marmotech.dbo.iptb00020 ---> exterior.dbo.iptb00020
|
||||||
|
|
||||||
|
Motivo:
|
||||||
|
Migracion a Genero 6.0. El programa ipprmt005 abria una segunda
|
||||||
|
conexion "IFMX" (= base EXTERIOR en la misma instancia SQL Server)
|
||||||
|
para replicar manualmente cada INSERT/UPDATE de iptb00020.
|
||||||
|
Con Genero 6.0 + ODBC Driver 18 ese segundo CONNECT falla con
|
||||||
|
el error -6366 ("Changed database context to 'marmotech'").
|
||||||
|
|
||||||
|
Se elimino del fuente ipprmt005.4gl toda la logica "SET CONNECTION IFMX"
|
||||||
|
y esa replicacion la asume ahora este trigger, del lado del servidor.
|
||||||
|
|
||||||
|
Cobertura:
|
||||||
|
- ipprmt005.4gl es el UNICO programa del ERP que escribe iptb00020
|
||||||
|
(los demas solo la consultan), asi que el trigger reemplaza por
|
||||||
|
completo la replicacion sin riesgo de escrituras duplicadas.
|
||||||
|
|
||||||
|
Comportamiento (identico al del programa original):
|
||||||
|
- INSERT -> crea la fila en EXTERIOR.
|
||||||
|
- UPDATE -> sincroniza la fila en EXTERIOR (cubre tanto "Modificar"
|
||||||
|
como el "borrado logico" status_t='E').
|
||||||
|
- Cross-database directo (misma instancia, sin linked server).
|
||||||
|
- NO se maneja DELETE fisico: el ERP nunca borra fisicamente esta
|
||||||
|
tabla, solo marca status_t = 'E'.
|
||||||
|
|
||||||
|
Ambiente: probar primero en DESARROLLO (.40.9) antes de PRODUCCION (.40.8).
|
||||||
|
===================================================================== */
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------
|
||||||
|
PASO 0 (VERIFICACION - correr ANTES de crear el trigger)
|
||||||
|
Confirmar las columnas reales de EXTERIOR.dbo.iptb00020.
|
||||||
|
El esquema local (.sch) de ipdir esta viejo y NO lista 'instalacion',
|
||||||
|
pero el programa 3.20 si la escribia, por lo que deberia existir.
|
||||||
|
Si en el resultado NO aparece 'instalacion', elimine del trigger las
|
||||||
|
dos referencias a e.instalacion / i.instalacion antes de crearlo.
|
||||||
|
--------------------------------------------------------------------- */
|
||||||
|
-- SELECT c.name AS columna, t.name AS tipo, c.max_length, c.is_nullable
|
||||||
|
-- FROM exterior.sys.columns c
|
||||||
|
-- JOIN exterior.sys.types t ON t.user_type_id = c.user_type_id
|
||||||
|
-- WHERE c.object_id = OBJECT_ID('exterior.dbo.iptb00020')
|
||||||
|
-- ORDER BY c.column_id;
|
||||||
|
GO
|
||||||
|
|
||||||
|
USE marmotech;
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF OBJECT_ID('dbo.trg_iptb00020_repl_exterior', 'TR') IS NOT NULL
|
||||||
|
DROP TRIGGER dbo.trg_iptb00020_repl_exterior;
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TRIGGER dbo.trg_iptb00020_repl_exterior
|
||||||
|
ON dbo.iptb00020
|
||||||
|
AFTER INSERT, UPDATE
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON;
|
||||||
|
|
||||||
|
IF NOT EXISTS (SELECT 1 FROM inserted)
|
||||||
|
RETURN;
|
||||||
|
|
||||||
|
/* 1) Actualizar en EXTERIOR las filas que ya existen (por cod_n). */
|
||||||
|
UPDATE e
|
||||||
|
SET e.producto = i.producto,
|
||||||
|
e.status_t = i.status_t,
|
||||||
|
e.us_crea = i.us_crea,
|
||||||
|
e.fech_crea = i.fech_crea,
|
||||||
|
e.us_mod = i.us_mod,
|
||||||
|
e.fech_mod = i.fech_mod,
|
||||||
|
e.instalacion = i.instalacion
|
||||||
|
FROM exterior.dbo.iptb00020 e
|
||||||
|
INNER JOIN inserted i ON e.cod_n = i.cod_n;
|
||||||
|
|
||||||
|
/* 2) Insertar en EXTERIOR las filas que aun no existen. */
|
||||||
|
INSERT INTO exterior.dbo.iptb00020
|
||||||
|
(cod_n, producto, status_t, us_crea, fech_crea, us_mod, fech_mod, instalacion)
|
||||||
|
SELECT i.cod_n, i.producto, i.status_t, i.us_crea, i.fech_crea, i.us_mod, i.fech_mod, i.instalacion
|
||||||
|
FROM inserted i
|
||||||
|
WHERE NOT EXISTS (SELECT 1
|
||||||
|
FROM exterior.dbo.iptb00020 e
|
||||||
|
WHERE e.cod_n = i.cod_n);
|
||||||
|
END;
|
||||||
|
GO
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------
|
||||||
|
ROLLBACK (si hiciera falta revertir):
|
||||||
|
USE marmotech;
|
||||||
|
DROP TRIGGER dbo.trg_iptb00020_repl_exterior;
|
||||||
|
|
||||||
|
PRUEBA rapida (en DESARROLLO):
|
||||||
|
-- alta
|
||||||
|
INSERT INTO marmotech.dbo.iptb00020 (cod_n,producto,us_crea,fech_crea,instalacion)
|
||||||
|
VALUES (999999,'PRUEBA TRG', SUSER_SNAME(), GETDATE(), 1);
|
||||||
|
SELECT * FROM exterior.dbo.iptb00020 WHERE cod_n = 999999; -- debe aparecer
|
||||||
|
-- modificacion
|
||||||
|
UPDATE marmotech.dbo.iptb00020 SET producto='PRUEBA TRG MOD' WHERE cod_n=999999;
|
||||||
|
SELECT producto FROM exterior.dbo.iptb00020 WHERE cod_n = 999999; -- debe reflejar
|
||||||
|
-- borrado logico
|
||||||
|
UPDATE marmotech.dbo.iptb00020 SET status_t='E' WHERE cod_n=999999;
|
||||||
|
SELECT status_t FROM exterior.dbo.iptb00020 WHERE cod_n = 999999; -- debe ser 'E'
|
||||||
|
-- limpieza
|
||||||
|
DELETE FROM marmotech.dbo.iptb00020 WHERE cod_n=999999;
|
||||||
|
DELETE FROM exterior.dbo.iptb00020 WHERE cod_n=999999;
|
||||||
|
--------------------------------------------------------------------- */
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
RUBIO BLOND
|
|
||||||
|
|
||||||
okland 5 victorias
|
|
||||||
tampa bien los miercoles en toronto 7 de ultimos 8
|
|
||||||
Mine le va mal en interligas
|
|
||||||
atl le ha ganado 5 como favoritos
|
|
||||||
cinci le va bien en la ruta. Va Harvey.
|
|
||||||
|
|
||||||
LAD frente a derechos han perdido 10 de los untimos 14
|
|
||||||
Ariz ha perdido los ultimos juegos en la runta con los zurdos.
|
|
||||||
|
|
||||||
Sfo 10
|
|
||||||
|
|
||||||
LAAD 75
|
|
||||||
PHILIS 74
|
|
||||||
STL 73
|
|
||||||
PIT 72
|
|
||||||
KC 71
|
|
||||||
BOS 65
|
|
||||||
NYY 62
|
|
||||||
DET 61
|
|
||||||
|
|
||||||
|
|
||||||
MNE
|
|
||||||
SEATLE
|
|
||||||
WASH
|
|
||||||
|
|
||||||
WILLY PEREALTA 2 LOSS
|
|
||||||
HARVEY LANZANDO EN SU PATIO ES PELIGROSO
|
|
||||||
DE LA ROSA TIENE 7-4 FRENTE ARIZ
|
|
||||||
SMARTIZA 4-0 FRENTE A LOS PIT
|
|
||||||
|
|
||||||
|
|
||||||
+2
-1
@@ -506,6 +506,7 @@
|
|||||||
<Group id="1667448785" label="PRODUCTOS TERMINADOS">
|
<Group id="1667448785" label="PRODUCTOS TERMINADOS">
|
||||||
<Library binaryName="FORMULARIOS_IP" dependencies="-1026233879" id="-1826025351" label="FORMULARIOS_IP">
|
<Library binaryName="FORMULARIOS_IP" dependencies="-1026233879" id="-1826025351" label="FORMULARIOS_IP">
|
||||||
<File filePath="ipdir/ipfmmt003.4fd"/>
|
<File filePath="ipdir/ipfmmt003.4fd"/>
|
||||||
|
<File filePath="ipdir/ipfmmt005.per"/>
|
||||||
<File filePath="ipdir/ipfmmt020.4fd"/>
|
<File filePath="ipdir/ipfmmt020.4fd"/>
|
||||||
<File filePath="ipdir/ipfmmt021.4fd"/>
|
<File filePath="ipdir/ipfmmt021.4fd"/>
|
||||||
<File filePath="ipdir/ipfmmt013.4fd"/>
|
<File filePath="ipdir/ipfmmt013.4fd"/>
|
||||||
@@ -564,7 +565,7 @@
|
|||||||
<File compilerOptions="--build-rdd" filePath="ipdir/ipprmt013.4gl"/>
|
<File compilerOptions="--build-rdd" filePath="ipdir/ipprmt013.4gl"/>
|
||||||
</Application>
|
</Application>
|
||||||
<Application binaryName="ipprmt005" dependencies="1763548104,-1026233879,-764824792" externalDependencies="libgre.42x" id="-960000007" label="ipprmt005">
|
<Application binaryName="ipprmt005" dependencies="1763548104,-1026233879,-764824792" externalDependencies="libgre.42x" id="-960000007" label="ipprmt005">
|
||||||
<Configuration commandLineArguments="jpeguero Peguero2023" id="-961000007" label="Configuration"/>
|
<Configuration commandLineArguments="jsoto lmmjvsd2014" id="-961000007" label="Configuration"/>
|
||||||
<File compilerOptions="--build-rdd" filePath="ipdir/ipprmt005.4gl"/>
|
<File compilerOptions="--build-rdd" filePath="ipdir/ipprmt005.4gl"/>
|
||||||
</Application>
|
</Application>
|
||||||
<Application binaryName="ipprmt012" dependencies="1763548104,-1026233879,-764824792" externalDependencies="libgre.42x" id="-960000008" label="ipprmt012">
|
<Application binaryName="ipprmt012" dependencies="1763548104,-1026233879,-764824792" externalDependencies="libgre.42x" id="-960000008" label="ipprmt012">
|
||||||
|
|||||||
Reference in New Issue
Block a user