/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_MRP_BILLFIELDTRANSFER', 'T_MRP_BILLFIELDTRANSFER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_BILLFIELDTRANSFER') CREATE INDEX IDX_MRP_BILLFIELDTRANSFER ON T_MRP_BILLFIELDTRANSFER ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_BILLFIELDTRANSFER_L', 'T_MRP_BILLFIELDTRANSFER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_BILLTRANFERENTRY', 'T_MRP_BILLTRANFERENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_INDEXCONFIG', 'T_MRP_INDEXCONFIG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_INDEXCONFIG_L', 'T_MRP_INDEXCONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_MATERIALSETUP', 'T_MRP_MATERIALSETUP', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_RESOUCEREGISSTER_L', 'T_MRP_RESOUCEREGISSTER_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_RESOURCEREGISTER', 'T_MRP_RESOURCEREGISTER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_RESOURCEREGISTER') CREATE INDEX IDX_MRP_RESOURCEREGISTER ON T_MRP_RESOURCEREGISTER ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_RSDATACONFIG', 'T_MRP_RSDATACONFIG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_RSDATACONFIG') CREATE INDEX IDX_MRP_RSDATACONFIG ON T_MRP_RSDATACONFIG ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_RSDATACONFIG_L', 'T_MRP_RSDATACONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_RSREGISTERENTRY', 'T_MRP_RSREGISTERENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STOCKSETUP', 'T_MRP_STOCKSETUP', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STOCKSORGENTRY', 'T_MRP_STOCKSORGENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STOCKSUPPLY', 'T_MRP_STOCKSUPPLY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_STOCKSUPPLY') CREATE INDEX IDX_MRP_STOCKSUPPLY ON T_MRP_STOCKSUPPLY ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_STOCKSUPPLY_L', 'T_MRP_STOCKSUPPLY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STOCKTYPEENTRY', 'T_MRP_STOCKTYPEENTRY', 'FENTRYID', '1';

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






 EXEC P_ALTERPK 'PK_T_MRP_DEFINITIONSUPPLY', 'T_MRP_DEFINITIONSUPPLY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MRP_DEFINITIONSUPPLY') CREATE INDEX IDX_MRP_DEFINITIONSUPPLY ON T_MRP_DEFINITIONSUPPLY ( FNUMBER ,FCREATEORGID );


 EXEC P_ALTERPK 'PK_T_MRP_DEFINITIONSUPPLY_L', 'T_MRP_DEFINITIONSUPPLY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_STOCKSTATUS', 'T_MRP_STOCKSTATUS', 'FENTRYID', '1';

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




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