/**Begin C:\Users\RD_jerry_wz_wang\Desktop\PDM_UPGRADE\pdm1\MRP_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_CPS_RESULTDATAS2') 
 CREATE TABLE T_MRP_CPS_RESULTDATAS2 (
FSTOCKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWAYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FSHORTAGEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATERIALATTR VARCHAR(10) DEFAULT ' ' NOT NULL,
FISMAINREPLACE CHAR(1) DEFAULT '0' NOT NULL,
FISREPLACE CHAR(1) DEFAULT '0' NOT NULL,
FREPLACEPRIORITY BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEF7 VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FREQUIREQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGINDEMANDDATE DATETIME,
FEXISTKEYPART CHAR(1) DEFAULT '0' NOT NULL,
FBILLROW NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREPLACEPLAN BIGINT DEFAULT 0 NOT NULL,
FCONFIGUREDCODE BIGINT DEFAULT 0 NOT NULL,
FREQUIREDATE DATETIME,
FBILLENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPPLYDATE DATETIME,
FTRACKNUMBER BIGINT DEFAULT 0 NOT NULL,
FAUXPTY BIGINT DEFAULT 0 NOT NULL,
FISKEYPART CHAR(1) DEFAULT '0' NOT NULL,
FSUPPLYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLANQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_CPS_RESULTDATAS1') 
 CREATE TABLE T_MRP_CPS_RESULTDATAS1 (
FCPSDATE DATETIME,
FID BIGINT DEFAULT 0 NOT NULL,
FBILLENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCONFIGUREDCODE BIGINT DEFAULT 0 NOT NULL,
FBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCANCPSQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBILLTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREQUIREORG BIGINT DEFAULT 0 NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FTRACKNUMBER BIGINT DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FORIGINDEMANDDATE DATETIME,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLROW NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FREQUIREDATE DATETIME,
FCPSQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FAUXPTY BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEF7 VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_CPS_RESULTDATAS') 
 CREATE TABLE T_MRP_CPS_RESULTDATAS (
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FRUNLOGNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATEDATE DATETIME,
FID BIGINT DEFAULT 0 NOT NULL
);



/**End C:\Users\RD_jerry_wz_wang\Desktop\PDM_UPGRADE\pdm1\MRP_table.sql **/
