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

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDPLAN_L', 'T_MRP_DEMANDPLAN_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDRECORD', 'T_MRP_DEMANDRECORD', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDRECORD_L', 'T_MRP_DEMANDRECORD_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_SUPPLYBILL_L', 'T_MRP_SUPPLYBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_SUPPLYORGTYPE_L', 'T_MRP_SUPPLYORGTYPE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_DEMANDPLANENTRY', 'T_MRP_DEMANDPLANENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_SUPPLYBILL', 'T_MRP_SUPPLYBILL', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_SUPPLYBILLENTRY', 'T_MRP_SUPPLYBILLENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_MRP_SUPPLYORGTYPE', 'T_MRP_SUPPLYORGTYPE', 'FID', '1';

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



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