/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_IM_INVPLANINIT', 'T_IM_INVPLANINIT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_IM_INVPLANINIT_FORGID') CREATE INDEX IDX_T_IM_INVPLANINIT_FORGID ON T_IM_INVPLANINIT ( FORGID );


 EXEC P_ALTERPK 'PK_T_IM_PLANORDER', 'T_IM_PLANORDER', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_IM_PLANORDER_FPLANNUM') CREATE INDEX IDX_T_IM_PLANORDER_FPLANNUM ON T_IM_PLANORDER ( FPLANOPERATENUM );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_IM_PLANORDER_FMATERIAL') CREATE INDEX IDX_T_IM_PLANORDER_FMATERIAL ON T_IM_PLANORDER ( FMATERIAL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_IM_PLANORDER_TIMEORG') CREATE INDEX IDX_T_IM_PLANORDER_TIMEORG ON T_IM_PLANORDER ( FCREATETIME  DESC ,FPROORPURORG );


 EXEC P_ALTERPK 'PK_T_IM_PLANORDER_L', 'T_IM_PLANORDER_L', 'FPKID', '1';

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



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