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: String): Promise<TPRServices> } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRServices{ createMap(element: HTMLElement, mapOptions: TPRMapOptions): Promise<TPRMap>; } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRMapOptions{ public height: number; public width: number; } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRMap{ 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{ public latitude; public 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(public trip: TPRTrip) { } } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRouteOptions{ constructor(public tooglePopup: boolean) {} } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
interface TPRMapRoute{
hide(): void;
show(): void;
color(color?: String);
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRTrip{ // Campos do TPRTrip (https://tdn.totvs.com/pages/releaseview.action?pageId=604507369) Public distance:double Public numberOfStops:integer Public volume:double Public weight:double Public duration:double Public extraTrip:Boolean Public vehicle:String Public stops:TPRTripStop[] } |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRTripStop{ // Campos do TPRTripStop (https://tdn.totvs.com/pages/releaseview.action?pageId=604507369) Public stopSequence:int Public stopType:String Public locality:TPRRoutingLocality Public arrivalTime:DateTime Public departureTime:DateTime Public loadedOrders:TPRRoutedOrder[] Public unloadedOrders:TPRRoutedOrder[] { |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRoutingLocality{ // Campos do TPRRoutingLocality(https://tdn.totvs.com/pages/releaseview.action?pageId=604507369) Public identifier:String Public country:String Public latitude:Double Public longitude:Double Public operation:String { |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
class TPRRoutedOrder{
Public identifier:String
Public weight:Double
Public volume:Double
} |
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
interface TPRMapRoute{
hide(): void;
show(): void;
color(color?: String);
} |
Âncora | ||||
---|---|---|---|---|
|
Bloco de código | ||||||
---|---|---|---|---|---|---|
| ||||||
(function() { //require ou import TPR const tpr: TPR; let tprServices: TPRServices; tpr.get("alksdjlaksdjal") .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; map.addMarker({latitude: -23, longitude: -46}); }); // 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({latitude: -23, longitude: -46}); // Caso de uso 5: Centralizar considerando todos os pontos plotados tprMap.centerRoutes(); // Caso de uso 6: Ver rota tprMap.viewRoute(new TPRRoute([{latitude: -23, longitude: -46}, {latitude: -22, longitude: -45}])); // 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 let tprMapRoute: TPRMapRoute; tprMap.viewRoute(new TPRRoute([{latitude: -23, longitude: -46}, {latitude: -22, longitude: -45}])) .then((mapRoute) => tprMapRoute = mapRoute); 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([{latitude: -23, longitude: -46}, {latitude: -22, longitude: -45}]), 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