Delivery Planning
Plans
This endpoint can be used just for creating delivery plans (ie. it supports only the POST method).
https://app.xfleet.io/api/v1/companies/{company}/deliveryPlans
Required fields to create a plan
| Field | Type | Description | Example |
|---|---|---|---|
| services | list |
Targets that need to be delivered | [{"name": "...", "lat": ..., "lon": ..., "orders": []}] |
| vehicles | list |
Vehicles used for serving the clients | [ ... ] |
| depot | Depot | Start point for all vehicles | {"id": "..."} |
| returnToDepot | bool | Return to depot after finishing the route | true |
| departureTime | datetime | Date and time of departure | 2019-04-01T09:00:00Z |
| serviceTime | int | Default time (in seconds) it takes to serve each individual customer | 300 |
| weightLoadTime | float | Number of seconds per kilogram it takes to serve each individual customer | 0.5 |
| volumeLoadTime | float | Number of seconds per m3 it takes to serve each individual customer | 30 |
| palletsLoadTime | float | Number of seconds per pallet it takes to serve each individual customer | 100 |
| maxRouteDuration | int | Maximum number of seconds for each route | 28800 |
| maxServicesPerRoute | int | Maximum number of clients for each route | 30 |
| maxRoutes | int | Maximum number of routes that can be created; only values 0 (no limit) and 1 are allowed | 0 |
| maxWeightPerRoute | int | Maximum weight in kg per each route | 1000 |
| maxVolumePerRoute | int | Maximum volume in m3 per each route | 9 |
| maxPalletsPerRoute | int | Maximum number of pallets per each route | 10 |
| groupClientsPerZoneEnabled | bool | Whether or not to generate routes that contain clients from within the same zones | true |
| clientScheduleEnabled | bool | Whether or not to take into account the client delivery schedules | true |
| clientRequiredSkillsEnabled | bool | Whether or not to take into required skills by each client | true |
| vehicleWeightAllocationEnabled | bool | Whether or not to take into vehicle weight limits when assigning vehicles | true |
| vehicleVolumeAllocationEnabled | bool | Whether or not to take into vehicle volume limits when assigning vehicles | true |
| vehiclePalletsAllocationEnabled | bool | Whether or not to take into vehicle pallets limits when assigning vehicles | true |
| vehicleZoneAllocationEnabled | bool | Enable allocation of vehicles based on client zones. ie: a client from zone A, can be delievered only by vehicles that are allocated to zone A | true |
| vehicleScheduleEnabled | bool | Enable allocation of vehicles based on their schedule | true |
| multiRouteVehicleAllocationEnabled | bool | Allocate same vehicle to multiple routes | true |
| pointToPointSpeed | bool | Point to point speed (in m/s) for simulating the time it takes to get from client to client | 7 |
| simulateTime | bool | Whether or not to use pointToPointSpeed to simulate time |
7 |
Create a new delivery plan
$ curl -H 'Authorization: Token ...' \
-H 'Content-type: application/json' \
-X POST \
-d '{
"services": [
{
"id": 1,
"name": "Sanremo Pizza",
"lat": 40.700273,
"lon": -73.9063134,
"orders": [
{
"id": "2JLZKzC28pyYvdtcseK8JB"
}
],
"client": {
"id": "272fAjFOwIc6MIIW55UCyr"
}
},
{
"id": 2,
"name": "Glendale Pizza",
"lat": 40.701895,
"lon": -73.883638,
"orders": [
{
"id": "3rRAsNZwWKOzSAH6mGvt7h"
}
],
"client": {
"id": "6T3Yl2xdeGZTQFYNPqnx4b"
}
},
...
],
"depot": {
"id": "2P9flmOqSD09WmEDXvXync",
"name": "Central Depot",
"lat": 40.767072,
"lon": -73.8421927
},
"departureTime": "2019-03-17T05:30:00+02:00",
"returnToDepot": false,
"serviceTime": 600,
"maxServicesPerRoute": 100
}' \
https://app.xfleet.io/api/v1/companies/{company}/deliveryPlans
{
"routes": [
{
"services": [
{
"name": "Central Depot",
"lat": 40.767072,
"lon": -73.8421927,
"depot": {
"id": "2P9flmOqSD09WmEDXvXync"
}
},
{
"name": "Glendale Pizza",
"lat": 40.701895,
"lon": -73.883638,
"orders": [
{
"id": "3rRAsNZwWKOzSAH6mGvt7h",
}
],
"client": {
"id": "6T3Yl2xdeGZTQFYNPqnx4b",
}
},
{
"name": "Sanremo Pizza",
"lat": 40.700273,
"lon": -73.9063134,
"orders": [
{
"id": "2JLZKzC28pyYvdtcseK8JB",
}
],
"client": {
"id": "272fAjFOwIc6MIIW55UCyr",
}
}
],
"vehicle": {
"licensePlate": "530X76A8",
"driver": {
"email": "jose.king@xfleet.io",
"name": "Jose King",
"id": "16bniCrowZQhw0fqE8lwgh",
},
"maxWeight": 1195,
"maxPallets": 9.4,
"maxVolume": 2,
"id": "18EXGOMRbSz9Ita6D1MaGr"
}
},
...
]
}