/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROSTOCK') 
 CREATE TABLE T_POM_MROSTOCK (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FMFTDEPTORGID BIGINT DEFAULT 0 NOT NULL,
FBOMID BIGINT DEFAULT 0 NOT NULL,
FOMVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREPLACENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTRANSACTIONTYPEID BIGINT DEFAULT 0 NOT NULL,
FORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORDERID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMFTINQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMARKS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPROCESSROUTE BIGINT DEFAULT 0 NOT NULL,
FORDERIDNEW BIGINT DEFAULT 0 NOT NULL,
FORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBILLAUXUNIT BIGINT DEFAULT 0 NOT NULL,
FBILLAUXQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUXPROPERTY BIGINT DEFAULT 0 NOT NULL,
FISCHANGED CHAR(1) DEFAULT '0' NOT NULL,
FPRODUCTMASTERID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FTRACKNUMBERID BIGINT DEFAULT 0 NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FWORKCARDID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROSTOCKENTRY_L') 
 CREATE TABLE T_POM_MROSTOCKENTRY_L (
FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCHILDREMARKS NVARCHAR(250) DEFAULT ' ' NOT NULL,
FSETUPLOCATION NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROSTOCKENTRY') 
 CREATE TABLE T_POM_MROSTOCKENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALUNITID BIGINT DEFAULT 0 NOT NULL,
FBOMREVERSION BIGINT DEFAULT 0 NOT NULL,
FQTYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FUSERATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFIXSCRAP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEMANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTISSUEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNISSUEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCANNEGATIVE CHAR(1) DEFAULT '0' NOT NULL,
FCHILDBOMID BIGINT DEFAULT 0 NOT NULL,
FCHILDBOMVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCHILDAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL,
FSUPPLYMODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATION BIGINT DEFAULT 0 NOT NULL,
FOUTORGUNITID BIGINT DEFAULT 0 NOT NULL,
FOUTWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FISSUEMODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBACKFLUSHTIME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISKEYPART CHAR(1) DEFAULT '0' NOT NULL,
FOVERISSUECONTRL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSINHIGHLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXTRARATIOQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISSINLOWLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLACKRAITIOQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLEADTIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEMANDDATE DATETIME,
FREJECTEDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFEEDINGQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWIPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCANSENDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOPRNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FALLOTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTYNUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTYDENOMINATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISBACKFLUSH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWASTAGERATEFORMULA NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSTOCKALLOT CHAR(1) DEFAULT '0' NOT NULL,
FISBOMEXTEND CHAR(1) DEFAULT '0' NOT NULL,
FENTRYCHANGETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISBULKMATERIAL CHAR(1) DEFAULT '0' NOT NULL,
FWORKPLANID BIGINT DEFAULT 0 NOT NULL,
FREPLACEPLAN BIGINT DEFAULT 0 NOT NULL,
FPRIORITY BIGINT DEFAULT 0 NOT NULL,
FISMAINREPLACE CHAR(1) DEFAULT '0' NOT NULL,
FMATERIELMASTERID BIGINT DEFAULT 0 NOT NULL,
FOUTLOCATION BIGINT DEFAULT 0 NOT NULL,
FOUTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUSEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREWORK CHAR(1) DEFAULT '0' NOT NULL,
FENTRYCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FMATERIELINV BIGINT DEFAULT 0 NOT NULL,
FISSTEP CHAR(1) DEFAULT '0' NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSTOCKSOURCE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROPROJECTTASK') 
 CREATE TABLE T_POM_MROPROJECTTASK (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDER') 
 CREATE TABLE T_POM_MROORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTRANSACTIONTYPE BIGINT DEFAULT 0 NOT NULL,
FBILLDATE DATETIME,
FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL,
FBIZTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDERENTRY') 
 CREATE TABLE T_POM_MROORDERENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FPRODUCTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FPRODUCEDEPT BIGINT DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLANBEGINTIME DATETIME,
FPLANENDTIME DATETIME,
FBOMID BIGINT DEFAULT 0 NOT NULL,
FPROCESSROUTE BIGINT DEFAULT 0 NOT NULL,
FPLANSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FTASKSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FKITTINGSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FPICKSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINWARDEPT BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSE BIGINT DEFAULT 0 NOT NULL,
FLOCATION BIGINT DEFAULT 0 NOT NULL,
FPLANSURETIME DATETIME,
FTRANSMITTIME DATETIME,
FSTARTWORKTIME DATETIME,
FENDWORKTIME DATETIME,
FCLOSETIME DATETIME,
FSOURCEBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEENTRYSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FAUXPROPERTY BIGINT DEFAULT 0 NOT NULL,
FHEADBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBASEUNIT BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUXPTYUNIT BIGINT DEFAULT 0 NOT NULL,
FAUXPTYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMANFTECHSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIELMASTERID BIGINT DEFAULT 0 NOT NULL,
FPLANQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTRACKNUMBERID BIGINT DEFAULT 0 NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FPLANBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATERIELINV BIGINT DEFAULT 0 NOT NULL,
FBEGINBOOKDATE DATETIME,
FCLOSEBOOKDATE DATETIME,
FPRODUCTMODEL BIGINT DEFAULT 0 NOT NULL,
FCUSTOMERID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FWORKCARDID BIGINT DEFAULT 0 NOT NULL,
FWORKHOURUNITID BIGINT DEFAULT 0 NOT NULL,
FACTUALHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWORKCENTERID BIGINT DEFAULT 0 NOT NULL,
FWBSID BIGINT DEFAULT 0 NOT NULL,
FRESOURCESTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FPLANHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPROJECTTASKID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDERENTRY_E') 
 CREATE TABLE T_POM_MROORDERENTRY_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FEXPENDBOMTIME DATETIME,
FREPLACENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINWARCONSIGNER BIGINT DEFAULT 0 NOT NULL,
FISCONTROLQTY CHAR(1) DEFAULT '0' NOT NULL,
FOUTPUTOPERATION BIGINT DEFAULT 0 NOT NULL,
FQUALIFIEDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNQUALIFIEDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPAIRQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREWORKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPICKINGPAIRS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQUAINWAQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWAITCHECKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNQUAINWAQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRINWAQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPINWAQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENDCASETIME DATETIME,
FRPTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSTOCKQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FESTSCRAPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINWARMAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINWARMIN DECIMAL(23,10) DEFAULT 0 NOT NULL,
FYIELDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FROUTEREPLACE BIGINT DEFAULT 0 NOT NULL,
FRCVINHIGHLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRCVINLOWLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMTLCOSTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWORKWASTEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPORTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISINSPECTION CHAR(1) DEFAULT '0' NOT NULL,
FACCEPTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCONREPORTQTY CHAR(1) DEFAULT '0' NOT NULL,
FREPMAXQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPMAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPMINQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPMINRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMANUVERSION BIGINT DEFAULT 0 NOT NULL,
FPLANPREPARETIME DATETIME,
FSRCSPLITBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCSPLITBILLSEQ BIGINT DEFAULT 0 NOT NULL,
FQUALITYORG BIGINT DEFAULT 0 NOT NULL,
FMATERIALSPREAD CHAR(1) DEFAULT '1' NOT NULL
);



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