Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method InitializeProductInStockingPoint 
 | 
{ 
 | 
  Description: 'Create product in stocking point from sales demand, inventory supply, inventory specification, lane, disaggregation factors' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Create product in stocking point from sales demand, inventory supply, inventory specification, lane, disaggregation factors 
 | 
    // Get all related PISP combination strings 
 | 
    salesdemandpisps := this.GetSalesDemandPISP(); 
 | 
    disaggregationfactorpisps := this.GetDisaggregationFactorPISP(); 
 | 
    inventoryvaluepisps := this.GetInventoryValueAndCostPISP(); 
 | 
    inventoryspecificationpisps := this.GetInventorySpecificationPISP(); 
 | 
    inventorysupplypisps := this.GetInventorySupplyPISP(); 
 | 
    lanepisps := this.GetLanePISP(); 
 | 
    specificationpisps := this.GetSpecificationPISP(); 
 | 
    dsdippisps := this.GetDisaggregratedSDIPPISP(); 
 | 
    actualpisps := this.GetActualPISP(); 
 | 
    safetystockpisps := this.GetSafetyStockPISP(); 
 | 
     
 | 
    // Union all previously selected PISP combination strings into one set 
 | 
    pisp := salesdemandpisps.Union( disaggregationfactorpisps ); 
 | 
    pisp := pisp.Union( inventoryvaluepisps ); 
 | 
    pisp := pisp.Union( inventoryspecificationpisps ); 
 | 
    pisp := pisp.Union( inventorysupplypisps ); 
 | 
    pisp := pisp.Union( lanepisps ); 
 | 
    pisp := pisp.Union( specificationpisps ); 
 | 
    pisp := pisp.Union( dsdippisps ); 
 | 
    pisp := pisp.Union( actualpisps ); 
 | 
    pisp := pisp.Union( safetystockpisps ); 
 | 
     
 | 
    // Remove duplicated elements in the set 
 | 
    pisp := pisp.Unique(); 
 | 
     
 | 
    // Traverse the set of selected PISP combination strings 
 | 
    traverse( pisp, Elements, p ) 
 | 
    { 
 | 
      // Tokenize the string 
 | 
      pispStrs := p.Tokenize( ";" ); 
 | 
     
 | 
      // Check if the string is tokenize into 2 elements 
 | 
      if( pispStrs.Size() = 2 ) 
 | 
      { 
 | 
        // Get ProductID and StockingPointID from the tokenize string 
 | 
        productId := pispStrs.Element( 0 ); 
 | 
        stockingpointId := pispStrs.Element( 1 ); 
 | 
     
 | 
        // Find Product_MP 
 | 
        product := Product_MP::FindProductTypeIndex( productId ); 
 | 
     
 | 
        // Check if Product_MP is found, if it is found, add it to StockingPoint_MP 
 | 
        // to create ProductInStockingPoint_MP 
 | 
        if( not isnull( product ) ) 
 | 
        { 
 | 
          product.AddToStockingPoint( stockingpointId ); 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |