--业务方案配置,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BUSINESSPLAN' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_BUSINESSPLAN ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BUSINESSPLAN' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_BUSINESSPLAN ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BUSINESSPLAN' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_BUSINESSPLAN ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BUSINESSPLAN' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_BUSINESSPLAN ADD (FDISABLETIME DATETIME );

--计算方案配置,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALPLANCONFIG' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_CALPLANCONFIG ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALPLANCONFIG' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_CALPLANCONFIG ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALPLANCONFIG' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_CALPLANCONFIG ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALPLANCONFIG' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_CALPLANCONFIG ADD (FDISABLETIME DATETIME );

--算法注册配置,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_ALGOREGISTER' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_ALGOREGISTER ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_ALGOREGISTER' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_ALGOREGISTER ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_ALGOREGISTER' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_ALGOREGISTER ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_ALGOREGISTER' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_ALGOREGISTER ADD (FDISABLETIME DATETIME );

--资源注册审核人,审核时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_RSREGISTER' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_RSREGISTER ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_RSREGISTER' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_RSREGISTER ADD (FAUDITTIME DATETIME );

--实体字段映射定义,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BFTRANSFER' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_BFTRANSFER ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BFTRANSFER' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_BFTRANSFER ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BFTRANSFER' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_BFTRANSFER ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BFTRANSFER' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_BFTRANSFER ADD (FDISABLETIME DATETIME );

--计划订单投放配置,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_DROPCONFIGURE' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MSPLAN_DROPCONFIGURE ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_DROPCONFIGURE' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MSPLAN_DROPCONFIGURE ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_DROPCONFIGURE' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_DROPCONFIGURE ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_DROPCONFIGURE' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_DROPCONFIGURE ADD (FDISABLETIME DATETIME );

--调整建议释放配置,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_ADJUSTSUG_REL' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_ADJUSTSUG_REL ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_ADJUSTSUG_REL' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_ADJUSTSUG_REL ADD (FDISABLETIME DATETIME );

--净改变服务配置,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_RESERVECFG' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_RESERVECFG ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_RESERVECFG' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_RESERVECFG ADD (FDISABLETIME DATETIME );

--弹性维度定义,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_FLEXMETRICDEFINE' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_FLEXMETRICDEFINE ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_FLEXMETRICDEFINE' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_FLEXMETRICDEFINE ADD (FDISABLETIME DATETIME );

--三品转化率,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_WASTERATIO' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_WASTERATIO ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_WASTERATIO' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_WASTERATIO ADD (FDISABLETIME DATETIME );

--库存供应策略,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_STOCKSUPPLY' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_STOCKSUPPLY ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_STOCKSUPPLY' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_STOCKSUPPLY ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_STOCKSUPPLY' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_STOCKSUPPLY ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_STOCKSUPPLY' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_STOCKSUPPLY ADD (FDISABLETIME DATETIME );

--多组织供需关系,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_MULTIORGSUPDEM' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_MULTIORGSUPDEM ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_MULTIORGSUPDEM' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_MULTIORGSUPDEM ADD (FDISABLETIME DATETIME );

--需求优先级类型定义,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PRIORITY' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MRP_PRIORITY ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PRIORITY' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MRP_PRIORITY ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PRIORITY' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_PRIORITY ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PRIORITY' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_PRIORITY ADD (FDISABLETIME DATETIME );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIORITY' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MSPLAN_PRIORITY ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIORITY' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MSPLAN_PRIORITY ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIORITY' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_PRIORITY ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIORITY' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_PRIORITY ADD (FDISABLETIME DATETIME );

--需求优先级定义,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PDEFINE' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MSPLAN_PDEFINE ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PDEFINE' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MSPLAN_PDEFINE ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PDEFINE' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_PDEFINE ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PDEFINE' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_PDEFINE ADD (FDISABLETIME DATETIME );

--需求优先级模型配置,审核人,审核时间,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIMODEL' AND KSQL_COL_NAME ='FAUDITORID')
ALTER TABLE T_MSPLAN_PRIMODEL ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIMODEL' AND KSQL_COL_NAME ='FAUDITTIME')
ALTER TABLE T_MSPLAN_PRIMODEL ADD (FAUDITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIMODEL' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_PRIMODEL ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PRIMODEL' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_PRIMODEL ADD (FDISABLETIME DATETIME );

--计划范围定义,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PLANSCOPE' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_PLANSCOPE ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PLANSCOPE' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_PLANSCOPE ADD (FDISABLETIME DATETIME );

--计划范围仓库定义,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PLANSCOPE_WHS' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_PLANSCOPE_WHS ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_PLANSCOPE_WHS' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_PLANSCOPE_WHS ADD (FDISABLETIME DATETIME );

--物料与计划范围关系表维护,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_MATPLASCO' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MSPLAN_MATPLASCO ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_MATPLASCO' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MSPLAN_MATPLASCO ADD (FDISABLETIME DATETIME );

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

--物料与计划范围关系表维护,禁用人,禁用时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_RSREGISTER' AND KSQL_COL_NAME ='FDISABLEORID')
ALTER TABLE T_MRP_RSREGISTER ADD (FDISABLEORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_RSREGISTER' AND KSQL_COL_NAME ='FDISABLETIME')
ALTER TABLE T_MRP_RSREGISTER ADD (FDISABLETIME DATETIME );



