CalculateProductionTarget Method
- Last UpdatedNov 06, 2025
- 3 minute read
'Declaration
Public Shared Function CalculateProductionTarget( _
ByVal sessionId As Integer, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Integer, _
ByVal targetQuantity As Nullable(Of Double), _
ByVal targetRate As Nullable(Of Double), _
ByVal targetRateUnits As ProductionRate, _
ByVal batchSize As Nullable(Of Double) _
) As DataSet
'Usage
Dim sessionId As Integer
Dim woId As String
Dim operId As String
Dim seqNo As Integer
Dim targetQuantity As Nullable(Of Double)
Dim targetRate As Nullable(Of Double)
Dim targetRateUnits As ProductionRate
Dim batchSize As Nullable(Of Double)
Dim value As DataSet
value = JobExec.CalculateProductionTarget(sessionId, woId, operId, seqNo, targetQuantity, targetRate, targetRateUnits, batchSize)
public static DataSet CalculateProductionTarget(
int sessionId,
string woId,
string operId,
int seqNo,
Nullable<double> targetQuantity,
Nullable<double> targetRate,
ProductionRate targetRateUnits,
Nullable<double> batchSize
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call. Although required, the session ID is not used by the call.
- woId
- Required. Holds the ID of the work order of the job for which the production target information is being returned.
- operId
- Required. Holds the ID of the operation of the job for which the production target information is being returned.
- seqNo
- Required. Holds the job sequence number for which the production target information is being returned.
- targetQuantity
- Required. Holds the target quantity to be produced by the job by the end of the current shift.
- targetRate
- Required. Holds the target rate at which the job must produce items to meet the target quantity by the end of the current shift. This value is ignored if TargetQuantity is supplied.
- targetRateUnits
- Required. Holds an enumeration that identifies the units by which the rate of production is measured. HoursPerBatch = 0, MinutesPerBatch = 1, SecondsPerBatch = 2, BatchesPerHour = 3, BatchesPerMinute = 4, BatchesPerSecond = 5
- batchSize
- Optional. Holds how many items are in each batch being produced. If null is supplied, then a batch size of 1 is assumed.
Return Value
Returns a DataSet with the calculation results.
The columns of the returned DataSet are described below.
|
Column Name |
Description |
|---|---|
|
TargetQuantity |
A double floating point that is the projected target quantity that will be produced by the job by end of the current shift. |
|
TargetRate |
A double floating point that is the projected target rate to meet the required quantity by end of the current shift. |
|
TargetUnits |
An integer that is an enumeration that identifies the units. |
This method is used to calculate the target rate of production or the target quantity to be produced for a given job. The target rate of production is the rate at which a job specified by the user must produce batches of good items to reach a target quantity by the end of the current shift. The target quantity is the number of batches of good items that a job will produce by the end of the current shift if the batches are produced at a target rate specified by the user.
Either the target rate or the target quantity will be null when passed to the method, indicating that it needs to be calculated. For instance, if the target rate is null and the target quantity is non-null, then the target rate must be calculated. If the target quantity is null and the target rate is non-null, then the target quantity must be calculated. When calculating the target quantity, the units in which the target rate is measured must also be provided for the method to succeed. Also, for the method to succeed, the values for target rate and target quantity cannot both be null or non-null.
The method will use the following formulas to calculate target quantity and target rate:
In both cases, Time is the amount of time in seconds left in the shift from the moment the method is called. The Time and TargetRate must be expressed in the same units. Therefore, the method will convert the target rate units provided to the method into seconds-per-batch or batches-per-second. The values being returned by the method will be converted back into their original units before being returned.TargetQuantity = (Time × TargetRate) × BatchSize
TargetRate = TargetQuantity ÷ (Time × BatchSize)