Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod CreateSalesDemands ( 
 | 
  MacroPlan macroplan, 
 | 
  ProductInStockingPointInPeriodPlanningLeafs pispips 
 | 
) 
 | 
{ 
 | 
  Description: "Automatically creates the sales demand for pispips that doesn't have dependent demand" 
 | 
  TextBody: 
 | 
  [* 
 | 
    // ju jinn Dec-9-2014 (created) 
 | 
     
 | 
     
 | 
    if( isnull( pispips ) ) 
 | 
    { 
 | 
      //skip the creation as long as there is a demand in any of the pispip 
 | 
      traverse( macroplan, LeafProductInStockingPoint, pisp, 
 | 
                not exists( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispip, ( pispip.DependentDemand( relsize ) + pispip.DisaggregationFactor(relsize) ) > 0 ) 
 | 
              ) 
 | 
      { 
 | 
          traverse( pisp, ProductInStockingPointInPeriod, pispip ) 
 | 
          { 
 | 
            pispip.CreateSalesDemand( macroplan ); 
 | 
          } 
 | 
      } 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      traverse( pispips, Elements, pispip ) 
 | 
      { 
 | 
        pispip.CreateSalesDemand( macroplan ); 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |