/**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_IM_MDC_MFTREQBILLS') 
 CREATE TABLE T_IM_MDC_MFTREQBILLS (
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,
FBIZTIME DATETIME,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FDEPTID BIGINT DEFAULT 0 NOT NULL,
FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL,
FAPPLYUSERID BIGINT DEFAULT 0 NOT NULL,
FSETTLECURRENCY BIGINT DEFAULT 0 NOT NULL,
FBILLCRETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME,
FMATERIALTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FINVORG BIGINT DEFAULT 0 NOT NULL,
FCLOSERID BIGINT DEFAULT 0 NOT NULL,
FCLOSEDATE DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_MFTREQENTRY') 
 CREATE TABLE T_IM_MDC_MFTREQENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FAUDITQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NDID BIGINT DEFAULT 0 NOT NULL,
FMATERIALMASTERID BIGINT DEFAULT 0 NOT NULL,
FPRODUCEDATE DATETIME,
FEXPIRYDATE DATETIME,
FLOGISTICSBILL CHAR(1) DEFAULT '0' NOT NULL,
FMVERSION BIGINT DEFAULT 0 NOT NULL,
FSRCSYSBILLENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCSYSBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCSYSTEM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLINETYPEID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTRACKNUMBERID BIGINT DEFAULT 0 NOT NULL,
FCONFIGUREDCODEID BIGINT DEFAULT 0 NOT NULL,
FISSTOCKALLOT CHAR(1) DEFAULT '0' NOT NULL,
FOUTINVORG BIGINT DEFAULT 0 NOT NULL,
FOUTWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FOUTLOCATION BIGINT DEFAULT 0 NOT NULL,
FORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIGINTFIELD BIGINT DEFAULT 0 NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL,
FDEMANDDATE DATETIME,
FDOCTYPE BIGINT DEFAULT 0 NOT NULL,
FFILENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALGROUP BIGINT DEFAULT 0 NOT NULL,
FSUPPLYMODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FOUTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUSEOUTBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUSEOUTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSRCBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLID BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FWORKSTATION BIGINT DEFAULT 0 NOT NULL,
FROWSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIELMASTERID BIGINT DEFAULT 0 NOT NULL,
FREPLACEPLAN BIGINT DEFAULT 0 NOT NULL,
FPRIORITY BIGINT DEFAULT 0 NOT NULL,
FISMAINREPLACE CHAR(1) DEFAULT '0' NOT NULL,
FISREPLACE CHAR(1) DEFAULT '0' NOT NULL,
FAUDITBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSRCBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOUTBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FORDERENTRYSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDELIVERDATE DATETIME,
FFULLSIZE CHAR(1) DEFAULT '0' NOT NULL,
FWMSSSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL
);


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