Árvore de páginas

Introduction

Systems Involved

  • TOTVS Otimização Logística 
  • External System: ERPs that connect or intend to connect with TOL

Scope

  • Freight rules acquisition and update;

Installation/Deployment/Usage Prerequisites

  • Minimum versions

    • TOL:  6.4.0
    • Protheus:  ?
    • Datasul: ?
  • This integration requires no additional installations or updates.

Requisition Layout

FreightRuleAcquisitionService, SOAP Integration, Synchronous
NameTypeMandatorySizeDescriptionObservation
regionSourceIdStringNo30

Regional identifiyer

Must be a valid regional;

nameString

No

255Name of the freigth rule
descriptionStringNo255Description of the freigth rule
freigthRuleGroupNameStringYes255

Name of the freigth rule group

When executing this operation, only the group shipping rules provided in this field will be valid; this field must receive a valid freight group in the TOL;

The freightRuleGroup field can receive any useful value for the business. This field is only for grouping the shipping rules from some business perspective.
Important points about this field:

- The initial date of validity of the shipping rules are always associated with a shipping group;
- To update the shipping rules in the TOL, it will always be necessary to inform the shipping group associated with these rules;
- The update of the freight rules of the same group, in fact, will replace all the freight rules that had the same initial validity date (validityInitialDate) controlled in this interface;

Example:
- A particular customer could create a single freight group for all of Brazil or could create a freight group for each of its plants; in the case of this last hypothetical scenario, if a company has 3 plants (for example, 1 in Rio de Janeiro, 1 in São Paulo and 1 in Pernambuco) it could define 3 freight groups (in the case of the example, these groups could be called from ""PE Shipping Rules"", ""SP Shipping Rules"" and ""RJ Shipping Rules""); In this scenario, if a single freight rule for a given carrier in Rio de Janeiro was changed in the external system (in the example, let's use it as FR1) and you wanted this rule (i.e. FR1) to be updated in the TOL, the external system must send the updated rule (that is, FR1) and all other freight rules from the group ""Freight Rules RJ"" to the TOL on this interface; if the other rules of the group ""Freight Rules RJ"" were not also sent, the TOL would consider that the group ""Freight Rules RJ"" was modified to contain only the updated freight rule (i.e., FR1), which, of course, is not what is wanted;

vigencyInitialDateStringYes10

Date/time of the vigenci the freigth rule group

Group shipping rules will only be effective after the date/time provided in this field; if the effective date received in this field does not exist for a given group, it will be created;
Example scenarios for the upgrade scenario:

• If shipping rules were sent yesterday with a start date in the future (example: 05/07/YYYY) and today you want to update these rules, you must send the updated freight rules with the same start date sent previously ( in the example, 7/5/YYYY);

• If shipping rules are sent this morning with today's start date (05/06/YYYY) and updates to these same rules are sent this afternoon, you must send the updated shipping rules with the same start date sent previously (in the example, 05/06/YYYY); in this scenario, from the morning until the afternoon (even before receiving the updated shipping rules) the TOL will use the originally received rules (in this example, the rules received this morning);

• If 30 days ago (example: 06/05/YYYY) shipping rules are sent with a start date last week (example: 29/05/YYYY) and today (05/06/YYYY) updates are sent to these rules rules, you must submit the updated shipping rules with today's start date (06/05/YYYY); in this scenario, between 5/29/YYYY and 6/5/YYYY (even before the updated shipping rules are received) TOL will use the originally received rules (in this example, the rules received 5/6/YYYY);

Note that if TOL  receives shipping rules with start dates already in the past, an error message will be returned and no updates will be made."

freightRulesfreightRules[]NãoN/A

Grouping element of all freight rules


freightRules, data type used in TOL integrations
NameTypeMandatorySizeDescriptionObservation
priorityIntYes10Freight rule priority (for cases where more than one rule applies to a shipment);The higher this number, the higher the priority;
shipperSourceIdStringNo30ID of the shipper of the freight rule;This field must have an ID from a valid shipper in the TOL;
originSourceIdStringNo30ID of the origin locality of the freight rule;This field must have an ID from a valid locality in the TOL;
destinationSourceIdStringNo30ID of the destination locality of the freight rule;This field must have an ID from a valid locality in the TOL;
originCarrierZoneSourceIdStringNo30ID of the origin carrier zone of the freight rule;

This field must have a valid transport zone ID in the TOL;
The originCarrierZoneSourceId/destinationCarrierZoneSourceId fields can be any “transport zones” previously registered in the TOL (note that these fields are just zone IDs already existing in the TOL).
The important point is that these zones must be relevant to the freight calculation process.
For this interface to work, all zones sent on this interface must have been previously and correctly configured in the TOL so that the TOL can identify them from the IDs sent by the external system in the originCarrierZoneSourceId/destinationCarrierZoneSourceId fields.

For example:
If the freight table has a simple freight rule of the type “Transport orders from origin O to destination zone Z have a freight value V”, it is necessary that this zone Z exists in the TOL and that its geographic coverage in the TOL is correct for the calculation of the freight value V.
In addition, zone Z in the TOL must be associated with a code that the external system knows (example: “123”).
Every time the external system needs to reference zone Z in the TOL, this code (in the example, “123”) must be sent by the external system to the TOL in the freight interface (in the previous example, the interface should send “123” in the destinationCarrierZoneSourceId field for Z zone reference).
The ideal scenario is that all zones in the external system are related to “transport zones” in the TOL in such a way that each of them has the respective ID of the equivalent zones in the external system (this is useful to avoid translation tables of IDs in the external system external).

destinationCarrierZoneSourceIdStringNo30ID of the destination carrier zone of the freight rule;See comment of "originCarrierZoneSourceId" (same applies for this field);
carrierSourceIdStringNo30ID of the carrier of the freight rule;This field must have an ID from a valid carrier in the TOL;
vehicleSourceIdStringNo30ID of the vehicle of the freight rule;This field must have an ID from a valid vehicle in the TOL;
serviceTypeIntNo10ID of the service type of the freight rule;Exemples:

- Full truck load (FTL);
- Less than truck load (LTL);
variable1-40StringNo255Variable used in the freight calculation script (the freight calculation script must have already been created in the TOL); the semantics of this field depend on the freight calculation formula configured in the TOL, therefore, this interface cannot be developed before these formulas are defined; if these formulas have not been defined, this must be done with the support of TOL business area;

Answer Layout

replaceFreightRulesResponse, data type used in TOL integrations
NameTypeMandatorySizeDescriptionObservation
resultresult[]YesN/A

Grouping element of all results

There must be at least 1 order in this list;
sucessBooleanYes1Success or failure flag

result, tipo de dado utilizado nas integrações do TOL
NameTypeMandatorySizeDescriptionObservation
errorCodesStringNo30List of error codes
errorMessageStringNo255Error messages
identifierStringNo30Error table identifier
sucessBooleanYes1Success or failure flag

Error catalog

CodeMessageDescription
Attachments

  Arquivo Modificado
Arquivo FreightRuleAcquisitionService.xml.wsdl 05 jun, 2023 by Julio Vinicius Oliveira dos Santos
Arquivo Freight Aquisition draw.io diagram 05 jun, 2023 by Julio Vinicius Oliveira dos Santos
Arquivo PNG Freight Aquisition.png Freight Aquisition exported to image 05 jun, 2023 by Julio Vinicius Oliveira dos Santos
Arquivo XML replaceFreightRules_exemple.xml 15 jun, 2023 by Julio Vinicius Oliveira dos Santos