Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:sidebar:remoteapi:apiref:order:update [13/12/2016 17:26]
stan
en:sidebar:remoteapi:apiref:order:update [02/10/2017 11:31]
stan [Create/update]
Line 1: Line 1:
 {{indexmenu_n>​1}} {{indexmenu_n>​1}}
-====== ​Create/​update ​======+====== ​Update order ======
 Basic method to work with orders is **orders/​update**:​ Basic method to work with orders is **orders/​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 ====
 <code javascript>​ <code javascript>​
-svc=order/​update&​params={"​n":<​text>,​ +svc=order/​update&​params={"​itemId":<​long>, ​  /* resource id */ 
- "​p":​ { + "​id":<​long>,​  ​   /* order id (0 if create) */ 
-        "​ut":<​long>, +  "​n":<​text>,​     /* order name */ 
-        "​ntf":<​uint>, ​      ​/* notifications ​flags */ + "oldOrderId":<​long>,​ /​* old oreder id */ 
-        "​r":​{ + "​oldOrderFiles":​[<​text>​],​ /* old order files array */ 
-        ​  ​   ​"​ndt":<​uint>, ​ /* time to notify customer before assumed delivery time, s */ + "​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":<​text>,​  ​   /* route id */ 
 + "​i":<​text>,​  ​   /* number [0..] */ 
 + "​m":<​text>, ​       /* mileage from previous point according to the plan, m */ 
 + "​t":<​text>, ​       /* time from previous point according to the plan, s */ 
 +  "​ndt":<​uint>, ​     /* time to notify customer before assumed delivery time, s */ 
 + "​vt":<​text> ​       /* visit time according to the plan, UNIX_TIME */ 
 +      },
  },  },
- "​rp":<​text>,​ + "​rp":<​text>,​     /​* order route */ 
- "​f":<​uint>,​  + "​f":<​uint>,​     /​* order flags */ 
- "​tf":<​uint>,​  + "​tf":<​uint>,​     /​* lower bound of order completion time, UNIX-time */  
- "​tt":<​uint>,​  + "​tt":<​uint>,​     /​* upper bound of order completion time, UNIX-time */ 
- "​trt":<​uint>,​  + "​trt":<​uint>,​     /​* acceptable time of advancing the schedule, s */  
- "​r":<​uint>,​  + "​r":<​uint>,​     /​* order point radius, m */ 
- "​y":<​double>,​  + "​y":<​double>,​     /​* order point latitude */  
- "​x":<​double>,​  + "​x":<​double>,​     /​* order point longitude */  
- "​u":<​long>,​ + "​u":<​long>,​     /​* unit id */  
- "​itemId":<​long>,​ + "​ej":​ {},     ​/* extended json (optional) */  
- "id":<​long>,​ + "​tz":<​int>,​     /* user time stamp  */ 
- "​ej":​ {}, /* extended json (optional) */  + "​callMode":<​text>, ​/* "​create"/"​delete"​ to create/​delete respectively */
- "​tz":<​int>,​ +
- "​callMode":<​text>,​+
  "​dp":"​[<​uint>,​..]"​ /* array of dependent orders IDs */   "​dp":"​[<​uint>,​..]"​ /* array of dependent orders IDs */
 } }
 </​code>​ </​code>​
  
-To delete an order:+====Deleting ​order====
 <code javascript>​ <code javascript>​
-svc=order/​update&​params={"​itemId":<​long>,​ +svc=order/​update&​params={"​itemId":<​long>, ​  /* resource id */ 
- "​id":<​long>,​+ "​id":<​long>,​     /* order id (0 if create) */
  "​callMode":"​delete"​}  "​callMode":"​delete"​}
 </​code>​ </​code>​
  
-To manually move order to history:+==== Manually moving ​order to history====
 <code javascript>​ <code javascript>​
-svc=order/​update&​params={"​itemId":<​long>,​ +svc=order/​update&​params={"​itemId":<​long>, ​  /* resource id */ 
- "​id":<​long>,​+ "​id":<​long>,​     /* order id (0 if create) */
  "​callMode":"​register"​}  "​callMode":"​register"​}
 </​code>​ </​code>​
  
-To assign ​unit to order:+====Assigning ​unit to order====
 <code javascript>​ <code javascript>​
-svc=order/​update&​params={"​itemId":<​long>,​ +svc=order/​update&​params={"​itemId":<​long>, ​  /* resource id */ 
- "​id":<​long>,​ + "​id":<​long>,​     /* order id (0 if create) */ 
- "​u":<​long>,​ + "​u":<​long>,​     /* unit id */
  "​callMode":"​assign"​}  "​callMode":"​assign"​}
 </​code>​ </​code>​
  
-To reject ​order:+====Rejecting ​order====
 <code javascript>​ <code javascript>​
-svc=order/​update&​params={"​itemId":<​long>,​ +svc=order/​update&​params={"​itemId":<​long>, ​  /* resource id */ 
- "​id":<​long>,​+ "​id":<​long>,​     /* order id (0 if create) */
  "​callMode":"​reject"​}  "​callMode":"​reject"​}
 </​code>​ </​code>​
  
-To confirm ​order:+====Confirming ​order====
 <code javascript>​ <code javascript>​
-svc=order/​update&​params={"​itemId":<​long>,​ +svc=order/​update&​params={"​itemId":<​long>, ​  /* resource id */ 
- "​id":<​long>,​+ "​id":<​long>,​     /* order id (0 if create) */
  "​callMode":"​confirm"​}  "​callMode":"​confirm"​}
 </​code>​ </​code>​
-=====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)====
- +
-=====Flags (f)=====+
 ^Value^Description^ ^Value^Description^
 | 0x1 | order would be marked as completed if there were at least one message within order area with zero speed in it; | | 0x1 | order would be marked as completed if there were at least one message within order area with zero speed in it; |
Line 96: Line 106:
  
 \\ :!: Flags **0x8**,​**0x10** considered in optimization,​ only if orders are in  "​warehouses"​ array. \\ :!: 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 ===== =====Response =====
Line 149: Line 154:
  "​​sf":<​​uint>,​​ /​​* order status flag (0x100 - rejected,​​ 0x200 - confirmed, 0x400 - order is notifited) */   "​​sf":<​​uint>,​​ /​​* order status flag (0x100 - rejected,​​ 0x200 - confirmed, 0x400 - order is notifited) */
  "​​st":<​​uint>,​​ /​​* last status modification time */   "​​st":<​​uint>,​​ /​​* last status modification time */ 
- "​tz":<​uint> ​   /* временная зона пользователя ​*/ + "​tz":<​uint> ​    ​/* user time stamp  ​*/
  }   }
 ]</​code>​ ]</​code>​
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam