--毛需求定义,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_GROSSDEMAND_DEFINE' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_GROSSDEMAND_DEFINE ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_GROSSDEMAND_DEFINE' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_GROSSDEMAND_DEFINE ADD (FDISABLETIME DATETIME );

--报表方案定义,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_RPTSCHEME' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_RPTSCHEME ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_RPTSCHEME' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_RPTSCHEME ADD (FDISABLETIME DATETIME );

--采购预测方案定义,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DATESET' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_DATESET ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DATESET' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_DATESET ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DATESET' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_DATESET ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DATESET' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_DATESET ADD (FDISABLETIME DATETIME );

--排程方案定义,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_PLS_SCHEME ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_PLS_SCHEME ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_PLS_SCHEME ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_PLS_SCHEME ADD (FDISABLETIME DATETIME );

--计划调度方案定义,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANDISPATCH' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_PLANDISPATCH ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANDISPATCH' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_PLANDISPATCH ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANDISPATCH' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_PLANDISPATCH ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANDISPATCH' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_PLANDISPATCH ADD (FDISABLETIME DATETIME );
