/**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_PLANPENTRY') 
 CREATE TABLE T_POM_PLANPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTYPENAME BIGINT DEFAULT 0 NOT NULL,
FELEMENTNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FELEMENTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDEMANDENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEMANDLOGO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDEMANDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFRUNCONDITION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFRUNCONDITION_TAG NCLOB,
FPENTRYFRUNCONDITIONDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_PLANPROGRAM') 
 CREATE TABLE T_POM_PLANPROGRAM (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPLANOUTLOOK INT DEFAULT 0 NOT NULL,
FDEMANDMODEL BIGINT DEFAULT 0 NOT NULL,
FAPPMODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCOMPUTEMODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTOFDATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDAY INT DEFAULT 0 NOT NULL,
FSUPPLYMODEL BIGINT DEFAULT 0 NOT NULL,
FSCOUTOFDATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSCDAY INT DEFAULT 0 NOT NULL,
FWATERLEVEL CHAR(1) DEFAULT '0' NOT NULL,
FMINPACK CHAR(1) DEFAULT '0' NOT NULL,
FSTOCKRESERVE CHAR(1) DEFAULT '0' NOT NULL,
FMRPSETUP BIGINT DEFAULT 0 NOT NULL,
FRELATIVETRANSFER BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_PLANPROORGENTRY') 
 CREATE TABLE T_POM_PLANPROORGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDEMANDORG BIGINT DEFAULT 0 NOT NULL,
FINVSTRATEGY BIGINT DEFAULT 0 NOT NULL,
FSUPPLYNET BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_PLANPROSCENTRY') 
 CREATE TABLE T_POM_PLANPROSCENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSUPPLYRES NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISSCMRPOPERAT CHAR(1) DEFAULT '0' NOT NULL,
FRESOURCEREGISTERS BIGINT DEFAULT 0 NOT NULL,
FSUPPLYPRIORITY INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_ALLOCATIONPLAN') 
 CREATE TABLE T_POM_ALLOCATIONPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) 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,
FOUTSTOCKORG BIGINT DEFAULT 0 NOT NULL,
FOUTWAREHOUSE BIGINT DEFAULT 0 NOT NULL,
FOUTLOCATION BIGINT DEFAULT 0 NOT NULL,
FINSTOCKORG BIGINT DEFAULT 0 NOT NULL,
FINWAREHOUSE BIGINT DEFAULT 0 NOT NULL,
FINLOCATION BIGINT DEFAULT 0 NOT NULL,
FMATERIELID BIGINT DEFAULT 0 NOT NULL,
FMATERIALUNITID BIGINT DEFAULT 0 NOT NULL,
FSTOCKUNITID BIGINT DEFAULT 0 NOT NULL,
FREQUESTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQUESTDATE DATETIME,
FALLOCATIONQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLDATE DATETIME,
FUPPERBILLID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FUPPERBILLID_TAG NCLOB,
FMPLANQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQUESTBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREQUESTAUXQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMPLANBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMPLANAUXQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPPLYMODE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FPUSHEDBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FALLOCBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUXUNITID BIGINT DEFAULT 0 NOT NULL,
FCLOSER BIGINT DEFAULT 0 NOT NULL,
FCLOSETIME DATETIME
);



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