Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method Update ( 
 | 
  Product_MP owner, 
 | 
  StockingPoint_MP stockingpoint, 
 | 
  Date start, 
 | 
  Boolean hastargetindays, 
 | 
  Real targetindays, 
 | 
  Real targetinquantity, 
 | 
  Boolean hasminlevelindays, 
 | 
  Real minlevelindays, 
 | 
  Real minlevelinquantity, 
 | 
  Boolean hasmaxlevel, 
 | 
  Boolean hasmaxlevelindays, 
 | 
  Real maxlevelindays, 
 | 
  Real maxlevelinquantity, 
 | 
  Boolean iscalculated, 
 | 
  Boolean isfromdb 
 | 
) 
 | 
{ 
 | 
  Description: 'Update inventory specification' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Update type index of inventory specification 
 | 
    this.UpdateTypeIndex( owner.ID(), stockingpoint.ID(), start ); 
 | 
     
 | 
    needsync := this.Product_MP() <> owner 
 | 
                or this.StockingPoint_MP() <> stockingpoint; 
 | 
     
 | 
    // Check if there are any changes to product/stocking point 
 | 
    if( needsync ) 
 | 
    { 
 | 
      owner.InventorySpecification( relmove, this ); 
 | 
     
 | 
      // create pisp when there is changes to product / stocking point 
 | 
      owner.AddToStockingPoint( stockingpoint ); 
 | 
    } 
 | 
     
 | 
     
 | 
    this.HasTargetInDays_DELETED_Nov19( hastargetindays ) 
 | 
    this.TargetInDays_DELETED_Nov19( targetindays ); 
 | 
     
 | 
    // If TargetInQuantity is not changed on the dialog then IsCalculated value should not be updated. 
 | 
    // iscalculated parameter is always send as false from the dialog and always send as true from the generate safety stock method.  
 | 
    if( not ( ( this.TargetInQuantity_DELETED_Nov19() = targetinquantity ) and not iscalculated ) ) 
 | 
    { 
 | 
      this.IsCalculated( iscalculated ); 
 | 
    } 
 | 
    this.TargetInQuantity_DELETED_Nov19( targetinquantity ); 
 | 
     
 | 
    // Check if inventory specification has target in days 
 | 
    if( hastargetindays ) 
 | 
    { 
 | 
      this.TargetInQuantity_DELETED_Nov19( 0 ); 
 | 
      this.IsCalculated( iscalculated ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
     this.TargetInDays_DELETED_Nov19( 0 ); 
 | 
    } 
 | 
     
 | 
    this.HasMinLevelInDays( hasminlevelindays ); 
 | 
    this.MinLevelInDays( minlevelindays ); 
 | 
    this.MinLevelInQuantity( minlevelinquantity ); 
 | 
    // Check if inventory specification has min level in days 
 | 
    if( hasminlevelindays ) 
 | 
    { 
 | 
     this.MinLevelInQuantity( 0 ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      this.MinLevelInDays( 0 ); 
 | 
    } 
 | 
     
 | 
    this.HasMaxLevel( hasmaxlevel ); 
 | 
    this.HasMaxLevelInDays( hasmaxlevelindays ); 
 | 
    this.MaxLevelInDays( maxlevelindays ); 
 | 
    this.MaxLevelInQuantity( maxlevelinquantity ); 
 | 
    // Check if inventory specification has max level 
 | 
    if( hasmaxlevel ) 
 | 
    { 
 | 
      // Check if inventory specification has max level in days 
 | 
      if( hasmaxlevelindays ) 
 | 
      { 
 | 
        this.MaxLevelInQuantity( 0 ); 
 | 
      } 
 | 
      else 
 | 
      { 
 | 
        this.MaxLevelInDays( 0 ); 
 | 
      } 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      this.MaxLevelInQuantity( 0 ); 
 | 
      this.MaxLevelInDays( 0 ); 
 | 
    } 
 | 
     
 | 
    this.IsManuallyConfigured( not isfromdb ); 
 | 
  *] 
 | 
} 
 |