-- 库存水位维度分录增加多语言表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_PLAN_DIMENTRY_L')
CREATE TABLE T_MSPLAN_PLAN_DIMENTRY_L (
    FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
    FENTRYID BIGINT DEFAULT 0 NOT NULL,
    FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
    FDIMENSIONNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);

EXEC P_ALTERPK 'PK_MSPLAN_PLAN_DIMENTRY_L', 'T_MSPLAN_PLAN_DIMENTRY_L', 'FPKID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANDIM_L_PK') CREATE INDEX IDX_MSPLAN_PLANDIM_L_PK ON T_MSPLAN_PLAN_DIMENTRY_L ( FENTRYID ,FLOCALEID );

-- 资源注册模型配置分录增加多语言表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_RSREGISTERENTRY_L')
CREATE TABLE T_MRP_RSREGISTERENTRY_L (
    FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
    FENTRYID BIGINT DEFAULT 0 NOT NULL,
    FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
    FSIGNNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FDATATYPE NVARCHAR(50) DEFAULT ' ' NOT NULL
);

EXEC P_ALTERPK 'PK_MRP_RSREGISTERENTRY_L', 'T_MRP_RSREGISTERENTRY_L', 'FPKID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_RSREGISTERENTRY_L_PK') CREATE INDEX IDX_MRP_RSREGISTERENTRY_L_PK ON T_MRP_RSREGISTERENTRY_L ( FENTRYID ,FLOCALEID );
