-- 生产入库单和领料出库单增加成组号和成组行号字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PRODUCTINBILLENTRY' AND KSQL_COL_NAME ='FGROUPNUMBER')
ALTER TABLE T_IM_PRODUCTINBILLENTRY ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PRODUCTINBILLENTRY' AND KSQL_COL_NAME ='FGROUPSEQ')
ALTER TABLE T_IM_PRODUCTINBILLENTRY ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MREQOUTBILLENTRY' AND KSQL_COL_NAME ='FGROUPNUMBER')
ALTER TABLE T_IM_MREQOUTBILLENTRY ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MREQOUTBILLENTRY' AND KSQL_COL_NAME ='FGROUPSEQ')
ALTER TABLE T_IM_MREQOUTBILLENTRY ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL );