-- 库存请检记录
-- 莫俊杰 2023.06.15
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLENTRY' AND KSQL_COL_NAME ='FINSPDEMANDBILLID') 
 ALTER TABLE T_IM_ADJUSTBILLENTRY ADD (FINSPDEMANDBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLENTRY' AND KSQL_COL_NAME ='FINSPDEMANDBILLENTRYID') 
 ALTER TABLE T_IM_ADJUSTBILLENTRY ADD (FINSPDEMANDBILLENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLSUBENTRY' AND KSQL_COL_NAME ='FSUBINSPDEMANDBILLID') 
 ALTER TABLE T_IM_ADJUSTBILLSUBENTRY ADD (FSUBINSPDEMANDBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLSUBENTRY' AND KSQL_COL_NAME ='FSUBINSPDEMANDBILLENTRYID') 
 ALTER TABLE T_IM_ADJUSTBILLSUBENTRY ADD (FSUBINSPDEMANDBILLENTRYID BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLENTRY' AND KSQL_COL_NAME ='FGROUPNUMBER') 
 ALTER TABLE T_IM_ADJUSTBILLENTRY ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL ); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLENTRY' AND KSQL_COL_NAME ='FGROUPSEQ') 
 ALTER TABLE T_IM_ADJUSTBILLENTRY ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL ); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLSUBENTRY' AND KSQL_COL_NAME ='FSUBGROUPNUMBER') 
 ALTER TABLE T_IM_ADJUSTBILLSUBENTRY ADD (FSUBGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL ); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILLSUBENTRY' AND KSQL_COL_NAME ='FSUBGROUPSEQ') 
 ALTER TABLE T_IM_ADJUSTBILLSUBENTRY ADD (FSUBGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL ); 
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FGROUPNUMBER') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL ); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FGROUPSEQ') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL ); 
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FQUALIFIEDWAREHOUSE') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FQUALIFIEDWAREHOUSE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FQUALIFIEDLOCATION') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FQUALIFIEDLOCATION BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALIFIEDWAREHOUSE') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALIFIEDWAREHOUSE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALIFIEDLOCATION') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALIFIEDLOCATION BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALIFIEDQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALIFIEDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALIFIEDBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALIFIEDBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FQUALIFIEDINVBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FQUALIFIEDINVBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FQUALIFIEDINVQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FQUALIFIEDINVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALIFIEDINVBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALIFIEDINVBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALIFIEDINVQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALIFIEDINVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FQUALREMAININVBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FQUALREMAININVBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FQUALREMAININVQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FQUALREMAININVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALREMAININVBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALREMAININVBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FUNQUALREMAININVQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FUNQUALREMAININVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FINSPECTDEMANDBILLID') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FINSPECTDEMANDBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FINSPECTDEMANDBILLENTRYID') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FINSPECTDEMANDBILLENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FTOTALINSPBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FTOTALINSPBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FTOTALINSPQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FTOTALINSPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FLEFTINSPBASEQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FLEFTINSPBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY' AND KSQL_COL_NAME ='FLEFTINSPQTY') 
 ALTER TABLE T_IM_INVINSPECTBILLENTRY ADD (FLEFTINSPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );


