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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_GDM_DEFINE_ENTRY') CREATE INDEX IDX_MRP_GDM_DEFINE_ENTRY ON T_MRP_GDM_DEFINE_ENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_MRP_GROSSDEMAND_DEFINE', 'T_MRP_GROSSDEMAND_DEFINE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_GROSSDEMAND_DEFINE') CREATE INDEX IDX_MRP_GROSSDEMAND_DEFINE ON T_MRP_GROSSDEMAND_DEFINE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_MRP_GROSSDEMAND_DEFINE_L', 'T_MRP_GROSSDEMAND_DEFINE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_GROSSDEMAND_DEFINE_L') CREATE INDEX IDX_MRP_GROSSDEMAND_DEFINE_L ON T_MRP_GROSSDEMAND_DEFINE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_MRP_GROSSDEMAND_SOURCE', 'T_MRP_GROSSDEMAND_SOURCE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_GROSSDEMAND_SOURCE') CREATE INDEX IDX_MRP_GROSSDEMAND_SOURCE ON T_MRP_GROSSDEMAND_SOURCE ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_MRP_GROSSDEMAND_SOURCE_L', 'T_MRP_GROSSDEMAND_SOURCE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_GROSSDEMAND_SOURCE_L') CREATE INDEX IDX_MRP_GROSSDEMAND_SOURCE_L ON T_MRP_GROSSDEMAND_SOURCE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_MRP_PROSCHEDULE_ORDER', 'T_MRP_PROSCHEDULE_ORDER', 'FID', '1';

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



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