Quintiq file version 2.0
#parent: MatrixEditorTransportCapacities
Response OnUpdateValue (
  UnitPeriodTransportQuantity cell,
  Real value
) id:Response_MatrixEditorTransportCapacities_OnUpdateValue
{
  #keys: '[139394.1.31195644]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebMatrixEditor_OnUpdateValue'
  QuillAction
  {
    Body:
    [*
      // Create or update min/max capacity and lot size
      ismincapacity := focusedattribute = attribute( UnitPeriodTransportQuantity, MinCapacityPerTimeUnit ).Name();
      ismaxcapacity := focusedattribute = attribute( UnitPeriodTransportQuantity, MaxCapacityPerTimeUnit ).Name();
      istransportcapacityattribute := typeof( TransportCapacity ).Name() + '.';
      unitperiodtransportquantities := construct( UnitPeriodTransportQuantitys );
      unitperiodtransportquantities.Add( cell );
      TransportCapacity::CreateOrUpdateForUnitPeriodTransports( unitperiodtransportquantities,
                                                                cell.TimeUnitForCapacitiesCalculation(),
                                                                false /*isbatcheditlot*/,
                                                                cell.LotSize(),
                                                                ismincapacity or ismaxcapacity /*isbatcheditcapacity*/,
                                                                ifexpr( ismincapacity, value, cell.MinCapacityPerTimeUnit() ),
                                                                ifexpr( ismaxcapacity, value, cell.MaxCapacityPerTimeUnit() ),
                                                                not ( ismincapacity or ismaxcapacity ) /*isbatcheditsecondary*/,
                                                                cell.HasSecondaryCapacity(),
                                                                ifexpr( focusedattribute = istransportcapacityattribute + attribute( TransportCapacity, SecondaryLotSize ).Name(),
                                                                        value, cell.SecondaryLotSize() ),
                                                                ifexpr( focusedattribute = istransportcapacityattribute + attribute( TransportCapacity, SecondaryMaximumCapacity ).Name(),
                                                                        value, guard( cell.TransportCapacity().SecondaryMaximumCapacity(), 0.0 ) ),
                                                                ifexpr( focusedattribute = istransportcapacityattribute + attribute( TransportCapacity, SecondaryMinimumCapacity ).Name(),
                                                                        value, guard( cell.TransportCapacity().SecondaryMinimumCapacity(), 0.0 ) ),
                                                                cell.SecondaryUnitOfMeasureName(),
                                                                false /*this period onwards*/
                                                              );
    *]
    GroupServerCalls: false
  }
}
