/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLS_SCHEME') 
 CREATE TABLE T_MRP_PLS_SCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FENABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCYCLE BIGINT DEFAULT 0 NOT NULL,
FWORKSHIFTID BIGINT DEFAULT 0 NOT NULL,
FORDERMODELID BIGINT DEFAULT 0 NOT NULL,
FMAPPING NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMAPPING_TAG NCLOB
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLSCRSUBENTRY') 
 CREATE TABLE T_MRP_PLSCRSUBENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FISPARTINCALC CHAR(1) DEFAULT '0' NOT NULL,
FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALGROUPID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FABILITYGROUPID BIGINT DEFAULT 0 NOT NULL,
FABILITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXPRESSION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FWORKSTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWORKUNITS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRECISION BIGINT DEFAULT 0 NOT NULL,
FCOMPLETERESULT NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLSFCSUBENTRY') 
 CREATE TABLE T_MRP_PLSFCSUBENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALGROUPID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FABILITYGROUPID BIGINT DEFAULT 0 NOT NULL,
FABILITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FABILITYVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEFFICIENCY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FADDEFFICIENCY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLSMATENTRY') 
 CREATE TABLE T_MRP_PLSMATENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALGROUPID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLSSRCENTRY') 
 CREATE TABLE T_MRP_PLSSRCENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FISPARTINCALC CHAR(1) DEFAULT '0' NOT NULL,
FSRCENTITYID NVARCHAR(26) DEFAULT ' ' NOT NULL,
FDATASOUREID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLSWCENTRY') 
 CREATE TABLE T_MRP_PLSWCENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FWORKCENTERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLSWCSUBENTRY') 
 CREATE TABLE T_MRP_PLSWCSUBENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FWORKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPRIORITY BIGINT DEFAULT 0 NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_table.sql **/
