Jobs and Objectives

Introduction to Jobs

A Job is the sequence of workflows to be executed to complete a single leg of an expected path of an order (point to point). An expected path is a path/route for the movement of the Participants and/or Containers to fulfill an order. Each segment of the route is referred to as a Job (Legs).

Examples:

  1. For the order ‘Pickup shipment from location A and deliver it to location B’, the expected path could have three legs/jobs:
19201920
  1. For the order ‘Go to location B and install the refrigerator’, the expected path could have just one leg/job:
19201920

To create a Job, call the Create a new job endpoint.

Request bodies are specified in JSON format. The following examples show a request body for creating a Job:

{
    "jobWorkflowId": "jobWorkflow:e768f61e-42bf-4aa6-8ff6-5030114d4307",
    "jobTypeId": "pickuptest:44d87031-f1f7-56b8-9a47-783dc874d2b6",
    "jobRef": "jobRef:02",
    "objectives": [
        {
            "objectiveRef": "Pickup",
            "contact": {
                "name": "Worldlogistic",
                "phone": {
                    "countryCode": "+91",
                    "number": "9900889900",
                    "isMobile": true,
                    "areaCode": "+91"
                }
            },
            "location": {
                "address": {
                    "buildingNumber": "746",
                    "apartmentNumber": "1234",
                    "addressLine1": "housing board colony",
                    "addressLine2": "new housing board colony",
                    "addressLine3": "old street late",
                    "city": "pune",
                    "state": "maharashtra",
                    "zipCode": "112356",
                    "country": {
                        "code": "IND",
                        "name": "india"
                    }
                },
                "geolocation": {
                    "lat": "86.74739",
                    "long": "24.7283"
                }
            },
            "input": {
                "items": [
                    {
                        "skuId": "id1"
                    }
                ],
                "title": "title1"
            }
        }
    ]
}

Attributes of a Job

A job has the following attributes:

Attribute Name

Data Type Expected

Purpose

Tenant ID

UUID

The ID of the tenant to whose data domain the Job belongs.

Job ID
(Optional)

UUID

System generated ID of the Job.

Instructions
(Optional)

Array of JSON

Instruction JSON schema is as follows:

  1. id: Unique ID for instruction.
  2. label: Text label describing the type of instruction.
  3. containers: List of containers associated with this instruction.
  4. location: Location ID of the location where the instruction is to be performed.
  5. contact: Name and contact phone number of the customer (a secure data ID if the real phone number is passed. Masked phone number can be passed directly).
  6. timeSlot: Defines the preferred time slot for executing this instruction. Has two keys from and to which have the start & end epoch time of the time slot.
  7. workflow: Workflow instance ID (Workflow instance is workflow id plus the input data for executing the workflow. The instance is stored in the Workflow service and passed as an ID here.).
  8. next: Has two keys onSuccess and onFailure whose values denote the next instruction to be executed in case of current instruction success and failure respectively.
  9. meta: Additional metadata related to the instruction. This is passed as it is in the meta key of the corresponding objectives in the dispatch. Can be used for any custom value that may be required by the app (e.g., special instructions etc).

To create a custom Job Attribute, call the Post attribute config for job endpoint.

Request bodies are specified in JSON format. The following examples show a request body for creating a custom Job Attribute:

{
  "attributes": [
    {
      "name": "Job Attribute",
      "description": "Description of Job Attribute",
      "tags": [
        "job"
      ],
      "dataType": "number",
      "indexed": false,
      "defaultValue": { "no" : 10 },
      "validation": {
          "range" : {
              "min" : 1,
              "max" : 50
          },
        "required": true
      }
    }
  ]
}

Objectives

An Objective is one or more execution tasks to be performed as a workflow for a Container or set of Containers at a given location.
It is possible that an objective can consist of one or more Service IDs and service IDs in turn can contain one or more Containers. For example, a warehouse pickup can have multiple service ids and associated Containers to pickup.

To complete a shipment, the operator needs to execute a sequence of Jobs (set of actions) associated with it. A Job has the following entities in it: Customer, Location, and Time Slot.

The following describes two different jobs:

  • Pick up shipment s1 from Location-A (between 9 AM & 10 AM) and Deliver to Location-B
  • Pick up shipment s2 from Location-A (between 9 AM & 10 AM) and Deliver to Location-C

If we examine these two jobs, we can see that they contain common areas such as Location-A and the Time Slot for pick-up.

Based on these common areas, we can convert these jobs into Objectives. The Objective can then be defined as a group of jobs to be performed at a particular location.

In this example of 4 different jobs are converted into objectives:

  • Job-1: Pick up shipment s1 from Location-A (between 9 AM & 10 AM) and Deliver to Location-B
  • Job-2: Pick up shipment s2 from Location-A (between 9 AM & 10 AM) and Deliver to Location-C
  • Job-3: Pick up shipment s3 from Location-D and Deliver to Location-C
  • Job-4: Pick up shipment s4 from Location-A (between 3 PM & 4 PM) and Deliver it to Location-E

These jobs are now converted into Objectives based on location & time slots:

Stop

Objective(s)

Location-A

Pick up shipment s1; Pick up shipment s2

Location-B

Deliver shipment s1

Location-D

Pick up shipment s3

Location-C

Deliver shipment s2; Deliver shipment s3

Location-A

Pick up shipment s4

Location-E

Deliver shipment s4

📘

INFO

The Objectives are grouped together by the customer, location, and time slot. For simplicity of explanation, the customer part has been excluded in the above examples.

The purpose of creating Objectives is to enhance the working efficiency of operators and to eliminate areas of human errors.

Lifecycle of a Job

The platform provides a default of five states for an Objective:

  • Created: This state denotes that an Objective has been created.
  • Assigned: This state denotes that the objective has been assigned to a dispatch.
  • In-Progress: The state denotes that the Job is in progress. The event store can give the exact sub-state of this state.
  • Completed: This state denotes that the instruction list of the Job was completed by the Operator.
  • Failed: This state denotes that one of the instructions in the Job has failed. It simply states that the job the Operator had to perform wasn’t completed successfully.
19201920

Did this page help you?