StartShift(Int32,Int32,Int32,DateTime,DateTime,Nullable<Int32>,String,String,String,String) Method
- Last UpdatedMar 17, 2026
- 3 minute read
The StartShift() method starts or ends a shift for the specified entity and its children.
This overload of the method includes the following input parameters:
- newShiftEndUtc
- newPatternId
- shiftComments
- exclusionEntList
- shiftEndAdjustEntListJson
It also includes the shiftChangeEntListJson output parameter.
'Declaration
Public Overloads Shared Sub StartShift( _
ByVal sessionId As Integer, _
ByVal shiftEntId As Integer, _
ByVal newShiftId As Integer, _
ByVal newShiftStartUtc As Date, _
ByVal newShiftEndUtc As Date, _
ByVal newPatternId As Nullable(Of Integer), _
ByVal shiftComments As String, _
ByVal exclusionEntList As String, _
ByVal shiftEndAdjustEntListJson As String, _
ByRef shiftChangeEntListJson As String _
)
'Usage
Dim sessionId As Integer
Dim shiftEntId As Integer
Dim newShiftId As Integer
Dim newShiftStartUtc As Date
Dim newShiftEndUtc As Date
Dim newPatternId As Nullable(Of Integer)
Dim shiftComments As String
Dim exclusionEntList As String
Dim shiftEndAdjustEntListJson As String
Dim shiftChangeEntListJson As String
Ent.StartShift(sessionId, shiftEntId, newShiftId, newShiftStartUtc, newShiftEndUtc, newPatternId, shiftComments, exclusionEntList, shiftEndAdjustEntListJson, shiftChangeEntListJson)
public static void StartShift(
int sessionId,
int shiftEntId,
int newShiftId,
DateTime newShiftStartUtc,
DateTime newShiftEndUtc,
Nullable<int> newPatternId,
string shiftComments,
string exclusionEntList,
string shiftEndAdjustEntListJson,
out string shiftChangeEntListJson
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making a call to this method.
- shiftEntId
- Required. Holds the ID of the entity on which to start or end the shift.
- newShiftId
- Required. Holds the ID of the shift to start or end.
- newShiftStartUtc
- Required. Holds the start time in UTC identifying the start time of the shift.
- newShiftEndUtc
- Required. Holds the start time in UTC identifying the end time of the shift.
- newPatternId
- Optional. Identifies the pattern that is used to derive this shift schedule.
- shiftComments
- Optional. Additional information to be logged in shift history for this shift change.
- exclusionEntList
- Optional. A list of child entities, separated by comma, to be excluded from this shift change.
- shiftEndAdjustEntListJson
- Optional. A list of child entities, in JSON format, that have different shift end times than the parent entity that is changing its shift. For more information, see Remarks below.
- shiftChangeEntListJson
- Output. A list of entities whose shifts have changed, in JSON format. For more information, see Remarks below.
shiftEndAdjustEntListJson Input Parameter
The following example shows the JSON parameter structure for the shiftEndAdjustEntListJson input parameter:
[
{ "ent_id": 8, "ent_name": "SF-Packer", "shift_end_utc": "2021-01-11T12:05:00Z", "shift_end_local": "2021-01-11T04:05:00"},
{"ent_id": 9, "ent_name": "SF-Grinder", "shift_end_utc": "2021-01-11T14:05:00Z", "shift_end_local": "2021-01-11T06:05:00"}
]
This parameter indicates a list of entities (if any) that have a different end time than the parent entity. For example, say the parent entity is running on a regular shift. However, there might be an exception shift assigned to a downstream entity that is starting in the middle of the parent entity's shift. Therefore, for those downstream entities, the end time of the shifts must be adjusted according to the start time of the next shift from the exception patterns.
shiftChangeEntListJson Output Parameter
The output JSON string includes one or more entities with their properties and the shift change data.
The JSON output includes:
ent_id The entity that has its shift changed.
ent_name The name of the entity.
can_run_jobs, etc. Flags that indicate whether this entity is capable of certain functions such as running jobs, etc.
shift start time The time the shift has changed.
The following is an example of an output JSON string.
[{"ent_id":1,"ent_name":"Plant","can_run_jobs":false,"can_capture_labor":false,"can_log_data":false, "can_capture_qm_data":false,"cur_pattern_id":null,"cur_shift_id":0, "cur_shift_start_time_utc":"1900-01-01T00:00:00", "cur_shift_start_time_local":"1900-01-01T00:00:00", "cur_shift_end_time_utc":null,"cur_shift_end_time_local":null,"qm_error_desc":null, "post_shift_change_error_desc":null}, {"ent_id":2,"ent_name":"Machine01_000","can_run_jobs":true,"can_capture_labor":true, "can_log_data":false,"can_capture_qm_data":false,"cur_pattern_id":null,"cur_shift_id":0, "cur_shift_start_time_utc":"1900-01-01T00:00:00","cur_shift_start_time_local":"1900-01-01T00:00:00", "cur_shift_end_time_utc":null,"cur_shift_end_time_local":null,"qm_error_desc":null, "post_shift_change_error_desc":null}, {"ent_id":3,"ent_name":"Holding_000","can_run_jobs":false,"can_capture_labor":false,"can_log_data":false, "can_capture_qm_data":false,"cur_pattern_id":null,"cur_shift_id":0, "cur_shift_start_time_utc":"1900-01-01T00:00:00","cur_shift_start_time_local":"1900-01-01T00:00:00", "cur_shift_end_time_utc":null,"cur_shift_end_time_local":null,"qm_error_desc":null, "post_shift_change_error_desc":null}]
shiftEndAdjustEntListJson