Quintiq file version 2.0
|
#parent: #root
|
Method UpdateTypeIndex (
|
String name
|
)
|
{
|
Description: 'Update UOM TypeIndex and the linked instances'
|
TextBody:
|
[*
|
// Update UOM TypeIndex and the linked instances if the new Name is not the same as the old Name
|
if( this.Name() <> name )
|
{
|
// Update foreign key of all linked Units
|
traverse( this, Unit, unit )
|
{
|
unit.UpdateForeignKey( unit.CurrencyID(),
|
unit.GroupName(),
|
unit.ParentUnitID(),
|
name );
|
}
|
|
// Update foreign key of all linked Product_MPs
|
traverse( this, Product_MP, product )
|
{
|
product.UpdateForeignKey( product.ParentID(),
|
name );
|
}
|
|
// Update foreign key of all linked StockingPoint_MPs
|
traverse( this, StockingPoint_MP, sp )
|
{
|
sp.UpdateForeignKey( name,
|
sp.CurrencyID(),
|
sp.GroupName(),
|
sp.UnitID() );
|
}
|
|
// Update foreign key of all linked PISPSpecifications
|
traverse( this, PISPSpecification, spec )
|
{
|
spec.UpdateForeignKey( name );
|
}
|
|
// Update type index of all linked SourceUnitOfMeasures
|
traverse( this, AsSourceUnitOfMeasure.astype( BaseConversionFactor ), bc )
|
{
|
bc.UpdateTypeIndex( name, bc.TargetUnitOfMeasureName(), bc.ProductID() );
|
}
|
|
// Update type index of all linked TargetUnitOfMeasures
|
traverse( this, AsTargetUnitOfMeasure.astype( BaseConversionFactor ), bc )
|
{
|
bc.UpdateTypeIndex( bc.SourceUnitOfMeasureName(), name, bc.ProductID() );
|
}
|
|
// Update foreign key of all linked SalesDemands
|
traverse( this, SalesDemand, sd )
|
{
|
sd.UpdateForeignKey( sd.ProductID(),
|
sd.StockingPointID(),
|
sd.SalesSegmentName(),
|
sd.PriorityName(),
|
sd.CurrencyID(),
|
name );
|
}
|
|
// Update type index of this UnitOfMeasure
|
this.IsManuallyConfigured( true );
|
UnitOfMeasure_MP::ChangeKeyUnitOfMeasureTypeIndex( this, name );
|
}
|
*]
|
}
|