/**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_MGSRCENTRY') 
 CREATE TABLE T_POM_MGSRCENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FPRODUCTID BIGINT DEFAULT 0 NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FTRACKNUMBERID BIGINT DEFAULT 0 NOT NULL,
FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUXPTYUNITID BIGINT DEFAULT 0 NOT NULL,
FAUXPTYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMANUVERSIONID BIGINT DEFAULT 0 NOT NULL,
FBOMID BIGINT DEFAULT 0 NOT NULL,
FPROCESSROUTEID BIGINT DEFAULT 0 NOT NULL,
FPLANPREPARETIME DATETIME,
FPLANBEGINTIME DATETIME,
FPLANENDTIME DATETIME,
FPRODUCTTYPE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FPRODUCEDEPTID BIGINT DEFAULT 0 NOT NULL,
FIPID BIGINT DEFAULT 0 NOT NULL,
FMATERIALSPREAD CHAR(1) DEFAULT ' ' NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEXPENDBOMTIME DATETIME,
FAUXPROPERTY BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FINWARDEPTID BIGINT DEFAULT 0 NOT NULL,
FINHLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINLLIMIT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISINSPECTION CHAR(1) DEFAULT ' ' NOT NULL,
FQUALITYORGID BIGINT DEFAULT 0 NOT NULL,
--FISCONRPTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FWORKCENTERID BIGINT DEFAULT 0 NOT NULL,
FYIELDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCONTROLQTY CHAR(1) DEFAULT ' ' NOT NULL,
FPLANSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL,
FTASKSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL,
FBIZSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL,
FMAPPINGID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORDERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MGSRCENTRY_E') 
 CREATE TABLE T_POM_MGSRCENTRY_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT 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,
FPLANQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLANBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBEGINBDT DATETIME,
FCLOSEBDT DATETIME,
FSPLITQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSPLITBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MGTARENTRY') 
 CREATE TABLE T_POM_MGTARENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
FPRODUCTTYPEMERGE NVARCHAR(5) DEFAULT ' ' NOT NULL,
FPRODUCTMERGEID BIGINT DEFAULT 0 NOT NULL,
FWORKCENTERMGID BIGINT DEFAULT 0 NOT NULL,
FUNITMERGEID BIGINT DEFAULT 0 NOT NULL,
FQTYMERGE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUNITMERGEID BIGINT DEFAULT 0 NOT NULL,
FAQTYMERGE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBOMMERGEID BIGINT DEFAULT 0 NOT NULL,
FPCESROUTEMERGEID BIGINT DEFAULT 0 NOT NULL,
FPLANPRETIMEMERGE DATETIME,
FPLANBGTIMEMERGE DATETIME,
FPLANENDTIMEMERGE DATETIME,
FINWARDEPTMERGEID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEMERGEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONMGID BIGINT DEFAULT 0 NOT NULL,
FPRODDEPTMERGEID BIGINT DEFAULT 0 NOT NULL,
FIPIDMERGE BIGINT DEFAULT 0 NOT NULL,
FMATERIALSPDMERGE CHAR(1) DEFAULT ' ' NOT NULL,
FLOTMERGEID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITMERGEID BIGINT DEFAULT 0 NOT NULL,
FBASEQTYMERGE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMVERSIONMERGEID BIGINT DEFAULT 0 NOT NULL,
FEXPDBOMTMERGE DATETIME,
FROUTEREPMERGEID BIGINT DEFAULT 0 NOT NULL,
FAUXPROMERGE BIGINT DEFAULT 0 NOT NULL,
FINHLIMITMERGE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINLLIMITMERGE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISINSPECTMERGE CHAR(1) DEFAULT ' ' NOT NULL,
FQUALITYORGMGID BIGINT DEFAULT 0 NOT NULL,
FISCONRPTQTYMERGE CHAR(1) DEFAULT '0' NOT NULL,
FCONFIGCODEMGID BIGINT DEFAULT 0 NOT NULL,
FTRACKNOMGID BIGINT DEFAULT 0 NOT NULL,
FYIELDRATEMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISCONTROLQTYMG CHAR(1) DEFAULT ' ' NOT NULL,
FBATCHNOMG NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPLANSTAMERGE NVARCHAR(1) DEFAULT ' ' NOT NULL,
FTASKSTAMERGE NVARCHAR(1) DEFAULT ' ' NOT NULL,
FBIZSTATUSMG NVARCHAR(1) DEFAULT ' ' NOT NULL,
FMAPPINGMGID NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MGTARENTRY_E') 
 CREATE TABLE T_POM_MGTARENTRY_E (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FREPMAXQTYMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPMAXRATEMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPMINQTYMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLANQTYMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPLANBASEQTYMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBEGINBDTMG DATETIME,
FCLOSEBDTMG DATETIME,
FSPLITQTYMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSPLITBASEQTYMG DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREPMINRATEMG DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_ORDERMERGE') 
 CREATE TABLE T_POM_ORDERMERGE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT '0' 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,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTRANSACTIONTYPEID BIGINT DEFAULT 0 NOT NULL
);

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