Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetIncludedRoutings ( 
 | 
  Units includedunits, 
 | 
  ProductInStockingPoint_MPs includedPISP 
 | 
) as owning Routings 
 | 
{ 
 | 
  Description: 'Get Operations that are in the scope of the optimizer puzzle ( product and sp included )' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Get Process in optimizer puzzle scope 
 | 
    routings := construct( Routings ); 
 | 
     
 | 
    if( this.IsWorld() ) 
 | 
    { 
 | 
      routings := this.MacroPlan().Routing( relget ); 
 | 
    } 
 | 
    else 
 | 
    {                       
 | 
      // Include Routing IF AND ONLY IF 
 | 
      // ALL UNIT and PISP Output of the Routing are included 
 | 
      // WIP should be followed   
 | 
     
 | 
      routings := selectset( this.MacroPlan(), Routing, routing, 
 | 
                             forall( routing, OperationOutput, oo,                             // Using for all at OO level to check both condition all together 
 | 
                                     includedunits.Find( oo.Operation().Unit() ) > -1          // Check if units is in 
 | 
                                     and ( oo.ProductInStockingPoint_MP().IsSystem()           // If units is in and is WIP, skip pisp check 
 | 
                                           or ( not oo.ProductInStockingPoint_MP().IsSystem()  // If is output bom, chcek PISP 
 | 
                                                and includedPISP.Find( oo.ProductInStockingPoint_MP() ) > -1 ) ) ) );      
 | 
                 
 | 
    } 
 | 
     
 | 
    return &routings; 
 | 
  *] 
 | 
} 
 |