Skip to main content

Order

An order is a record storing information related to a set of tasks.

Life cycle​

CREATED / RESERVED → ROUTED → ONGOING → COMPLETED, or FAILED / CANCELED. See Order lifecycle.

Fields​

tasks​

This is a collection of jobs related to an orders.

task.type*​

Can either be pickup, delivery, service or replacement

task.type_alias​

Accepts any string. Can be used as a label/alias for a task.type. For example a you could alias a pickup type as "warehouse-picking-and-packing" and as well delivery as "customer-delivery".

tasks.places​

A record for defining the where and when for executing tasks.

tasks.places.location_id​

A reference to location

tasks.places.duration​

The service time at the stop, in minutes.

tasks.places.time_windows​

A collection of time windows with each element specifying start and end times. start and end date strings for ISO 8601

{
"start": "string",
"end": "string"
}

tasks.places.amounts​

This is a kv field used to define load / demand / capacity of goods.

Used when optimizing to match with fleet_actors (vehicles) capacity.

Example:

{
"kg": 10,
"pallets": 1
}

amounts​

This is a kv field used to define load / demand / capacity of goods.

Used when optimizing to match with fleet_actors (vehicles) capacity.

Example:

{
"kg": 10,
"pallets": 1
}

group​

Used to mark orders' and specify whether they could be mixed with other types of orders when they are getting assigned to routes. For example, it can be used to specify and add a constraint that orders with group of "gas" are not mixed with anythin else during fulfilment.

compatibility​

Used to define which groups are compatible so they could be considered to get assigned to the same route and handled at the same time.

vehicle_skills​

Used to specify which required skills for a given order. If

vehicle_skills.allOf​

Will require vehicles to have all of the skills specified

vehicle_skills.oneOf​

Will require vehicles to only have any of the skills specified

vehicle_skills.noneOf​

Only vehicles without the specified skills would be considered for assignment.

status​

The lifecycle status of an order.

Source of truth

OrderStatus in zoopit/orders, schemas/base.ts. If this table and that type disagree, the type is right and this page is a bug.

ValueMeaning
CREATEDThe order exists but has not been committed to a delivery
RESERVEDCommitted to be delivered, not yet assigned to a route
ROUTEDAssigned to a route
ONGOINGThe route is being executed and at least one task on this order is still outstanding
COMPLETEDEvery task on the order reached a terminal outcome
FAILEDThe last attempt failed
CANCELEDThe order will not be delivered
FAILED is not terminal

Only COMPLETED and CANCELED are final. A failed stop returns to the unplanned queue and may be re-planned, so an order can be FAILED today and COMPLETED tomorrow. Do not close an order in your own system on FAILED, and do not treat a second transition on the same order as a duplicate.

Why, not just what

status says an order finished. status_reason says why it finished that way — delivered to the neighbour, left at the door, recipient absent. That is usually the field an integration acts on.

task_status​

The outcome of the most recently completed task, as `${PICKUP|DELIVERY|SERVICE|REPLACEMENT}_${COMPLETED|FAILED}` — for example DELIVERY_COMPLETED. null until a task reaches an outcome.

Where status describes the order as a whole, task_status describes what physically happened last. An order carrying both a pickup and a delivery passes through PICKUP_COMPLETED while status is still ONGOING.

reference_id​

User specified reference key. Can be used as users' internal reference key.

route_id​

A reference to the route where the order has been assigned.