/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_INVPLANINIT') 
 CREATE TABLE T_IM_INVPLANINIT (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FINITTYPE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FINITTEXT NVARCHAR(512) DEFAULT ' ' NOT NULL,
FINITSTATUS CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PLANORDER') 
 CREATE TABLE T_IM_PLANORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPROORPURORG BIGINT DEFAULT 0 NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FAUXPROPERTY BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL,
FORDERQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDROPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSURPLUSDROPQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE CHAR(1) DEFAULT 'A' NOT NULL,
FAVAILABLEDATE DATETIME,
FPLANPROGRAM BIGINT DEFAULT 0 NOT NULL,
FPLANOPERATENUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEMANDBILL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEMANDBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEMANDSEQ INT DEFAULT 0 NOT NULL,
FDEMANDBILLENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME
);


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



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