/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FMM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PDM_ROUTE') 
 CREATE TABLE T_PDM_ROUTE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY VARCHAR(100) DEFAULT ' ' NOT NULL,
FVERSIONID BIGINT DEFAULT 0 NOT NULL,
FISMAINPROCESS CHAR(1) DEFAULT ' ' NOT NULL,
FPROCESSTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FMATERIALGROUPID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FBOMVERSIONID BIGINT DEFAULT 0 NOT NULL,
FREMARK VARCHAR(255) DEFAULT ' ' NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FCANCELERID BIGINT DEFAULT 0 NOT NULL,
FAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL,
FAUDITTIME DATETIME,
FCANCELTIME DATETIME,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FROUTEREPLACE BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PDM_ROUTEACTIVE') 
 CREATE TABLE T_PDM_ROUTEACTIVE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FACTIVITYID BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTANDARDFORMULAID BIGINT DEFAULT 0 NOT NULL,
FMINFORMULAID BIGINT DEFAULT 0 NOT NULL,
FSTANDARDFORMULA1ID BIGINT DEFAULT 0 NOT NULL,
FMINFORMULA1ID BIGINT DEFAULT 0 NOT NULL,
FPROCESSNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATIONNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FPROCESSSTAGE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PDM_ROUTEOPERATION') 
 CREATE TABLE T_PDM_ROUTEOPERATION (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FOPERATIONNO VARCHAR(100) DEFAULT ' ' NOT NULL,
FPRODUCTIONORGID BIGINT DEFAULT 0 NOT NULL,
FWORKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPRODUCTIONWORKSHOPID BIGINT DEFAULT 0 NOT NULL,
FOPERATIONID BIGINT DEFAULT 0 NOT NULL,
FOPRCTRLSTRATEGY VARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK VARCHAR(255) DEFAULT ' ' NOT NULL,
FPARENTID VARCHAR(100) DEFAULT ' ' NOT NULL,
FHEADUNITID BIGINT DEFAULT 0 NOT NULL,
FOPERATIONUNITID BIGINT DEFAULT 0 NOT NULL,
FUPPERRATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFLOORRATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHEADQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOPERATIONQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEBATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSPLIT CHAR(1) DEFAULT ' ' NOT NULL,
FSPLITQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMINWORKTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTIMEUNIT CHAR(1) DEFAULT ' ' NOT NULL,
FISPROCESSOVERLAP CHAR(1) DEFAULT ' ' NOT NULL,
FMINOVERLAPTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOVERLAPTIMEUNIT CHAR(1) DEFAULT ' ' NOT NULL,
FOVERLAPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOVERLAPUNITID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PDM_ROUTEOPERATION_E') 
 CREATE TABLE T_PDM_ROUTEOPERATION_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FPURCHASEGROUPID BIGINT DEFAULT 0 NOT NULL,
FPURCHASEPERSONID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYFIELD BIGINT DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE BIGINT DEFAULT 0 NOT NULL,
FMACHININGTYPE CHAR(4) DEFAULT ' ' NOT NULL,
FPURCHASEORGID BIGINT DEFAULT 0 NOT NULL,
FSETTLEMENTUNITID BIGINT DEFAULT 0 NOT NULL,
FSETTLEMENTCOEFFICIENT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENTRYMATERIALID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PDM_ROUTEPROCESS') 
 CREATE TABLE T_PDM_ROUTEPROCESS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPROCESSSEQNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FPROCESSSEQTYPE CHAR(1) DEFAULT ' ' NOT NULL,
FPROCESSSEQREMARK VARCHAR(255) DEFAULT ' ' NOT NULL,
FPROCESSSEQ VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PDM_ROUTERELATION') 
 CREATE TABLE T_PDM_ROUTERELATION (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSEQRELATIONNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSEQRELATIONSEQ VARCHAR(100) DEFAULT ' ' NOT NULL,
FSEQRELATIONPARSEQ VARCHAR(100) DEFAULT ' ' NOT NULL,
FSEQRELATIONPARNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FTURNOUTPROCESSNO VARCHAR(100) DEFAULT ' ' NOT NULL,
FTURNOUTPROCESSNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FTRANSFERPROCESSNO VARCHAR(100) DEFAULT ' ' NOT NULL,
FTRANSFERPROCESSNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FPARALLELRATION CHAR(1) DEFAULT ' ' NOT NULL
);


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



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