-- 新增存货分类表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_MATCATEGORY_GROUP')
CREATE TABLE T_BD_MATCATEGORY_GROUP (
                                        FID BIGINT DEFAULT 0 NOT NULL,
                                        FNUMBER VARCHAR(255) DEFAULT ' ' NOT NULL,
                                        FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                        FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                        FENABLE CHAR(1) DEFAULT '0' NOT NULL,
                                        FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
                                        FMASTERID BIGINT DEFAULT 0 NOT NULL
);



-- 新增存货分类多语言表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_MATCATEGORY_GROUP_L')
CREATE TABLE T_BD_MATCATEGORY_GROUP_L (
                                          FPKID VARCHAR(36) NOT NULL,
                                          FID BIGINT DEFAULT 0 NOT NULL,
                                          FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
                                          FNAME VARCHAR(255) DEFAULT ' ' NOT NULL,
                                          FREMARK VARCHAR(255) DEFAULT ' ' NOT NULL
);

-- 存货类别增加 存货分类 字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIALCATEGORY' AND KSQL_COL_NAME ='FGROUP')
ALTER TABLE T_BD_MATERIALCATEGORY ADD (FGROUP BIGINT DEFAULT 0 NOT NULL );