Job types is optionally defined as site configuration elements. If the site configuration does not contain job types, then a time registration will not prompt the user for a job type.

If however Job types for a site has been configured, then for every time registration, the employee must as a first step select the job type.

Multiple different employees may be checked in on the same operation but for different job types. The same employee may even register on the same operation for two different job types.

This is an example of the Job types the employee must select between, using the configuration shown below

Defining Job types

In version 7.4.2 Job types are defined programmatically. Editing of Job types from a graphical user interface is currently not supported.

The following groovy script shows how to create Job types. The script only need to be executed once. Please see inline comments for an explanation

def ccs = pluginAPI.getBaseModelAPI().getCodeCollectionsService();

// The concept of 'Code collections' are used for storing both
//   'Job types'                     : "TT_JOB_TYPE"
//   'Quantity bad codes'            : "TT_QTY_BAD_CODE"
//   'Reason codes' for Pause/Cancel : "TT_REG_CODE"

// Job type codes
def fill = ccs.build().codeData().id("FILL").name("Filling").description("Bottle filling").color("#6A5F31").tag("TT_JOB_TYPE").tag("TT_REG_CODE").add();

// the "NON_PROD" tag means this job type will not affect progress calculation of new expected end date/time
def jt1 = ccs.build().codeData().id("LABL").name("Labeling").description("Print labels").color("#193737").tag("TT_JOB_TYPE").tag("NON_PROD").addOrUpdate();
def jt2 = ccs.build().codeData().id("PACK").name("Packing").description("Put in boxes").color("#E55137").tag("TT_JOB_TYPE").tag("NON_PROD").add();
def jt3 = ccs.build().codeData().id("SERV").name("Service").description("Service work").color("#317F43").tag("TT_JOB_TYPE").tag("NON_PROD").add();

// Code collections - a collection of job types. The job type code (e.g. jt1, jt2, etc.) are referenced in the 'codes' method call
def jtcc1 = ccs.build()
  .codeCollection()
    .name("Job type codes")
    .codes(jt1, jt2, jt3, fill)
    .tag("TT_JOB_TYPE")
    .add();

def jtcc2 = ccs.build()
  .codeCollection()
    .name("Job type codes")
    .codes(jt3)
    .tag("TT_JOB_TYPE")
    .add();

// Assign the code collection as specific for a certain master operation.
// lookup master operations by name (type is -1)
def masterOpr1 =  pluginAPI.getBaseModelAPI().getOperationsWithType(-1).find { opr -> "Mill med".equalsIgnoreCase(opr.getName()) }

// For Global code collections (available across all master operations), then leave 'target' and 'selector' as empty strings
// key.type: "TT_JOB_TYPE" for Operator usage   key.target: "operation", "resource"  key.selector: empty or id of respectively operation or resource
def selector1 = masterOpr1 == null ? "": masterOpr1.getId()
def target1   = masterOpr1 == null ? "": "operation"
ccs.build().codeCollectionMapping().key("TT_JOB_TYPE", target1, selector1).codeCollection(jtcc1).add();

// do the same for second master operation
def masterOpr2 =  pluginAPI.getBaseModelAPI().getOperationsWithType(-1).find { opr -> "Turn med".equalsIgnoreCase(opr.getName()) }
def selector2 = masterOpr2 == null ? "": masterOpr2.getId()
def target2   = masterOpr2 == null ? "": "operation"
ccs.build().codeCollectionMapping().key("TT_JOB_TYPE", target2, selector2).codeCollection(jtcc2).add();

 

Read more about code data, collections and mappings here.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment