Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditPISPSpecification_OnOK
{
  #keys: '[135040.0.219519607]'
  Body:
  [*
    // Create / update PISP specification
    pisps := DataHolderDialogDatas.Data();
    isbatchedit := pisps.Size() > 1;
    pisp := pisps.Element( 0 );
    
    inputlotsize := ApplicationMacroPlanner.FormatStringToReal( EditFieldInputLotSizeUOM.Text(), 0.0 );
    
    if( not isbatchedit )
    {     
      PISPSpecification::CreateUpdate( pisp.Product_MP(), 
                                       pisp.StockingPoint_MP(), 
                                       CheckboxIsOverrideUOMForProduct.Checked(), 
                                       guard( DropDownListUOM.Data().Name(), '' ), 
                                       CheckboxIsNegativeInventoryAllowed.Checked(), // IsNegativeInventoryAllowed 
                                       CheckboxIsExcluded.Checked(), // IsExcluded
                                       CheckboxIsExcludedFromBalancing.Checked(), // IsExcludedFromBalancing
                                       CheckboxIsSafetyStockKept.Checked(), // IsSafetyStockKept 
                                       inputlotsize, // InputLotSize
                                       CheckBoxIsExcludeShelfLife.Checked(), //IsExcludeShelfLifeAndMaturation
                                       false /* IsFromDB */ ); 
    }
    else
    {
      PISPSpecification::Update( pisps,
                                 CheckboxBatchIsOverrideUOMForProduct.Checked(),
                                 CheckboxIsOverrideUOMForProduct.Checked(),
                                 guard( DropDownListUOM.Data().Name(), '' ),                   
                                 CheckboxBatchIsNegativeInventoryAllowed.Checked(),
                                 CheckboxIsNegativeInventoryAllowed.Checked(), // IsNegativeInventoryAllowed
                                 CheckboxBatchIsExcluded.Checked(),
                                 CheckboxIsExcluded.Checked(), // IsExcluded
                                 CheckboxBatchIsExcludedFromBalancing.Checked(),
                                 CheckboxIsExcludedFromBalancing.Checked(),
                                 CheckboxBatchIsSafetyStockKept.Checked(),
                                 CheckboxIsSafetyStockKept.Checked(), // IsSafetyStockKept 
                                 CheckboxBatchLotSize.Checked(),
                                 inputlotsize, // InputLotSize
                                 CheckBoxIsBatchEditIsExcludeShelfLife.Checked(), // batchedit shelflife
                                 CheckBoxIsExcludeShelfLife.Checked(), // excludeshelflife
                                 false );
    }
    
    this.Close();
  *]
}
