/**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_PLANORDERENTRY') 
 CREATE TABLE T_MRP_PLANORDERENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FVERSIONID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTYTYPE VARCHAR(60) DEFAULT ' ' NOT NULL,
FQTYNUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTYDENOMINATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQUIREQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQUIREDATE DATETIME,
FFIXSCRAP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOSSQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPPLYTYPE VARCHAR(60) DEFAULT ' ' NOT NULL,
FSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FBOMID BIGINT DEFAULT 0 NOT NULL,
FBOMENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLANORDER') 
 CREATE TABLE T_MRP_PLANORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FAUDITDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPROORPURORG BIGINT DEFAULT 0 NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FORDERTYPE NVARCHAR(60) DEFAULT ' ' NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORDERQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDROPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYIELD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FENDPROQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBOM BIGINT DEFAULT 0 NOT NULL,
FUNFOLDBOMDATE DATETIME,
FECNVERSION BIGINT DEFAULT 0 NOT NULL,
FPLANPERSONID BIGINT DEFAULT 0 NOT NULL,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FAVAILABLEDATE DATETIME,
FDATASOURCE VARCHAR(60) DEFAULT ' ' NOT NULL,
FPLANPROGRAM BIGINT DEFAULT 0 NOT NULL,
FPLANOPERATENUM VARCHAR(100) DEFAULT ' ' NOT NULL,
FMATERIALATTR VARCHAR(60) DEFAULT ' ' NOT NULL
);


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