Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SynchronizeTools ( 
 | 
  LibOpt_Scope scope 
 | 
) 
 | 
{ 
 | 
  Description: 
 | 
  [* 
 | 
    Method to create Tool and ToolInUnitPeriod objects. 
 | 
    These objects are used as index objects within the optimizer 
 | 
  *] 
 | 
  TextBody: 
 | 
  [* 
 | 
    this.MacroPlan().Tool( relflush);  
 | 
     
 | 
    traverse( scope.GetUnitInOptimizerRun(), Elements, unit, unit.HasToolOperations() )  
 | 
    { 
 | 
      traverse( unit, UnitPeriod, up, scope.Contains( up.UnitPeriodInOptimizerRun() ) ) 
 | 
      { 
 | 
        unitperiodoperations := this.GetOperationsForUnitPeriod( scope, up ); 
 | 
        unitperiodtools := selectuniquevalues( unitperiodoperations, Elements.RoutingStep, routingstep, true, routingstep.Tool() ); 
 | 
         
 | 
        traverse( unitperiodtools, Elements, toolname, toolname.Length() > 0) 
 | 
        { 
 | 
          tool := select( this, MacroPlan.Tool, t, t.Name() = toolname ); 
 | 
           
 | 
          if ( isnull( tool ) ) 
 | 
          { 
 | 
            tool := this.MacroPlan().Tool( relnew, Name := toolname ) 
 | 
          } 
 | 
          if( not exists( tool, ToolInUnitPeriod.UnitPeriod, unitperiod, unitperiod = up ) ) 
 | 
          { 
 | 
            toolinperiod := tool.ToolInUnitPeriod( relnew ) 
 | 
            toolinperiod.UnitPeriod( relset, up) 
 | 
          }   
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |