Create/update

Basic method to work with orders is order/update:

svc=order/update&params={"n":<text>,
			 "p": {
			       "ut":<long>,
			       "ntf":<uint>,       /* notifications flags */
			       "r":{
			       	    "ndt":<uint>,  /* time to notify customer before assumed delivery time, s */
			            ...
			           }
			       ... 
			 },
			 "rp":<text>,
			 "f":<uint>,	
			 "tf":<uint>,	
			 "tt":<uint>, 
			 "trt":<uint>,	
			 "r":<uint>,	
			 "y":<double>,	
			 "x":<double>,	
			 "u":<long>,
			 "itemId":<long>,
			 "id":<long>,
			 "ej": {}, /* extended json (optional) */ 
			 "tz":<int>,
			 "callMode":<text>,
			 "dp":"[<uint>,..]" /* array of dependent orders IDs */			
}

To delete an order:

svc=order/update&params={"itemId":<long>,
			 "id":<long>,
			 "callMode":"delete"}

To manually move order to history:

svc=order/update&params={"itemId":<long>,
			 "id":<long>,
			 "callMode":"register"}

To assign unit to order:

svc=order/update&params={"itemId":<long>,
			 "id":<long>,
			 "u":<long>,	
			 "callMode":"assign"}

To reject order:

svc=order/update&params={"itemId":<long>,
			 "id":<long>,
			 "callMode":"reject"}

To confirm order:

svc=order/update&params={"itemId":<long>,
			 "id":<long>,
			 "callMode":"confirm"}

Parameters

Name Description
n order name
p user-defined data object (in any case define at least empty object in the param: p:{})
x order point longitude
y order point lattitude
r order point radius, m
rp order route
f order flags
tf and tt bounds of order completion time, lower time and upper time accordingly, UNIX-time
trt acceptable time of advancing the schedule, s
u unit id (you may state id:0 to assign unit to order later)
ut time to order unloading, s
itemId resource id
id order id within resource
tz временная зона пользователя
callMode call mode: “create”, “update”, “delete”, “register” (move order to history),
“assign” (assign unit to order), “reject”, “confirm” - mark as completed

:!: x, y и r parameters form area that assigned unit should visit to complete order.

Flags (f)

ValueDescription
0x1 order would be marked as completed if there were at least one message within order area with zero speed in it;
0x2 order will be completed after leaving the order area;
0x4 start warehouse;
0x8 final warehouse;
0x10 reload warehouse
0x20 fixed order


:!: Flags 0x8,0x10 considered in optimization, only if orders are in “warehouses” array.

How to start?

  • Create an order with callMode:“create” (if no unit is assigned to order then order details response will return s:0);
  • Assign unit to the order using callMode:“assign” (order details response will return s:1);
  • Manually move an order to hostory using callMode:“register”.

Response

callMode=create:

[<​uint>,{ 	
	"​id":<​uint>,	/* order id */
	"​n":<​text>,/* order name */
	"​p":{		/​* ser-defined object content */
	    "n":<text>,		/* client name */
	    "p":<text>,		/* phone */
	    "p2":<text>,	/* second phone */
	    "e":<text>,         /* email */
	    "a":<text>,         /* address */
	    "v":<uint>,         /* volume */
	    "w":<uint>,         /* weight, kg */
	    "c":<uint>,         /* cost */
	    "ut":<uint>,        /* time to order unloading,​ s */
	    "t":<text>,         /* type of vehicle */
	    "d":<text>,         /* description */
	    "uic":<text>,       /* number of shipping document */
	    "cid":<text>,       /* custom ID */
	    "cm":<text>,        /* comment from confirm/reject */
	    "aff":<text>,       /* [ warehouse ] list of unit ID's of warehouse ("123,456") */
	    "z":<text>,         /* [ warehouse ] list of geofences of warehouse ("resId_geofenceId,...") */
	    "ntf":<uint>,       /* notification flags */
	    "pr":<uint>,        /* order priority */
	    "r": {	/* route infotmation */
		 "id":<uint>,   /* route id */
		 "i":<uint>,    /* number [0..] */
		 "m":<uint>,    /* mileage from previous point according to the plan, m */
		 "t":<uint>,    /* time from previous point according to the plan, s */
		 "ndt":<uint>,  /* time to notify customer before assumed delivery time, s */
		 "vt":<uint>    /* visit time according to the plan, UNIX_TIME */
	    },
	"​rp":<text>,/​* order route */
	"​f":<​uint>,/​* order flags */
	"tf":<​uint>,/​* lower bound of order completion time, UNIX-time */ 	
	"​tt":<​uint>,/​* upper bound of order completion time, UNIX-time */ 	
	"​trt":<​uint>,/​* acceptable time of advancing the schedule, s */ 	
	"​uid":<​uint>,/​* ​unique ​id (is used as unique key in order history)  */ 	
	"​r":<​uint>,/​* order point radius, m */ 	
	"​y":<​double>,/​* order point latitude */ 	
	"​x":<​double>,/​* order point longitude */ 	
	"​u":<​long>,/​* unit id */ 	
	"​s":<​uint>,/​* order status:​ 0 - inactive (unit not binded),​ 1 - active,​ 2 - completed on time, 3 - completed late, 4  rejected, 5 - unit is in the order area */ 	
	"​sf":<​uint>,/​* order status flag (0x100 - rejected,​ 0x200 - confirmed, 0x400 - order is notifited) */ 	
	"​st":<​uint>,/​* last status modification time */ 
	"tz":<uint>    /* временная зона пользователя */	
	}	
]

callMode=callMode=update:

[
	<uint>		/* updated order "id" */
]

callMode=delete:

[
	<uint>,		/* deleted order "id" */
	null
]

callMode=assign,register,reject:

{ }	/* success */

or

{
	"error":4	/* if failed to assign */
}
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam