-- 委外领料加物料名称字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDCOM_MQBENTRY' AND KSQL_COL_NAME ='FMATERIALNAME')
 ALTER TABLE T_IM_MDCOM_MQBENTRY ADD (FMATERIALNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDCOM_MQBENTRY' AND KSQL_COL_NAME ='FLINETYPEID') 
 ALTER TABLE T_IM_MDCOM_MQBENTRY ADD (FLINETYPEID BIGINT DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDCOM_MQBENTRY' AND KSQL_COL_NAME ='FISREWORK')
 ALTER TABLE T_IM_MDCOM_MQBENTRY ADD (FISREWORK CHAR(1) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDCOM_MQBENTRY' AND KSQL_COL_NAME ='FPRODUCTID') 
 ALTER TABLE T_IM_MDCOM_MQBENTRY ADD (FPRODUCTID BIGINT DEFAULT 0 NOT NULL );
 
 --委外入库单增加物料名称字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMINBILLENTRY' AND KSQL_COL_NAME ='FMATERIALNAME')
 ALTER TABLE T_IM_MDC_OMINBILLENTRY ADD (FMATERIALNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMINBILLENTRY' AND KSQL_COL_NAME ='FLINETYPEID') 
 ALTER TABLE T_IM_MDC_OMINBILLENTRY ADD (FLINETYPEID BIGINT DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMINBILL' AND KSQL_COL_NAME ='FLASTUPDATEUSERID') 
 ALTER TABLE T_IM_MDC_OMINBILL ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
 
  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMINBILL' AND KSQL_COL_NAME ='FLASTUPDATETIME') 
 ALTER TABLE T_IM_MDC_OMINBILL ADD (FLASTUPDATETIME DATETIME);
 