-- 新增存货分类索引
EXEC P_ALTERPK 'PK_BD_MATCATEGORY_GROUP', 'T_BD_MATCATEGORY_GROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_MATCATEGORY_GROUP' AND KSQL_INDNAME = 'IDX_BD_MATCAT_GROUP_NUM')
 CREATE INDEX IDX_BD_MATCAT_GROUP_NUM ON T_BD_MATCATEGORY_GROUP (FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_MATCATEGORY_GROUP' AND KSQL_INDNAME = 'IDX_BD_MATCAT_GROUP_NAM')
 CREATE INDEX IDX_BD_MATCAT_GROUP_NAM ON T_BD_MATCATEGORY_GROUP (FNAME );


-- 新增存货分类多语言表索引
EXEC P_ALTERPK 'PK_BD_MATCATEGORY_GROUP_L', 'T_BD_MATCATEGORY_GROUP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_MATCATEGORY_GROUP_L' AND KSQL_INDNAME = 'IDX_BD_MATCATEGORY_GROUP_LOCAL')
 CREATE INDEX IDX_BD_MATCATEGORY_GROUP_LOCAL ON T_BD_MATCATEGORY_GROUP_L (FID ,FLOCALEID );


-- 新增存货类别存货分类索引
  IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_BD_MATERIALCATEGORY' AND KSQL_INDNAME = 'IDX_BD_MATCAT_GRP')
 CREATE INDEX IDX_BD_MATCAT_GRP ON T_BD_MATERIALCATEGORY (FGROUP );