Task

  1. Object tooltip

A Task is an assignment to an object to visit a given location. As a rule, this is used when organizing the processes of delivering goods to consumers. But there may be other use cases for using this functionality of the service. For example, a plan for visiting patients by doctors, receiving packages from customers and delivering them to other places, etc.

Task list table

To display the task list, click on Task in the web application's BarMenu. If the element is not found in the BarMenu, it is added using the BarMenu/Organizer in Account panel.
The header of the panel contains icon-buttons: Refresh list, Filter the list and create a new task - Create order.
Task rows are colored according to states: light gray - the task has been created, blue - the task has been started, red - the task has been canceled, green - the task has been finished.
The completion of the task is set in the script of the object/group (see examples below).
The list can be filtered by task state.
The tasks in the list are sorted in reverse chronological order (by created time).
Clicking on the task row opens the panel of the task.

Task panel

Order Required field, unique within an account. Length from 1 to 128 characters.

Address The field that specifies the address of the task. To set the address, you need to click on the button in this field, and a panel opens in which you can find the required address or set it on the map. The field is required to start the task.

Delivery content A field that specifies the content of the task. Field length up to 16000 characters The field is required to start the task.

Param The field in which additional task parameters are set: weight, content size, minimum battery level for delivery. When you click on the button in this field, a panel opens in which the necessary values are set. The field is optional.

Transport This field selects an object for the task. Objects that are not currently performing tasks and whose global parameters satisfy the values specified in the previous field are available for selection.

Use case 1

If an object arrives in the zone of the specified address (within a radius of 200m), then the message "Task completed" is generated and the status of the task is set to "Finished".
When a task is completed or canceled, the object becomes available for new tasks.
The icon of the object in the table and on the map is colored according to the legend: blue - the task is running, green - the task is completed, light gray - the object is available for new tasks.

The program to be added to the object script in the .module onMessage module:


String state = getTaskState();
if (state!=null) {
Integer dist;
switch (state) {
case EXEC:
  dist  = getDistanceTo(getStringVar("TASK_LL"));
  if ((dist!=null) && (dist<200)) {
    eventAdd("Task completed");
    setTaskState(DONE);
    setIconColor("00DD00");
  } else {
    setIconColor("0094FF");
  }
  break;
case CANC:
  setTaskState(IDLE);
  setIconColor("EEEEEE");
  break;
case DONE:
  setIconColor("EEEEEE");
  setTaskState(IDLE);
  break;
}}

Use case 2

The example is similar to the one above, except that when a task is completed or canceled, the object becomes available for new tasks when it returns to the object's base.
Base coordinates (latitude, longitude) must be specified in the global object parameters in the OBJ_BASE variable.


.module onMessage
String state = getTaskState();
if (state!=null) {
Integer dist;
switch (state) {
case EXEC:
  dist  = getDistanceTo(getStringVar("TASK_LL"));
  if ((dist!=null) && (dist<200)) {
    eventAdd("Task completed");
    setTaskState(DONE);
    setIconColor("00DD00");
  } else {
    setIconColor("0094FF");
  }
  break;
case DONE:
case CANC:
  dist  = getDistanceTo(getGlobalStr("OBJ_BASE"));
  if ((dist!=null) && (dist<200)) {
    setTaskState(IDLE);
    setIconColor("EEEEEE");
  } else {
    if (state.equals(CANC)) {
      setIconColor("DD0000");
    }
  }
  break;
}}
Back Directory

top