Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SmartPlanSetFinalRunRelations ( 
 | 
  Boolean isupstream, 
 | 
  LibOpt_Scope scope, 
 | 
  RunContextForCapacityPlanning runcontext 
 | 
) 
 | 
{ 
 | 
  Description: 'set relations to algorithmrun object of sub puzzle' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // If an operation has multiple outputs, we need to make sure the pispips of all those outputs are in the optimizer run 
 | 
    if( isupstream ) 
 | 
    { 
 | 
      traverse( scope.GetPeriodTaskOperationInOptimizerRun(), Elements.NewSupply.ProductInStockingPointInPeriodPlanningLeaf, nspispip, 
 | 
                not scope.Contains(  nspispip.PISPIPInOptimizerRun() ) ) 
 | 
      { 
 | 
        scope.Add( nspispip );  
 | 
      } 
 | 
    } 
 | 
    else 
 | 
    // If an operation has multiple inputs, we need to make sure the pispips of all those outputs are in the optimizer run 
 | 
    { 
 | 
      Transaction::Transaction().Propagate( relation( PeriodTaskOperation, DependentDemand ) ); // smart plan creates the PeriodTaskOperation object - so we need to make sure the relation is set 
 | 
      traverse( scope.GetPeriodTaskOperationInOptimizerRun(), Elements.DependentDemand.ProductInStockingPointInPeriodPlanningLeaf, ddpispip, 
 | 
                not scope.Contains( ddpispip.PISPIPInOptimizerRun() ) ) 
 | 
      { 
 | 
        scope.Add( ddpispip );  
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |