EndJobAsync(Int32,String,String,String,String,String,Nullable<Int32>,String,Nullable<Boolean>,Nullable<Boolean>,Nullable<Int32>,Nullable<Int32>,Nullable<Int32>,Nullable<DateTime>) Method
- Last UpdatedNov 06, 2025
- 3 minute read
The EndJobAsync() method ends a job on an entity.
This overload of the method uses the entity name and site name to identify the entity. It also includes the eventTime parameter, in the entity's local time.
'Declaration
Public Overloads Shared Sub EndJobAsync( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entName As String, _
ByVal siteName As String, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Nullable(Of Integer), _
ByVal statusNotes As String, _
ByVal checkPrivileges As Nullable(Of Boolean), _
ByVal checkCerts As Nullable(Of Boolean), _
ByVal clientType As Nullable(Of Integer), _
ByVal jobPos As Nullable(Of Integer), _
ByVal noPropagation As Nullable(Of Integer), _
ByVal eventTime As Nullable(Of Date) _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entName As String
Dim siteName As String
Dim woId As String
Dim operId As String
Dim seqNo As Nullable(Of Integer)
Dim statusNotes As String
Dim checkPrivileges As Nullable(Of Boolean)
Dim checkCerts As Nullable(Of Boolean)
Dim clientType As Nullable(Of Integer)
Dim jobPos As Nullable(Of Integer)
Dim noPropagation As Nullable(Of Integer)
Dim eventTime As Nullable(Of Date)
JobExec.EndJobAsync(sessionId, userId, entName, siteName, woId, operId, seqNo, statusNotes, checkPrivileges, checkCerts, clientType, jobPos, noPropagation, eventTime)
public static void EndJobAsync(
int sessionId,
string userId,
string entName,
string siteName,
string woId,
string operId,
Nullable<int> seqNo,
string statusNotes,
Nullable<bool> checkPrivileges,
Nullable<bool> checkCerts,
Nullable<int> clientType,
Nullable<int> jobPos,
Nullable<int> noPropagation,
Nullable<DateTime> eventTime
)
Parameters
- sessionId
- Required. Holds the ID of the session from which the job is being ended.
- userId
- Required. Holds the ID of the user who is ending the job.
- entName
- Required. Holds the name of the entity on which the job is to be ended.
- siteName
- Optional. Holds the site name of the entity
- woId
- Optional. Holds the work order ID of the job.
- operId
- Optional. Holds the operation ID of the job.
- seqNo
- Optional. Holds the job sequence number.
- statusNotes
- Optional. Holds notes associated with the state change. Default is null.
- checkPrivileges
- Optional. Holds a flag that, if set to true, specifies that the user’s privileges should be checked before executing this action. Default is false.
- checkCerts
- Optional. Holds a flag that, if set to true, specifies that the produced quantities should be checked before allowing this job to be ended. Default is false.
- clientType
- Optional. Holds the type of client application that is trying to end the job. Defaults to 37 (Operator).
- jobPos
- Optional. Holds the job position. If the job position is greater than 1, jobs are running on this entity.
- noPropagation
- Optional. An integer data type.
- eventTime
- Optional. Holds the event time, in the entity's local time.
Note: Ending a job more than 90 days in the past will exclude the creation of hourly buckets more than 90 days old in the job_hourly_history table.
The work order ID, operation ID, and sequence number are all required to identify the job to be ended on the specified entity. For the method to succeed, the specified job must be currently running or suspended on the specified entity. If the call is successful:
- The Job table is updated as follows for the specified job:
state_cd = 4 (COMPLETED)
status_notes = status_notes
act_finish_time = current datetime
- The current job data fields in the Job_Exec table are updated as follows for this entity:
cur_wo_id = null
cur_oper_id = null
cur_seq_no = 0
cur_step_no = null
cur_step_start = null
- The job_end_utc and job_end_local fields in the Job_History table are updated with the end times, if supplied. Otherwise, they are updated with the current times.
- If any steps are currently active on the specified job, they are not automatically ended.