Scale.DoPriceCalculating Method (POS for .NET v1.14 SDK Documentation)

3/2/2014

Weighs the item or items on the scale and calculates the price of the items based on the parameters provided.

Namespace: Microsoft.PointOfService
Assembly: Microsoft.PointOfService (in microsoft.pointofservice.dll)

Syntax

'Declaration
Public MustOverride Function DoPriceCalculating ( _
    weightData As Integer, _
    tare As Integer, _
    unitPrice As Decimal, _
    unitPriceX As Decimal, _
    weightUnitX As Integer, _
    weightNumeratorX As Integer, _
    weightDenominatorX As Integer, _
    price As Decimal, _
    timeout As Integer _
) As PriceCalculation
public abstract PriceCalculation DoPriceCalculating (
    int weightData,
    int tare,
    decimal unitPrice,
    decimal unitPriceX,
    int weightUnitX,
    int weightNumeratorX,
    int weightDenominatorX,
    decimal price,
    int timeout
)
public:
virtual PriceCalculation DoPriceCalculating (
    int weightData, 
    int tare, 
    Decimal unitPrice, 
    Decimal unitPriceX, 
    int weightUnitX, 
    int weightNumeratorX, 
    int weightDenominatorX, 
    Decimal price, 
    int timeout
) abstract
public abstract PriceCalculation DoPriceCalculating (
    int weightData, 
    int tare, 
    Decimal unitPrice, 
    Decimal unitPriceX, 
    int weightUnitX, 
    int weightNumeratorX, 
    int weightDenominatorX, 
    Decimal price, 
    int timeout
)
public abstract function DoPriceCalculating (
    weightData : int, 
    tare : int, 
    unitPrice : decimal, 
    unitPriceX : decimal, 
    weightUnitX : int, 
    weightNumeratorX : int, 
    weightDenominatorX : int, 
    price : decimal, 
    timeout : int
) : PriceCalculation

Parameters

  • weightData
    The net weight in the price calculation algorithm. When AsyncMode is true, this value is set to zero in the return value.
  • tare
    The value used to determine the item net weight in the price calculation algorithm. When AsyncMode is true, this value is set to zero in the return value.
  • unitPrice
    The cost per measurement unit that is used in the price calculation algorithm. The measurement unit is defined by the WeightUnit property. When AsyncMode is true, this value is set to zero in the return value.
  • unitPriceX
    The cost per measurement unit that is used in the price calculation algorithm when using a unit of weight which is different from the default value used by the scale. This measurement unit is defined by the weightUnitX parameter.
  • weightUnitX
    The unit of weight which is different from the default value used by the scale. This value is the same as the weightUnit parameter used in SetUnitPriceWithWeightUnit.
  • weightNumeratorX
    The multiplier of the weight unit used in the price calculation.
  • weightDenominatorX
    The divisor of the weight unit used in the price calculation.
  • price
    The calculated monetary value for the item on the scale. When AsyncMode is true, this value is set to zero in the return value.
  • timeout
    In synchronous mode, the number of milliseconds to wait for a settled weight before returning an error. When AsyncMode is true, this value is ignored.

Return Value

Returns PriceCalculation.

Remarks

In synchronous mode (AsyncMode is false), this method starts the read weight process, waits until a stable weight is obtained, and then calculates the price. Upon successful completion, the ScaleLiveWeight, TareWeight, UnitPrice, and SalesPrice properties are updated, and the values for the WeightData, Tare, UnitPrice,UnitPriceX, WeightUnitX, WeightNumeratorX, WeightDenominatorX, andPrice parameters are returned.

In asynchronous mode (AsyncMode is true), the weighing and subsequent price calculation is done asynchronously. The method returns immediately with the return values for WeightData, Tare, UnitPrice,UnitPriceX, WeightUnitX, WeightNumeratorX, WeightDenominatorX, andPrice set. When the scale completes the price calculation, the ScaleLiveWeight, TareWeight, UnitPrice, and SalesPrice properties are updated and a DataEvent is raised.

This method may cause a PosControlException to be thrown with the following error codes:

Value

Meaning

E_ILLEGAL

An invalid timeout parameter was specified.

E_BUSY

An asynchronous price calculation is in progress.

E_TIMEOUT

In synchronous mode, a valid stable weight could not be obtained before timeout milliseconds passed.

E_EXTENDED

Check the ErrorCodeExtended property to determine the extended error code:

ValueMeaning
ESCAL_OVERWEIGHTIn synchronous mode, the weight on the scale exceeded the MaximumWeight.
ESCAL_UNDERWEIGHTIn synchronous mode, the weight on the scale was less than the MinimumWeight.
ESCAL_UNDER_ZEROIn synchronous mode, the scale reported a weight less than zero. The scale must be recalibrated.
ESCAL_SAME_WEIGHTIn synchronous mode, the scale reported that the item and weight on the scale is identical to the previously report item and weight, indicating that the item has not been removed from the scale.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

Scale Class
Scale Members
Microsoft.PointOfService Namespace