/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_MRP_STOCK_FCTENTRY', 'T_MRP_STOCK_FCTENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_STOCK_FCTENTRY') CREATE INDEX IDX_MRP_STOCK_FCTENTRY ON T_MRP_STOCK_FCTENTRY ( FMATERIALID );


 EXEC P_ALTERPK 'PK_T_MRP_STOCK_FORECAST', 'T_MRP_STOCK_FORECAST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_STOCK_FORECAST') CREATE INDEX IDX_MRP_STOCK_FORECAST ON T_MRP_STOCK_FORECAST ( FPLANNO );


 EXEC P_ALTERPK 'PK_T_MRP_PEGINFODATA', 'T_MRP_PEGINFODATA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PEGINFODATA') CREATE INDEX IDX_MRP_PEGINFODATA ON T_MRP_PEGINFODATA ( FBILLNO );


 EXEC P_ALTERPK 'PK_T_MRP_PEGINFODATAENTRY', 'T_MRP_PEGINFODATAENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PEGINFODATAENTRY') CREATE INDEX IDX_MRP_PEGINFODATAENTRY ON T_MRP_PEGINFODATAENTRY ( FID ,FPRODUCTFAMILYID ,FPRODUCTMODELID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PEGINFODATAENTRY1') CREATE INDEX IDX_MRP_PEGINFODATAENTRY1 ON T_MRP_PEGINFODATAENTRY ( FREQUIREBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_PEGINFODATAENTRY2') CREATE INDEX IDX_MRP_PEGINFODATAENTRY2 ON T_MRP_PEGINFODATAENTRY ( FREQUIREMATERIALID ,FSUPPLYMATERIALID );



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