/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_RATIVEORDER') 
 CREATE TABLE T_MRP_RATIVEORDER (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FAUDITDATE DATETIME,
FDEMANDDATE DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FMATERIELID BIGINT DEFAULT 0 NOT NULL,
FDEMANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBOMVERSION BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE VARCHAR(60) DEFAULT ' ' NOT NULL,
FPLANPROGRAM BIGINT DEFAULT 0 NOT NULL,
FPLANOPERATENUM VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALDETAILENTRY' AND KSQL_COL_NAME ='FDEMANDBILLF7') 
 ALTER TABLE T_MRP_CALDETAILENTRY ADD (FDEMANDBILLF7 NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALDETAILENTRY' AND KSQL_COL_NAME ='FSUPPLYBILLF7') 
 ALTER TABLE T_MRP_CALDETAILENTRY ADD (FSUPPLYBILLF7 NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_CALDETAILENTRY' AND KSQL_COL_NAME ='FBOMVERSION') 
 ALTER TABLE T_MRP_CALDETAILENTRY ADD (FBOMVERSION BIGINT DEFAULT 0 NOT NULL );

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