Aviso | ||
---|---|---|
| ||
|
draw.io Diagram | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
TPR: TOTVS Planejamento de Rotas
Sistema Externo: Todos os ERPs que se conectam ou pretendem se conectar com os produtos de planejamento logístico TOTVS.
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPR { get(token: Stringstring, systemInfo: SystemInfo): Promise<TPRServices> } |
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
interface SystemInfo { readonly system: string; readonly version: string; readonly qualifiers: string; readonly callbackURL?: string; } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRServices { createMap(element: HTMLElement, mapOptions: TPRMapOptions): Promise<TPRMap>; } |
Âncora | TPRMapOptions | TPRMapOptions
---|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRMapOptions{
readonly height:Double;
readonly width:Double;
}
|
Âncora | |||
---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRMap{ readonly map: Map; private extent : number[] = createEmptyExtent(); { addMarker(point: TPRPoint, markerOptions?: MarkerOptions): void; viewRoute(route: TPRRoute, routeOptions?: TPRRouteOptions): Promise<TPRMapRoute>; zoomIn(): void; zoomOut(): void; centerOn(point: TPRPoint); centerRoutes(): void; clear(): void; close(): void; } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRPoint {
readonly latitude;
readonly longitude;
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
interface MarkerOptions {
color?: String;
draggable?: boolean;
onDrag?: (latitude: number, longitude: number) => void
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRoute { constructor(publicreadonly trip: TPRTrip, readonly identifier?: string) { } } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRouteOptions { constructor(publicreadonly tooglePopup: boolean) {} } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRMapRoute{ readonly tprMap: TPRMap; { hide(): void; show(): void; color(color?: String); } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRTrip { // Campos do TPRTrip (https://tdn.totvs.com/pages/releaseviewviewpage.action?pageId=604507369) readonly sequential:Integer readonly distance:Double readonly tollValue:Double readonly numberOfStops:Integer readonly volume:Double readonly weight:Double readonly duration:Integer readonly extraTrip:boolean readonly considerReturnDistance: boolean readonly vehicle:stringTPRVehicle readonly stops:TPRTripStop[] } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRVehicle {
readonly identifier: string,
readonly weightCapacity: number,
readonly volumeCapacity: number,
readonly quantity: number,
readonly speed: number,
readonly vehicleType: string,
readonly tollAxes: number,
readonly tollReturnAxes: number
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRTripStop { // Campos do TPRTripStop (https://tdn.totvs.com/pages/releaseviewviewpage.action?pageId=604507369) readonly stopSequencesequence:Integer readonly stopTypetype:String readonly distance:Double, readonly tollValue:Double, readonly locality:TPRRoutingLocality readonly arrivalTime:DateTime readonly departureTime:DateTime readonly loadedOrders:TPRRoutedOrder[] readonly unloadedOrders:TPRRoutedOrder[] } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRoutingLocality { // Campos do TPRRoutingLocality(https://tdn.totvs.com/pages/releaseviewviewpage.action?pageId=604507369) readonly identifier:String readonly name: String readonly country:String readonly latitude:Double readonly longitude:Double readonly operation:String readonly customizedOperation: TPRCustomizedOperation[] } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRCustomizedOperation {
readonly weekDay: string,
readonly startTime: string,
readonly endTime: string
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRoutedOrder {
readonly identifier:String
readonly weight:Double
readonly volume:Double
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
(function() {
//require ou import TPR
const tpr: TPR;
let tprServices: TPRServices;
tpr.get("algum-token-aqui", {"system": "system-1.0.0", "version": "1.0.0", "qualifiers": ""})
.then((services) => {
tprServices = services;
});
let tprMap: TPRMap;
// Caso de uso 1: visualizar uma localidade no mapa
tprServices.createMap(document.getElementById("mapDiv"), {
height: 300,
width: 650
}).then((map) => {
tprMap = map;
});
// Caso de uso 2: zoomIn
tprMap.zoomIn();
// Caso de uso 3: zoomOut
tprMap.zoomOut();
// Caso de uso 4: centralizar sobre um ponto específico
tprMap.centerOn(new TPRPoint(-23, -46));
// Caso de uso 5: Centralizar considerando todos os pontos plotados
tprMap.centerRoutes();
// Caso de uso 6: Ver rota
let tprMapRoute: TPRMapRoute;
tprMap.viewRoute(new TPRRoute(new TPRTrip(...)))
.then((mapRoute) => tprMapRoute = mapRoute);
// Caso de uso 7: Limpa o conteúdo (pontos e rota)
tprMap.clear();
// Caso de uso 8: Remover mapa
tprMap.close();
// Caso de uso 9: Esconder roda
tprMapRoute.hide();
// Caso de uso 10: Reexibir rota
tprMapRoute.show();
// Caso de uso 11: Trocar cor de rota
tprMapRoute.color("#AABBCC");
// Caso de uso 12: Exibir popup nas paradas
tprMap.viewRoute(new TPRRoute(new TPRTrip(...)), new TPRRouteOptions(true));
// Caso de uso 12.1: Permitir alteração de rotas (Fluxo ocorre apenas quando há uma rota no mapa e a rota possui identificador.
OBS: é necessário ter uma callbackURL no modelo de SystemInfo ex: {"system": "system-1.0.0", "version": "1.0.0", "qualifiers": "", callbackURL:"https://abc.com.br"} )
tprMap.viewRoute(new TPRRoute(new TPRTrip(...), "someRouteIdentifierToRouteAlteration"), new TPRRouteOptions(true));
// Caso de uso 13: Receber evento de drag dos marcadores
tprMap.addMarker({latitude: -23, longitude: -46}, {
draggable: true,
onDrag: (lat, long) => console.log("Arrastei o marcador")
});
})();
|
Anexos