Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method UpdateCommitLogic 
 | 
{ 
 | 
  Description: 'Commit logic for global parameters' 
 | 
  TextBody: 
 | 
  [* 
 | 
    /* When the check HasDefaultInventoryHoldingCost is set to TRUE, 
 | 
       Every existing product will createt a product account with inventory holding as cost driver 
 | 
       to the account specified in attribute DefaultAccountForInventoryHolding 
 | 
     
 | 
       Every product that is created after the check is set to TRUE will also perform such action. 
 | 
     
 | 
       When the check is set to FALSE, the ProductAccount that does not override the global parameter 
 | 
       values will have its attribute IsUsed set to FALSE declarative, hence deleting the said 
 | 
       instance once the method MacroPlan.RunOptimizer() is executed, when running optimizer */ 
 | 
     
 | 
     
 | 
    if( this.HasDefaultInventoryHoldingCost() ) 
 | 
    { 
 | 
      owner := Account_MP::FindAccountTypeIndex( this.DefaultAccountForInventoryHolding() ) 
 | 
      if( not isnull( owner ) ) 
 | 
      { 
 | 
        products := selectset( this, MacroPlan.Product_MP, p, not p.IsSystem() ); 
 | 
        traverse( products, Elements.ProductInStockingPoint_MP, pisp, 
 | 
                  not pisp.IsSystem() 
 | 
                  and not exists( pisp, PISPAccount, pispa, 
 | 
                                  pispa.Account_MP() = owner 
 | 
                                  and pispa.IsInventoryHolding() ) ) 
 | 
        { 
 | 
          PISPAccount::Assign( owner, 
 | 
                               pisp.Product_MP(), 
 | 
                               pisp.StockingPoint_MP(), 
 | 
                               Translations::MP_AccountAssignmentCostDriverInventoryHolding() ); 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
     
 | 
    // To set to default leadtime logic if the new leadtime logic is empty 
 | 
    if( this.LaneLeadTimeLogic() = '' ) 
 | 
    { 
 | 
      defaultLaneLeadTimeLogic := GlobalParameters_MP::GetAllLaneLeadTimeLogic().Tokenize( ";" ).Element( 0 ); 
 | 
      this.LaneLeadTimeLogic( defaultLaneLeadTimeLogic ); 
 | 
    } 
 | 
     
 | 
    // To set to default leadtime logic if the new leadtime logic is empty 
 | 
    if( this.OperationLeadTimeLogic() = '' ) 
 | 
    { 
 | 
      defaultOperationLeadTimeLogic := GlobalParameters_MP::GetAllOperationLeadTimeLogic().Tokenize( ";" ).Element( 0 ); 
 | 
      this.OperationLeadTimeLogic( defaultOperationLeadTimeLogic );   
 | 
    } 
 | 
     
 | 
    // Reset plan in case of change of lead time strategy 
 | 
    if( this.HasNewLeadTimeStrategy() ) 
 | 
    { 
 | 
      this.MacroPlan().ResetPeriodTasksAndFlushTrips(); 
 | 
      this.HasNewLeadTimeStrategy( false ); 
 | 
    } 
 | 
     
 | 
    // Refresh KPIs in case of change of KPI horizon 
 | 
    if( this.HasNewKPIHorizon() ) 
 | 
    { 
 | 
      this.MacroPlan().CalculateKPIScore( false ); 
 | 
      this.HasNewKPIHorizon( false ); 
 | 
    } 
 | 
     
 | 
     
 | 
    // Update default capacities and availabilities 
 | 
    this.UpdateDefaultUnitAvailabilities(); 
 | 
    this.UpdateDefaultTransportCapacities(); 
 | 
    this.UpdateDefaultUnitCapacities(); 
 | 
    this.UpdateDefaultStockingPointCapacities(); 
 | 
  *] 
 | 
} 
 |