| Quintiq file version 2.0 | 
| #parent: #root | 
| Method UpdateTypeIndex ( | 
|   String stockingpointid | 
| ) | 
| { | 
|   Description: 'Update stocking point TypeIndex and linked instances.' | 
|   TextBody: | 
|   [* | 
|     // Update stocking point TypeIndex and linked instances only if the new ID is not the same as the old ID | 
|     if( stockingpointid <> this.ID() ) | 
|     { | 
|       // Update type index of all related StockingPointInPeriod | 
|       traverse( this, StockingPointInPeriod, spip ) | 
|       { | 
|         spip.UpdateTypeIndex( stockingpointid, spip.Start(), spip.End() ); | 
|       } | 
|      | 
|       // Update type index of all related ProductInStockingPoint_MP | 
|       traverse( this, ProductInStockingPoint_MP, pisp ) | 
|       { | 
|         pisp.UpdateTypeIndex( pisp.ProductID(), stockingpointid ); | 
|       } | 
|      | 
|       // Update foreign key of all related StockingPointCost | 
|       traverse( this, StockingPointCost, spcost ) | 
|       { | 
|         spcost.UpdateForeignKey( stockingpointid ); | 
|       } | 
|      | 
|       // Update type index of all related StockingPointInLane | 
|       traverse( this, StockingPointInLane, spilane ) | 
|       { | 
|         spilane.UpdateTypeIndex( stockingpointid, spilane.OriginLaneID(), spilane.DestinationLaneID(), true ); | 
|       } | 
|      | 
|       // Update type index of all related StockingPointCapacity | 
|       traverse( this, StockingPointCapacity, spcapacity ) | 
|       { | 
|         spcapacity.UpdateTypeIndex( stockingpointid, spcapacity.Start() ); | 
|       } | 
|      | 
|       // Update foreign key of all related StockingPointAccount | 
|       traverse( this, StockingPointAccount, spaccount ) | 
|       { | 
|         spaccount.UpdateForeignKey( stockingpointid ); | 
|       } | 
|      | 
|       // Update type index of all related StockingPointUnit | 
|       traverse( this, StockingPointUnit, spunit ) | 
|       { | 
|         spunit.UpdateTypeIndex( stockingpointid, spunit.UnitID(), spunit.IsInput() ); | 
|       } | 
|        | 
|       // Update foreign key of all related InventoryValueAndCost | 
|       traverse( this, InventoryValueAndCost, ivc ) | 
|       { | 
|         ivc.UpdateForeignKey( ivc.ProductID(), stockingpointid ); | 
|       } | 
|        | 
|       // Update type index of all related PISPSpecification | 
|       traverse( this, PISPSpecification, pspec ) | 
|       { | 
|         pspec.UpdateTypeIndex( pspec.ProductID(), stockingpointid ); | 
|       } | 
|        | 
|       // Update EntityID of subsets for StockingPoint_MP | 
|       traverse( this, SubsetEntityInOptimizerPuzzleBase, subsets ) | 
|       { | 
|         subsets.UpdateTypeIndex( subsets.OptimizerPuzzleName(), stockingpointid, subsets.EntityType() ); | 
|       }  | 
|        | 
|       // Update type index of this StockingPoint_MP | 
|       this.IsManuallyConfigured( true ); | 
|       StockingPoint_MP::ChangeKeyStockingPointTypeIndex( this, stockingpointid ); | 
|     } | 
|   *] | 
| } |