Quintiq file version 2.0
#parent: #root
Method SynchronizePISPSpecification (
  structured[ProductInStockingPoint_MP] pisps
) id:Method_DialogCreateEditPISPSpecification_SynchronizePISPSpecification
{
  #keys: '[124808.2.555255257]'
  Body:
  [*
    // Create / update PISP specification
    isbatchedit := pisps.Size() > 1;
    pisp := pisps.Element( 0 );
    inputlotsize := ApplicationLibMacroPlanner.FormatStringToReal( EditorInputLotSize.Text(), 0.0 );
    
    if( not isbatchedit )
    {     
      PISPSpecification::CreateUpdate( pisp.Product_MP(), 
                                       pisp.StockingPoint_MP(), 
                                       CheckBoxIsOverrideUnitOfMeasurementForProduct.Checked(), 
                                       guard( SelectionUnitOfMeasurement.Data().Name(), '' ), 
                                       CheckBoxIsNegativeInventoryAllowed.Checked(), // IsNegativeInventoryAllowed 
                                       CheckBoxIsExcluded.Checked(), // IsExcluded
                                       CheckBoxIsExcludedFromBalancing.Checked(), // IsExcludedFromBalancing
                                       CheckBoxIsSafetyStockKept.Checked(), // IsSafetyStockKept 
                                       inputlotsize, // InputLotSize
                                       CheckBoxIsExcludeShelfLife.Checked(),//IsExcludeShelflife
                                       false /* IsFromDB */ ); 
    }
    else
    {
      PISPSpecification::Update( pisps,
                                 CheckBoxIsBatchEditUOM.Checked(),
                                 CheckBoxIsOverrideUnitOfMeasurementForProduct.Checked(),
                                 guard( SelectionUnitOfMeasurement.Data().Name(), '' ),                   
                                 CheckBoxIsBatchEditIsNegativeInventoryAllowed.Checked(),
                                 CheckBoxIsNegativeInventoryAllowed.Checked(), // IsNegativeInventoryAllowed
                                 CheckBoxIsBatchEditIsExcluded.Checked(),
                                 CheckBoxIsExcluded.Checked(), // IsExcluded
                                 CheckBoxIsBatchEditIsExcludedFromBalancing.Checked(),
                                 CheckBoxIsExcludedFromBalancing.Checked(),
                                 CheckBoxIsBatchEditIsSafetyStockKept.Checked(),
                                 CheckBoxIsSafetyStockKept.Checked(), // IsSafetyStockKept 
                                 CheckBoxIsBatchEditInputLotSize.Checked(),
                                 inputlotsize, // InputLotSize   
                                 CheckBoxIsBatchEditIsExcludeShelfLife.Checked(),
                                 CheckBoxIsExcludeShelfLife.Checked(),
                                 false );
    }
  *]
}
