GetQueue Method
- Last UpdatedNov 06, 2025
- 5 minute read
'Declaration
Public Shared Function GetQueue( _
ByVal entId As Integer, _
ByVal maxRows As Nullable(Of Integer) _
) As DataSet
'Usage
Dim entId As Integer
Dim maxRows As Nullable(Of Integer)
Dim value As DataSet
value = JobExec.GetQueue(entId, maxRows)
public static DataSet GetQueue(
int entId,
Nullable<int> maxRows
)
Parameters
- entId
- Required. Holds the ID of the entity for which the job queue is being retrieved.
- maxRows
- Optional. Holds the maximum number of rows to include in the returned DataSet.
Return Value
Returns a DataSet that contains records for all the jobs in the specified entity's job queue that also match the specified filters. If no matching jobs are found, an empty DataSet is returned.
The columns of the returned DataSet are described below.
|
Column Name |
Description |
|---|---|
|
job.* |
All columns from the Job table are included in the DataSet. Additionally, the values from the datetime columns other than the edit_time column are returned in client’s local time by excluding the offset name. For example, an additional column req_finish_time identifying the required finish time derived from req_finish_time_utc for a job is returned in client’s local time, etc. |
|
wo_desc |
A string that is the description of the work order, from the wo.wo_desc column linked to this job. |
|
req_qty |
A double that is the quantity of item required, from the wo.req_qty column linked to this job. |
|
mo_id |
A string that is the ID of the manufacturing order for grouping different final parts, from the wo.mo_id column linked to this job. |
|
item_desc |
A string that is the description of the item, from the item.item_desc column linked to this job. |
|
state_desc |
A string that is the description of the job state, from the job_state.state_desc column linked to this job and thus the job’s state. |
|
color |
A long value that identifies the background color that should be displayed on the user interface when this job is selected. |
|
ent_name |
A string that is the name of the entity, from the ent.ent_name column linked to the job.target_sched_ent_id column for this job. |
|
run_ent_name |
A string that is the name of the entity, from the ent.ent_name column linked to the job.run_ent_id column for this job. |
|
item_spare1 |
A string that is the contents of the user-defined item spare1 field, from the item.spare1 linked to the item for this job. |
|
item_spare2 |
A string that is the contents of the user-defined item spare2 field, from the item.spare2 linked to the item for this job. |
|
item_spare3 |
A string that is the contents of the user-defined item spare3 field, from the item.spare3 linked to the item for this job. |
|
item_spare4 |
A string that is the contents of the user-defined item spare4 field, from the item.spare4 linked to the item for this job. |
|
lifetime |
An integer that is the lifetime, in days, of this item before it expires, from the item.lifetime column linked to this item resulting from the job. |
|
description |
A string that is the description of the unit of measurement for this item, from the uom.description linked to this item resulting from the job. |
|
abbreviation |
A string that is the abbreviation for the unit of measurement for this item, from the uom.abbreviation column linked to this item resulting from the job. |
|
def_lot_no |
A string that is the default lot number, from the job_bom.def_lot_no for BOM position 0 linked to this job. |
|
process_id |
A string that is the process ID, from the wo.process_id column linked to the work order from the job. |
For optional input parameters that are not to be included as a filter, pass a null.
First, this method extracts the filter value from the Job_Sched_Exec table linked to the supplied entity.
The following filters are always verified and these filters are applied only when the value is greater than 0. If more than one filter criteria are specified in the job schedule for this entity (job_sched_exec), then the filter criteria are ORed.
- Cancelled: If > 0, the current time is subtracted by this value in hours. Thus, only jobs that are cancelled (state_cd = 7) after this time are included in the DataSet
-
Completed: If > 0, the current time is subtracted by this value in hours. Thus, only jobs that are completed (state_cd = 4) after this time are included in the DataSet.
-
First_Job: If > 0, then all jobs whose first job flag set to 1 (true) are included in the DataSet.
-
Job State Filter: If a non-empty value is configured for this filter, then the DataSet is filtered with those job states. This may include 0 or more job states.
-
Miscellaneous Filters: Any other filters other than the filters specified above are applied exactly as they are specified, and the values are compared using the LIKE operator. Thus, any row(s) matching the filter pattern are included in the DataSet. Miscellaneous filters include item ID, item description, work order ID, operation ID, and sequence number.
-
Sort Columns: The DataSet is sorted by the first three columns specified in the sort_order column of the job_shed_exec record for the entity. A column name configured for the sort column is used exactly as they are specified, and the order configured for the sort type is used exactly as they are specified. For example, if the sort_order is configured as $SortColumn=req_finish_time_utc$$SortType=ASC$, then the req_finish_time_utc column name is used exactly in the order by clause of the SQL, which sorts this column in the ascending order. The same mechanism is applied to the next two sort order columns accordingly. However, there is an exception to the sort order column when then sort order column contains a name ‘STATE_CD’ or ‘STATE_DESC’. If any of these column names are specified as a part of the sort column in the Job_Sched_Exec table, then this name is ignored. The Middleware immediately extracts the attribute id:247 from the System_Attribute table to determine the column name that should be used in place of the column name specified in the Job_Sched_Exec table. If a value for this system attribute is 0, then state_cd column is used to sort the records. Otherwise, the state_desc column is used to sort the records.
The following filters are applied while retrieving the records from the database:
- Recursively loops through the ancestor entities linking the supplied entity regardless of the preferred parent until it reaches the entity that cannot schedule jobs (can_sched_jobs set to false). The DataSet is filtered by the list of entities that are identified in the previous step.
- Those work orders that are closed are excluded from the DataSet (wo.state_cd = 3).
- All other filters (job_sched_exec.filtr) specified above are applied to the DataSet, and filters are ANDed in the Where clause.
- Any job(s) that are currently running on an entity other than the supplied entity are excluded.
- If the supplied max_rows parameter contains a value greater than 0, then the number of records (record count) returned in the DataSet are restricted to this number. Otherwise, the DataSet is not restricted by the number of rows.