
--委外领料分录 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDCOM_MQBENTRY' AND KSQL_COL_NAME ='FTRACKNUMBERID') 
 ALTER TABLE T_IM_MDCOM_MQBENTRY ADD (FTRACKNUMBERID 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 ='FCONFIGUREDCODEID') 
 ALTER TABLE T_IM_MDCOM_MQBENTRY ADD (FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL);

--委外入库分录
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMCPBILLENTRY' AND KSQL_COL_NAME ='FTRACKNUMBERID') 
 ALTER TABLE T_IM_MDC_OMCPBILLENTRY ADD (FTRACKNUMBERID BIGINT DEFAULT 0 NOT NULL);
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMCPBILLENTRY' AND KSQL_COL_NAME ='FCONFIGUREDCODEID') 
 ALTER TABLE T_IM_MDC_OMCPBILLENTRY ADD (FCONFIGUREDCODEID 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 ='FTRACKNUMBERID') 
 ALTER TABLE T_IM_MDC_OMINBILLENTRY ADD (FTRACKNUMBERID 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 ='FCONFIGUREDCODEID') 
 ALTER TABLE T_IM_MDC_OMINBILLENTRY ADD (FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL);
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMCPBILLENTRY' AND KSQL_COL_NAME ='FNOUPDATEINVFIELDS') 
 ALTER TABLE T_IM_MDC_OMCPBILLENTRY ADD (FNOUPDATEINVFIELDS VARCHAR(100) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_OMINBILLENTRY' AND KSQL_COL_NAME ='FNOUPDATEINVFIELDS') 
 ALTER TABLE T_IM_MDC_OMINBILLENTRY ADD (FNOUPDATEINVFIELDS VARCHAR(100) DEFAULT ' ' NOT NULL );