/**Begin D:\PDM_UPGRADE\pdm1\INVLEVEL_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_INVLEVEL') 
 CREATE TABLE T_MSPLAN_INVLEVEL (
FID                  BIGINT               NOT NULL DEFAULT 0, 
FNUMBER              NVARCHAR(255)         NOT NULL DEFAULT ' ',
FSTATUS              NVARCHAR(30)         NOT NULL DEFAULT ' ',
FCREATORID           BIGINT               NOT NULL DEFAULT 0,
FMODIFIERID          BIGINT               NOT NULL DEFAULT 0,
FENABLE              NVARCHAR(30)         NOT NULL DEFAULT ' ',
FCREATETIME          DATETIME             NULL,
FMODIFYTIME          DATETIME             NULL,
FMASTERID            BIGINT               NOT NULL DEFAULT 0,
FCREATEORGID         BIGINT               NOT NULL DEFAULT 0,
FORGID               BIGINT               NOT NULL DEFAULT 0,
FCTRLSTRATEGY        NVARCHAR(30)         NOT NULL DEFAULT ' ',
FSOURCEDATAID        BIGINT               NOT NULL DEFAULT 0,
FBITINDEX            BIGINT               NOT NULL DEFAULT 0,
FSOURCEBITINDEX      BIGINT               NOT NULL DEFAULT 0,
FDIMENSION           BIGINT               NOT NULL DEFAULT 0,
FTYPE                NVARCHAR(30)         NOT NULL DEFAULT ' '
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_INVLEVEL_L') 
CREATE TABLE T_MSPLAN_INVLEVEL_L (
FPKID                NVARCHAR(36)         NOT NULL DEFAULT ' ',
FID                  BIGINT               NOT NULL DEFAULT 0,
FLOCALEID            NVARCHAR(10)         NOT NULL DEFAULT ' ',
FNAME                NVARCHAR(255)        NOT NULL DEFAULT ' '
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_INVLEVELENTRY') 
CREATE TABLE T_MSPLAN_INVLEVELENTRY (
FID                  BIGINT               NOT NULL DEFAULT 0,
FENTRYID             BIGINT               NOT NULL DEFAULT 0,
FSEQ                 INT                  NOT NULL DEFAULT 0,
FPLANTYPE            NVARCHAR(30)         NOT NULL DEFAULT ' ',
FVALUE               NVARCHAR(2000)       NOT NULL DEFAULT ' ',
FREORDER             DECIMAL(23,10)       NOT NULL DEFAULT 0,
FECOBATCH            DECIMAL(23,10)       NOT NULL DEFAULT 0,
FDAILYCONSUME        DECIMAL(23,10)       NOT NULL DEFAULT 0,
FSAFEINV             DECIMAL(23,10)       NOT NULL DEFAULT 0,
FMIN                 DECIMAL(23,10)       NOT NULL DEFAULT 0,
FMAX                 DECIMAL(23,10)       NOT NULL DEFAULT 0,
FMATERIALATTR        NVARCHAR(30)         NOT NULL DEFAULT ' ',
FOPERATOR            BIGINT               NOT NULL DEFAULT 0,
FRESERVEDTYPE        NVARCHAR(30)         NOT NULL DEFAULT ' ',
FYIELD               DECIMAL(23,10)       NOT NULL DEFAULT 0,
FWASTAGERATE         DECIMAL(23,10)       NOT NULL DEFAULT 0,
FWASTAGERATEFORMULA  NVARCHAR(30)         NOT NULL DEFAULT ' ',
FLEADTIME            BIGINT               NOT NULL DEFAULT 0,
FINSPECTIONLEADTIME  BIGINT               NOT NULL DEFAULT 0,
FPREPROCESSINGTIME   BIGINT               NOT NULL DEFAULT 0,
FPOSTPROCESSINGTIME  BIGINT               NOT NULL DEFAULT 0,
FPLANTAG             BIGINT               NOT NULL DEFAULT 0,
FDATESTART           DATETIME             NULL, 
FDATEEND             DATETIME             NULL
);


/**End D:\PDM_UPGRADE\pdm1\INVLEVEL_table.sql **/