Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
Aviso
titleIMPORTANTE
  • A integração TOTVS OMS x TOTVS Planejamento de Rotas (TPR) será descontinuada no próximo release (Outubro/2023).



Introdução

draw.io Diagram
borderfalse
viewerToolbartrue
fitWindowfalse
diagramDisplayName
lboxtrue
revision2
diagramNameTPR_visualizacao_rotas
simpleViewerfalse
width
linksauto
tbstylehidden
diagramWidth342


Sistemas Envolvidos

  • TPR: TOTVS: Planejamento  TOTVS Planejamento de Rotas

  • Sistema Externo: Todos os ERPs que se conectam ou pretendem se conectar com os produtos de planejamento logístico TOTVS.

Integração

  • Formato de entrada/saída: Javascript

Escopo

  • API Javascript para ser importada no sistema externo a partir dela deve ser possível implementar e manipular mapas tanto para a tela de localidade quanto para a tela de rotas;

Pré-requisitos instalação/implantação/utilização

  • Para clientes Protheus versão xxxxxx;
  • Para clientes Datasul versão xxxxxx;
  • Para clientes externos contratação do trial via TOTVS Store;

Layout de Requisição 

Bloco de código
languagejava
titleTPR
linenumberstrue
class TPR {
   get(token: string, systemInfo: StringSystemInfo): Promise<TPRServices>
}
anchor
TRPServicesTRPServices
Bloco de código
languagejava
titleTPRServicesSystemInfo
linenumberstrue
classinterface SystemInfo TPRServices{
   createMap(element: HTMLElement, mapOptions: TPRMapOptions): Promise<TPRMap>    readonly system: string;
    readonly version: string;
    readonly qualifiers: string;
    readonly callbackURL?: string;
}

Âncora
TPRMapOptionsTRPServicesTPRMapOptions
TRPServices

Bloco de código
languagejava
titleTPRMapOptionsTPRServices
linenumberstrue
class TPRServices TPRMapOptions{
   public height: number;
   public width: number createMap(element: HTMLElement): Promise<TPRMap>;
}


Âncora
TPRMap
TPRMap

Bloco de código
languagejava
titleTPRMap
linenumberstrue
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
TPRPoint
TPRPoint

Bloco de código
languagejava
titleTPRPoint
linenumberstrue
class TPRPoint {
   public readonly latitude;
   public readonly longitude;
}

Âncora
MarkerOptions
MarkerOptions

Bloco de código
languagejava
titleMarkerOptions
linenumberstrue
interface MarkerOptions {
   color?: String;
   draggable?: boolean;
   onDrag?: (latitude: number, longitude: number) => void
}

Âncora
TPRRoute
TPRRoute

Bloco de código
languagejava
titleTPRRoute
linenumberstrue
class TPRRoute {
   constructor(publicreadonly trip: TPRTrip, readonly identifier?: string) {
   }
}

Âncora
TPRrouteOptions
TPRrouteOptions

Bloco de código
languagejava
titleTPRRouteOptions
linenumberstrue
class TPRRouteOptions {
   constructor(publicreadonly tooglePopup: boolean) {}
}

Âncora
TPRMapRoute
TPRMapRoute

Bloco de código
languagejava
titleTPRMapRoute
linenumberstrue
class TPRMapRoute {
	hide(): void;
	show(): void;
	color(color?: String);
}

Âncora
TPRTrip
TPRTrip

Bloco de código
languagejava
titleTPRTrip
linenumberstrue
class TPRTrip {
    // Campos do TPRTrip (https://tdn.totvs.com/pages/releaseviewviewpage.action?pageId=604507369)
	readonly sequential:Integer
	Publicreadonly distance:double:Double
	readonly tollValue:Double
	Publicreadonly numberOfStops:integerInteger
	Publicreadonly volume:doubleDouble
	Publicreadonly weight:doubleDouble
	Publicreadonly duration:doubleInteger
	Publicreadonly extraTrip:Boolean:boolean
	readonly considerReturnDistance: boolean
	Publicreadonly vehicle:StringTPRVehicle
	Publicreadonly stops:TPRTripStop[]

}


Âncora
TPRVehicle
TPRVehicle

Bloco de código
languagejava
title TPRVehicle
linenumberstrue
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
TPRTripStop
TPRTripStop

Bloco de código
languagejava
titleTPRTripStop
linenumberstrue
class TPRTripStop {
    // Campos do TPRTripStop (https://tdn.totvs.com/pages/releaseviewviewpage.action?pageId=604507369)
	Publicreadonly stopSequencesequence:intInteger
	Publicreadonly stopTypetype:String
	readonly distance:Double,
    readonly tollValue:Double,
	Publicreadonly locality:TPRRoutingLocality
	Publicreadonly arrivalTime:DateTime
	Publicreadonly departureTime:DateTime
	Publicreadonly loadedOrders:TPRRoutedOrder[]
	Publicreadonly unloadedOrders:TPRRoutedOrder[]
{}

Âncora
TPRRoutingLocality
TPRRoutingLocality

Bloco de código
languagejava
titleTPRRoutingLocality
linenumberstrue
class TPRRoutingLocality {
    // Campos do TPRRoutingLocality(https://tdn.totvs.com/pages/releaseviewviewpage.action?pageId=604507369)
	Publicreadonly identifier:String
    readonly name: String
	Publicreadonly country:String
	Publicreadonly latitude:Double
	Publicreadonly longitude:Double
	Publicreadonly operation:String
{
	readonly customizedOperation: TPRCustomizedOperation[]
}

Âncora
TPRRoutedOrderTPRCustomizedOperationTPRRoutedOrder
TPRCustomizedOperation

Bloco de código
languagejava
titleTPRRoutedOrderTPRCustomizedOperation
linenumberstrue
class TPRCustomizedOperation TPRRoutedOrder{   
		Publicreadonly identifierweekDay:String
	Public weight:Double
	Public volume:Double string,
        readonly startTime: string,
        readonly endTime: string 
}

Âncora
TPRMapRouteTPRRoutedOrderTPRMapRoute
TPRRoutedOrder

Bloco de código
languagejava
titleTPRMapRouteTPRRoutedOrder
linenumberstrue
interfaceclass TPRRoutedOrder TPRMapRoute{
	hide(): void;
	show(): void;
	color(color?: String);readonly identifier:String
	readonly weight:Double
	readonly volume:Double
}

Âncora
usageCases
usageCases

Casos de uso

Bloco de código
languagejava
titleCasos de uso
linenumberstrue
(function() {
//require ou import TPR

	const tpr: TPR;
	let tprServices: TPRServices;
	tpr.get("alksdjlaksdjal""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;
		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:new TPRPoint(-23, longitude: -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([{latitude: -23, longitude: -46}, {latitude: -22, longitude: -45}])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
	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#AABBCC");

// Caso de uso 12: Exibir popup nas paradas
	tprMap.viewRoute(new TPRRoute([{latitude: -23, longitude: -46}, {latitude: -22, longitude: -45}]),
		(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

Anexos