LogOnJob(Int32,String,String,String,String,String,Int32,DBString,DBString,DBString,DBDouble,DBDateTime) Method
- Last UpdatedNov 06, 2025
- 5 minute read
The LogOnJob() method logs the active user onto the specified entity and job.
If an entity is being specified, this overload of the method specifies the entity by its entity name and site name.
'Declaration
Public Overloads Shared Sub LogOnJob( _
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 Integer, _
ByVal statusNotes As DBString, _
ByVal curLabCd As DBString, _
ByVal curLabDeptId As DBString, _
ByVal pctLabToApply As DBDouble, _
ByVal logOnTime As DBDateTime _
)
'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 Integer
Dim statusNotes As DBString
Dim curLabCd As DBString
Dim curLabDeptId As DBString
Dim pctLabToApply As DBDouble
Dim logOnTime As DBDateTime
Session.LogOnJob(sessionId, userId, entName, siteName, woId, operId, seqNo, statusNotes, curLabCd, curLabDeptId, pctLabToApply, logOnTime)
public static void LogOnJob(
int sessionId,
string userId,
string entName,
string siteName,
string woId,
string operId,
int seqNo,
DBString statusNotes,
DBString curLabCd,
DBString curLabDeptId,
DBDouble pctLabToApply,
DBDateTime logOnTime
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- userId
- Required. Holds the ID of the user who is being logged on.
- entName
- Required. Holds the name of the entity that the user is being logged on to.
- siteName
- Required. Holds the site name of the entity that the user is being logged on to.
- woId
- Required. Holds the work order ID of the job that the user is being logged on to.
- operId
- Required. Holds the operation ID of the job that the user is being logged on to.
- seqNo
- Required. Holds the operation sequence number of the job that the user is being logged on to.
- statusNotes
- Optional. Holds a string that contains the job status notes.
- curLabCd
- Optional. Holds the labor code to be used for this entry. Defaults to null, which means that labor data is not collected.
- curLabDeptId
- Optional. Holds the ID of the labor department to be used for this entry. Defaults to null, which means that labor data is not collected.
- pctLabToApply
- Optional. Holds the percentage of labor hours to be applied to this entry. Defaults to 100% if the labor code is included; otherwise, is null.
- logOnTime
Optional. Holds the actual date/time the logon took place. If null, defaults to the current time.
Passing a time for this parameter is useful when importing logon data from external timekeeping systems.
NOTE: The supplied date/time must be before the current time; if it is not, the current time is used.
This method first verifies whether the supplied user has a valid certification to log on to this job. If the supplied job is not currently running on an entity, then the supplied job is started on this entity.
If the supplied user has the “Require job based login” privilege (priv_id=92) set to true, the user will be logged on to this job. Any user that has the “Require job based login” privilege set to true and is already logged on to the entity will not automatically be logged into the job unless they explicitly do so. Any user who has the “Require job based login” privilege set to false and is currently logged into the entity will automatically be logged on to this job.
If the supplied labor code or the department code is null, then the default labor code or department code assigned to the user is used. If a default *_code is not specified for this user (in the User_Name table), then default values from the entity (labor_exec.def_lab_cd, .def_dept_id) are used. If the entity does not have such default values configured, then a random labor code and department code is used while logging this user to an entity.
If the user has logged on to other entities, then the labor percentage is proportionately divided among all the other entities to end up with 100%. Thus, this entity’s share is calculated on the fly by accounting an average value from the other entities. Thus, the percentage of labor allocated to other entities/jobs is adjusted to reflect the correct share of percentage that receives it. If the user has already logged on to this entity, but to a different job, then the average percentage among the number of jobs running on this entity is allocated to this job. However, the labor percentage in the labor_usage table is not recalculated/adjusted for the other entities, but to other jobs running on this entity.
The labor description from the previous two paragraphs is applicable if and only if the supplied entity can capture labor (i.e., ent.can_capture_labor is turned on), and the system attribute to account for the user’s labor time cannot exceed or fall below 100%. If the supplied entity is configured not to capture labor time (ent.can_capture_labor is turned off), then the labor time will not be accounted for the user who is logging into this entity.
If the system attribute “Allow user to account for less than 100% of his time” (attr_id=188) is turned on, then the system does not adjust the labor percentage for a user when it falls below 100% Also, if the system attribute “Allow user to account for more than 100% of his time” (attr_id=189) is turned on, then the system does not adjust the labor percentage for a user when it exceeds 100%.
Finally, the user login is recorded in the Ent_Logon table to identify the session and entity that the user has logged onto. If there are multiple jobs running on the supplied entity, then the last row (row_id) from the Labor_Usage table identifying the supplied user who is active on this entity is used to update the ent_logon.cur_lab_usage_log_id column.
The following conditions must be true for this method to succeed:
- The supplied session ID exists in the Sessn table.
- The supplied work order, operation, and job sequence number must not be null.
- The supplied job and entity exist in the database.
- The supplied user has a valid process (wo.process)/item (wo.item) certification to log onto this job.
- The supplied user’s certification level must be at least equal or higher than the certification level assigned to this process (wo.process)/item (wo.item) linked to this job.
- The supplied user’s certification has not expired.
- The number of simultaneous users already logged onto this entity is below the maximum limit.