Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method Update ( 
 | 
  Real quantity, 
 | 
  Boolean hasuser 
 | 
) 
 | 
{ 
 | 
  Description: 'Update period task quantity and set all corresponding dd to manual' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // This method is used for user actions on UI, not intended to be used by optimizer to update the value 
 | 
    this.HasUserQuantity( hasuser ); 
 | 
     
 | 
    if( hasuser ) 
 | 
    { 
 | 
      this.UserQuantity( quantity ); 
 | 
       
 | 
      traverse( this, DependentDemand, dd )  
 | 
      {                             
 | 
        qty := 0.0; 
 | 
     
 | 
        //dd has been set by user, update dd qty base on the pt changes ratio 
 | 
        //e.g. old pt qty 20 -> 200, factor = 10. 
 | 
        //we increase dd qty by factor of 10 
 | 
        if( dd.HasUserQuantity() ) 
 | 
        { 
 | 
          factor := guard( quantity / this.Quantity(), 1.0 ); 
 | 
          qty := factor * dd.Quantity();       
 | 
        } 
 | 
        //if dd has been set by optimizer derive the qty based on period quantity to be planned on period task. 
 | 
        //similar to DD.CalcQuantity when there is no manaul plan 
 | 
        else 
 | 
        {     
 | 
          qty := PeriodTaskOperation::GetDependentDemandQuantity( quantity, dd.ProcessInput(), dd.RelativeDuration() ); 
 | 
        } 
 | 
        dd.HasUserQuantity( true ); 
 | 
        dd.UserQuantity( qty ); 
 | 
      } 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      this.OptimizerQuantity( quantity ); 
 | 
    } 
 | 
     
 | 
    this.ResetDependentDemandInputGroupOptimizerFulfillment(); 
 | 
     
 | 
     
 | 
    this.SetTimeStamp(); 
 | 
    this.MacroPlan().UpdateLastPlanningAction( false, false, false, true ); // isReset, isPlan, isRoll, isLockUnlock 
 | 
  *] 
 | 
} 
 |