Update order

Basic method to work with orders is order/update:

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”.

Create/update

svc=order/update&params={"itemId":<long>,   /* resource id */
			 "id":<long>,	    /* order id (0 if create) */
			 "n":<text>,	    /* order name */
			 "oldOrderId":<long>,	/* old oreder id */
			 "oldOrderFiles":[<text>], 	/* old order files array */
			 "​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: 1 - sms to first phone; 0x2 - sms to second phone; 0x10 - to email*/
			     "pr":<uint>,       /* order priority */
			     "tags":[<uint>],	/* order tags */
			     "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 */ 	
			 "r":<uint>,	    /​* order point radius, m */
			 "y":<double>,	    /​* order point latitude */ 
			 "x":<double>,	    /​* order point longitude */ 
			 "u":<long>,	    /​* unit id */ 
			 "ej": {},	    /* extended json (optional) */ 
			 "tz":<int>,	    /* user time stamp  */
			 "cf":/* order custom fields */
			    {"key1":"key1_value","key2":"key2_value",.....},
			 "callMode":<text>, /* "create"/"delete" to create/delete respectively */
			 "dp":"[<uint>,..]" /* array of dependent orders IDs */			
}

Deleting order

svc=order/update&params={"itemId":<long>,   /* resource id */
			 "id":<long>,	    /* order id (0 if create) */
			 "callMode":"delete"}

Manually moving order to history

svc=order/update&params={"itemId":<long>,   /* resource id */
			 "id":<long>,	    /* order id (0 if create) */
			 "callMode":"register"}

Assigning unit to order

svc=order/update&params={"itemId":<long>,   /* resource id */
			 "id":<long>,	    /* order id (0 if create) */
			 "u":<long>,	    /* unit id */
			 "callMode":"assign"}

Rejecting order

svc=order/update&params={"itemId":<long>,   /* resource id */
			 "id":<long>,	    /* order id (0 if create) */
			 "callMode":"reject"}

Confirming order

svc=order/update&params={"itemId":<long>,   /* resource id */
			 "id":<long>,	    /* order id (0 if create) */
			 "callMode":"confirm"}

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 permanent order
0x40 Confirm possible only in radius
0x80 Do not change status to complete automatically
0x100 in case of auto-completion of the route, a copy of the unvisited application will be created


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

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 */
	         }
              }
	"cmp":{unitRequirements: {values: []}}, /* order requirements */
        "gfn":{},   /* geofences */
        "crt":<uint>,   /* confirm/reject time */
        "ct":<uint>,   /* creation time */
        "mt":<uint>,   /* modify time */
	"​rp":<text>,/​* order route, google polyline encoding format */
	"​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, 0x800 - is_next, 0x1000 - expired, 0x2000 - reassigned) */ 	
	"​st":<​uint>,/​* last status modification time */ 
	"tz":<uint>,     /* user time stamp  */
        "eta":<uint>, /* ETA Time calculated per 180 sec by routing (or streght) if there is next order and activated notification about ETA/milieage(RD) */
      "rd":<​double>, /* mileage */
      "cnm":<​uint>, /* mileage counter from unit */
      "nt":<uint>, /* next_time - time when orders had status 'next' */
      "ds":<uint>, /* status completed, integer passed in parameter 'confirm', for example % */
      "dp":<uint>, /* list of orders uid which allow to current order:the current order cannot be visited until listed orders will be visited first */
      "cf":/* order custom fields */
		{"key1":"key1_value","key2":"key2_value",.....},
      "stt":<uint>, /* start_transfer_time - time arrival */
      "dtt":<uint>, /* done_transfer_time  - exit time */
      "if":<uint> /* internal_flags, below description */
	}	
]

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 */
}

Internal flags(if)

ValueDescription
0x1 Order in transfer
0x2 Driver notified about track deviation to order
0x4 Driver notified about status was not confirmed
0x8 Client notified about old ETA
0x10 Client notified about ETA
0x20 Client notified about RD (mileage)
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam