/**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_MRQRESTRUCTSTOCKS') 
 CREATE TABLE T_POM_MRQRESTRUCTSTOCKS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMRQOPRNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQOPROPERATION BIGINT DEFAULT 0 NOT NULL,
FMRQOPRDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQOPRPARENT VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQPROCESSSEQNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQPROCESSSEQTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQMFTMATERIAL BIGINT DEFAULT 0 NOT NULL,
FMRQMATERIAL BIGINT DEFAULT 0 NOT NULL,
FMRQQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMRQDEMANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMRQWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FMRQSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FMRQISSUEMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQCONFIGUREDCODE BIGINT DEFAULT 0 NOT NULL,
FMRQQTYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQBOMID VARCHAR(255) DEFAULT ' ' NOT NULL,
FMRQBOMENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FMRQQTYNUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMRQQTYDENOMINATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMRQUSERATIO DECIMAL(23,2) DEFAULT 0 NOT NULL,
FMRQFIXSCRAP DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMRQSCRAPRATE DECIMAL(23,4) DEFAULT 0 NOT NULL,
FMRQPROCESSSEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQSUPPLYMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMRQSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FMRQAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_RESTRUCTURBILL') 
 CREATE TABLE T_POM_RESTRUCTURBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(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,
FBILLDATE DATETIME,
FREASON VARCHAR(255) DEFAULT ' ' NOT NULL,
FRESTRUCTURTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FPRODUCTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FREQUESTERID BIGINT DEFAULT 0 NOT NULL,
FISRESTRUCTURED CHAR(1) DEFAULT '0' NOT NULL,
FISRETURNED CHAR(1) DEFAULT '0' NOT NULL,
FISSCRAPPED CHAR(1) DEFAULT '0' NOT NULL,
FPBMFTMATERIALID BIGINT DEFAULT 0 NOT NULL,
FPBMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FMODEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FPBUNITID BIGINT DEFAULT 0 NOT NULL,
FPBCONFIGUREDCODE BIGINT DEFAULT 0 NOT NULL,
FPBTRACKNUMBER BIGINT DEFAULT 0 NOT NULL,
FPBPRODUCEDEPT BIGINT DEFAULT 0 NOT NULL,
FPBQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPBMANUVERSION BIGINT DEFAULT 0 NOT NULL,
FPBPROCESSROUTE BIGINT DEFAULT 0 NOT NULL,
FPBTRANSACTIONTYPE BIGINT DEFAULT 0 NOT NULL,
FPBRESTRUCTURQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPBCANRESTRUCTURQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPBORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPBORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FORDERNUMBER1 VARCHAR(50) DEFAULT ' ' NOT NULL,
FPBORDERNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAMFTMATERIALID BIGINT DEFAULT 0 NOT NULL,
FPAMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAME1 VARCHAR(50) DEFAULT ' ' NOT NULL,
FMODEL1 VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAUNITID BIGINT DEFAULT 0 NOT NULL,
FPACONFIGUREDCODE BIGINT DEFAULT 0 NOT NULL,
FPATRACKNUMBER BIGINT DEFAULT 0 NOT NULL,
FPAPRODUCEDEPT BIGINT DEFAULT 0 NOT NULL,
FPABOMID BIGINT DEFAULT 0 NOT NULL,
FBOMVERSION2 VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAMANUVERSION BIGINT DEFAULT 0 NOT NULL,
FPAPROCESSROUTE BIGINT DEFAULT 0 NOT NULL,
FPATRANSACTIONTYPE BIGINT DEFAULT 0 NOT NULL,
FPARESTRUCTURQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPAWORKCENTERID BIGINT DEFAULT 0 NOT NULL,
FPAPLANBEGINTIME DATETIME,
FPAPLANENDTIME DATETIME,
FPADEALSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FPADEALRESULT VARCHAR(255) DEFAULT ' ' NOT NULL,
FPAPLANPREPARETIME DATETIME,
FPABIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FPBBOMID BIGINT DEFAULT 0 NOT NULL,
FPAAUXPROPERTY BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_RETRESTRUCTSTOCKS') 
 CREATE TABLE T_POM_RETRESTRUCTSTOCKS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FRETMFTMATERIALID BIGINT DEFAULT 0 NOT NULL,
FRETCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FRETOPRNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETUNITID BIGINT DEFAULT 0 NOT NULL,
FRETOPROPERATION BIGINT DEFAULT 0 NOT NULL,
FRETOPRDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETOPRPARENT VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETPROCESSSEQNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETPROCESSSEQTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FRETSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FRETISSUEMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETQTYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETMATERIALID BIGINT DEFAULT 0 NOT NULL,
FRETCANRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETTHISRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETDEMANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETMFTECHNICSID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETMFTECHNICSENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETSTOCKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETSTOCKENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETBOMID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETBOMENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALMODEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETMATERIALUNITID BIGINT DEFAULT 0 NOT NULL,
FRETQTYNUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETQTYDENOMINATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETRECEIVEDBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETPLANRETURNBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETSUPPLYMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FRETLOCATION BIGINT DEFAULT 0 NOT NULL,
FRETAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_SCRAPRESTRUCTSTOCKS') 
 CREATE TABLE T_POM_SCRAPRESTRUCTSTOCKS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSCRAPOPRNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPOPROPERATION BIGINT DEFAULT 0 NOT NULL,
FSCRAPOPRDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPOPRPARENT VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPPROCESSSEQNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPPROCESSSEQTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPMFTMATERIAL BIGINT DEFAULT 0 NOT NULL,
FSCRAPMATERIAL BIGINT DEFAULT 0 NOT NULL,
FSCRAPCANWASTEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPTHISWASTEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPUNITID BIGINT DEFAULT 0 NOT NULL,
FSCRAPDEMANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FSCRAPSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FSCRAPISSUEMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPCONFIGUREDCODE BIGINT DEFAULT 0 NOT NULL,
FSCRAPQTYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPMFTECHNICSID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPMFTECHNICSENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPSTOCKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPSTOCKENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPBOMID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPBOMENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALMODEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPMATERIALUNIT BIGINT DEFAULT 0 NOT NULL,
FSCRAPQTYNUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPQTYDENOMINATOR DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPRECEIVEDBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPPLANRETURNBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCRAPSUPPLYMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSCRAPSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FSCRAPAUXPROPERTYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_SRCRESTRUCTOPENTRY') 
 CREATE TABLE T_POM_SRCRESTRUCTOPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSRCOPRPARENT VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCOPRNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCOPROPERATIONID BIGINT DEFAULT 0 NOT NULL,
FSRCOPRDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCOPRSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCOPRQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSRCCHANGETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCOPRUNITID BIGINT DEFAULT 0 NOT NULL,
FSRCCHANGEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSRCMFTECHNICSENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCORDERENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCMFTECHNICSID VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCPROCESSSEQNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCPROCESSSEQTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPRTOTALREPORTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_TORESTRUCTOPENTRY') 
 CREATE TABLE T_POM_TORESTRUCTOPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTOCHANGETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOOPRNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOOPRUNIT BIGINT DEFAULT 0 NOT NULL,
FTOOPROPERATION BIGINT DEFAULT 0 NOT NULL,
FTOOPRDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOOPRPARENT VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOMACHININGTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOOPRORG BIGINT DEFAULT 0 NOT NULL,
FTOOPRWORKCENTER BIGINT DEFAULT 0 NOT NULL,
FTOOPRCTRLSTRATEGY BIGINT DEFAULT 0 NOT NULL,
FTOPROCESSSEQNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOPROCESSSEQTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTOOPRWORKSHOPID BIGINT DEFAULT 0 NOT NULL,
FTOSTORAGEPOINT CHAR(1) DEFAULT '0' NOT NULL,
FTOINSPECTIONTYPE VARCHAR(50) DEFAULT ' ' NOT NULL
);

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