Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Neste exemplo, temos uma requisição para Planning API com integração a Trip API para resolver um problema logístico de 2 veículos e 10 operações, partindo do centro de distribuição.


Parâmetros utilizados

Planning:

"optimizationProfile": "BRAZIL46". Para essa simulação, foi usado o perfil de otimização BRAZIL46. Para os tipos disponíveis, verifique em optimizationProfile.

"tripsProfile": "MAPLINKBRMAPLINK". Utilizamos o perfil que contém o mapa mais atualizado e configurado para utilizar o modo de cálculo para utilizar vias mais rápidas.

...

"freight": Foram definidos os parâmetros que retornam os cálculos referente ao Piso Mínimo do Frete.

Request

Code Block
languagejson
{
    "optimizationProfile": "BRAZIL46",
    "tripsProfile": "MAPLINKBRMAPLINK",
    "startDate": 1620298800000,
    "legislationProfiles": [
        {
            "name": "DEFAULT"
        }
    ],
    "logisticConstraints": [
        {
            "name": "P1Pickup",
            "siteLoadingFixedTime": 1800
        },
        {
            "name": "P1Delivery",
            "siteUnloadingFixedTime": 300
        }
    ],
    "products": [
        {
            "name": "DEFAULT"
        }
    ],
    "sites": [
        {
            "name": "Cliente1",
            "coordinates": {
                "latitude": -23.507608,
                "longitude": -46.587145
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente2",
            "coordinates": {
                "latitude": -23.621059,
                "longitude": -46.756193
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente3",
            "coordinates": {
                "latitude": -23.44935,
                "longitude": -46.588822
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente4",
            "coordinates": {
                "latitude": -23.751801,
                "longitude": -46.698468
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente5",
            "coordinates": {
                "latitude": -23.520565,
                "longitude": -46.508478
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente6",
            "coordinates": {
                "latitude": -23.506592,
                "longitude": -46.524707
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente7",
            "coordinates": {
                "latitude": -23.646993,
                "longitude": -46.779077
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente8",
            "coordinates": {
                "latitude": -23.373816,
                "longitude": -46.57777
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente9",
            "coordinates": {
                "latitude": -23.476158,
                "longitude": -46.640241
            },
            "logisticConstraints": "P1Delivery"
        },
        {
            "name": "Cliente10",
            "coordinates": {
                "latitude": -23.761565,
                "longitude": -46.655746
            },
            "logisticConstraints": "P1Delivery"
        }
    ],
    "depots": [
        {
            "name": "CD",
            "coordinates": {
                "latitude": -23.503939,
                "longitude": -46.498419
            },
            "logisticConstraints": "P1Pickup"
        }
    ],
    "vehicleTypes": [
        {
            "name": "3/4",
            "maxWeight": 15000,
            "maxVolume": 30,
            "size": 1
        }
    ],
    "vehicles": [
        {
            "name": "3/4_1",
            "vehicleType": "3/4",
            "legislationProfile": "DEFAULT",
            "availablePeriods": [
                {
                    "departureSite": "CD",
                    "arrivalSite": "CD",
                    "maxRoutesNumber": 1,
                    "timeWindow": {
                        "start": 1620298800000,
                        "end": 1620334800000
                    }
                }
            ]
        },
        {
            "name": "3/4_2",
            "vehicleType": "3/4",
            "legislationProfile": "DEFAULT",
            "availablePeriods": [
                {
                    "departureSite": "CD",
                    "arrivalSite": "CD",
                    "maxRoutesNumber": 1,
                    "timeWindow": {
                        "start": 1620298800000,
                        "end": 1620334800000
                    }
                }
            ]
        }
    ],
    "operations": [
        {
            "id": "P1",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente1",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P2",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente2",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P3",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente3",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P4",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente4",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P5",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente4",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P6",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente6",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P7",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente7",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P8",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente8",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P9",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente9",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        },
        {
            "id": "P10",
            "weight": 2,
            "volume": 2,
            "product": "DEFAULT",
            "type": "DELIVERY",
            "depotSite": "CD",
            "customerSite": "Cliente10",
            "customerTimeWindows": [
                {
                    "start": 1620302400000,
                    "end": 1620309600000
                }
            ]
        }
    ],
    "trip": {
        "calculationMode": "THE_FASTEST",
        "crossedBorders": {
            "level": "CITY"
        },
        "toll": {
            "vehicleType": "TRUCK_WITH_TWO_DOUBLE_AXLES"
        },
        "freight": {
            "operationType": [
                "A",
                "D"
            ],
            "goodsType": [
                "GRANEL_LIQUIDO",
                "GRANEL_SOLIDO"
            ],
            "axis": [
                "2",
                "4"
            ],
            "roundTrip": false,
            "backEmpty": false,
            "otherCosts": [
                {
                    "name": "ICMS",
                    "type": "PERCENT",
                    "value": "5"
                },
                {
                    "name": "Lucro",
                    "type": "PERCENT",
                    "value": "20"
                },
                {
                    "name": "TaxaFixa",
                    "type": "FIXED",
                    "value": "500"
                }
            ],
            "date": "2021-10-02"
        }
    }
}


Response

Na resposta da API, em cada rota irá constar o tripId, que poderá ser consultada através do endpoint https://api.maplink.global/trip/v1/solutions/{{tripjobid}}.

A resposta abaixo encontra-se truncada para facilitar a leitura.

Code Block
languagejson
{
    "id": "62ff87d0c19aa95741dfff68",
    "clientId": "maplink",
    "vehicleRoutes": [
        {
            "routes": [
                {
                    "id": "NewRoute_1_1",
                    "activities": [
                        {
                            "activity": "ROUTE_START",
                            "timeWindow": {
                                "start": 1620298800000,
                                "end": 1620298800000
                            },
                            "type": "SITE",
                            "site": "CD",
                            "operations": []
                        },
                        ---- TRUNCADO
                        {
                            "activity": "ROUTE_END",
                            "timeWindow": {
                                "start": 1620311708000,
                                "end": 1620311708000
                            },
                            "type": "SITE",
                            "site": "CD",
                            "operations": []
                        }
                    ],
                    "tripId": "62ff87d4c007780a2ed8f7cb"
                }
            ],
            "vehicle": "3/4_1",
            "period": {
                "timeWindow": {
                    "start": 1620298800000,
                    "end": 1620334800000
                },
                "departureSite": "CD",
                "arrivalSite": "CD",
                "maxRoutesNumber": 1
            }
        },
        {
            "routes": [
                {
                    "id": "NewRoute_2_1",
                    "activities": [
                        {
                            "activity": "ROUTE_START",
                            "timeWindow": {
                                "start": 1620299268000,
                                "end": 1620299268000
                            },
                            "type": "SITE",
                            "site": "CD",
                            "operations": []
                        },
                        ---- TRUNCADO
                        {
                            "activity": "ROUTE_END",
                            "timeWindow": {
                                "start": 1620308938000,
                                "end": 1620308938000
                            },
                            "type": "SITE",
                            "site": "CD",
                            "operations": []
                        }
                    ],
                    "tripId": "62ff87d4eeeb972ff55c6f16"
                }
            ],
            "vehicle": "3/4_2",
            "period": {
                "timeWindow": {
                    "start": 1620298800000,
                    "end": 1620334800000
                },
                "departureSite": "CD",
                "arrivalSite": "CD",
                "maxRoutesNumber": 1
            }
        }
    ],
    "indicators": {
        "totalServiceTime": 6300,
        "totalDeliveringTime": 2700,
        "dayWorkingTotalTime": 22578,
        "nightWorkingTotalTime": 0,
        "totalUnloadingTime": 0,
        "totalWorkingTime": 22578,
        "totalCollectingTime": 0,
        "timeWindowNumber": 2,
        "totalDrivingTime": 16278,
        "totalLoadingTime": 3600,
        "totalTime": 22578,
        "totalDistance": 191609,
        "averageOccupancyRateVolume": 33.33,
        "averageOccupancyRateWeight": 0.07,
        "rejectOperationsNumber": 0,
        "totalWaitingTime": 0,
        "totalRestTime": 0,
        "routesNumber": 2,
        "tollCosts": 0
 
  },     "pendingTasks": {}
}


A resposta completa pode ser obtida no arquivo em anexo.

...

Indicador

Resultado

Tempo total de serviço

01:45:00

Tempo total de entrega

00:45:00

Tempo total do dia de trabalho diurno

06:16:18

Tempo total de trabalho noturno

00:00:00

Tempo total de descarregamento

00:00:00

Tempo total de trabalho

06:16:18

Tempo total de coleta

00:00:00

Número de janelas de horário

2

Tempo total de condução

04:31:18

Tempo total de carregamento

01:00:00

Tempo total

06:16:18

Distância total

191.61 km

Taxa de ocupação média em Volume

33.33

Taxa de ocupação média em Peso

0.07

Número de rejeições

0

Tempo total de espera

00:00:00

Tempo total de descanso

00:00:00

Número de rotas

2

...