Logistics Automation - Routing Task Assignment

Bala Madhusoodhanan - Mar 7 '23 - - Dev Community

Routing Task Assignment:
A workflow app for parcel logistics that allows users to self-check-in parcel tasks and also provides routing recommendations could have several benefits for both the logistics provider and the end customer

Conceptual Architecture View:

Image description

Platform Setup:
Added 2 more columns to the share point list. One a choice which would capture the Status of the Order and another column to capture the user Email ID to select the assigned task

Image description

Image description

Bing as a Data Connector:
Its a premium connector

Image description

Enabling Map Controls / Geospatial:
https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/geospatial-overview

Enabling Barcode Control:

Image description

Setup the Scanner:
Scanner barcode Control:
This out of the box control enables you to read barcode which was created in the previous step. To access the barcode data leverage the below code

BarcodeScanner1.Value
Enter fullscreen mode Exit fullscreen mode

Image description

Routing Recommendation:

1.First it to get the Origin and destination postcode for the sharepoint list site based on the barcode scanned.

LookUp(GeoMap,'Consignment ID'=BarcodeScanner1.Value).FromAdd
Enter fullscreen mode Exit fullscreen mode

2.Once I save both the origin and destination postcode for the Routing recommendation task the next step is to get the Longitude and the Latitude for the post code.

BingMaps.GetLocationByAddress({postalCode:OrginPost_1.Text}).point.coordinates.latitude
BingMaps.GetLocationByAddress({postalCode:OrginPost_1.Text}).point.coordinates.longitude
Enter fullscreen mode Exit fullscreen mode

3.Create a table as a variable on the screen to pass the value to the Map control

Set(SCMapTemp,Table({Latitude:BingMaps.GetLocationByAddress({postalCode:OrginPost_1.Text}).point.coordinates.latitude,
Longitude:BingMaps.GetLocationByAddress({postalCode:OrginPost_1.Text}).point.coordinates.longitude},
{Latitude:BingMaps.GetLocationByAddress({postalCode:DestPost_1.Text}).point.coordinates.latitude,
Longitude:BingMaps.GetLocationByAddress({postalCode:DestPost_1.Text}).point.coordinates.longitude}))
Enter fullscreen mode Exit fullscreen mode

4.The above step (getting the co-ordinates) could be ignored if you already have the longitude and latitude data which would mean you need not configure the BingMaps data connector. Now insert the Map controls and pass the above table as data point to get the routing recommendation

Image description

Enable Routing on the Map control

Image description

1.Add the data source

Image description

2.Get the distance from the Map control (data always in meters)

Concatenate((Map2_1.RouteDirection.LengthInMeters)/1000," KM")
Enter fullscreen mode Exit fullscreen mode

3.Get the time from the Map control (data always in seconds)

With(
    {
        varTravelTime: Time(
            0,
            0,
            Map2_1.RouteDirection.TravelTimeInSeconds
        )
    },
    With(
        {
            varHours: Hour(varTravelTime),
            varMinutes: Mod(
                Minute(varTravelTime),
                60
            )
        },
        Coalesce(
            Concatenate(
                If(
                    varHours <> 0,
                    Text(
                        varHours,
                        "0"
                    ) & " hr "
                ),
                If(
                    varMinutes <> 0,
                    Text(
                        varMinutes,
                        "0"
                    ) & " min"
                )
            ),
            "0 hr"
        )
    )
)
Enter fullscreen mode Exit fullscreen mode

The Routing recommendation would looks something as below

Image description

Task Checkout:
Adding a self checkin button to perform the below 2 tasks. Have leveraged the Office connector to get the user id

  1. Update the sharepoint list Order status and enable the user to assign the task
Patch(GeoMap,LookUp(GeoMap,'Consignment ID'= BarcodeScanner1.Value),{Status:{ Value: "03"}});
Patch(GeoMap,LookUp(GeoMap,'Consignment ID'= BarcodeScanner1.Value),{AssignedTo:User().Email})
Enter fullscreen mode Exit fullscreen mode
  1. Send an email to notify the user
Office365Outlook.SendEmailV2(User().Email,"ConsignmentID  :" &BarcodeScanner1.Value,
"Dear :" &User().FullName& ","&
"The Self Check-In is now completed. Proceed to deliver the order" &
"<br>" &
"<h3>Job Information Details </h3>" &
"The Consignment ID Reference   :" &BarcodeScanner1.Value &
"<br>" &
"The Pick Up Location Postcode  :" &OrginPost_1.Text &
"<br>" &
"The Drop off Location Postcode :" &DestPost_1.Text &
"<br>" &
"Estimated Time for Travel      :" &EstTimeV_2.Text &
"<br>" &
"Estimated Travel Distance      :" &EstDistV_1.Text
);
Enter fullscreen mode Exit fullscreen mode

Task self checkout would look something as below

Image description

Task Automation Benefit:

Improved efficiency: With a self-check-in feature, the logistics provider can save time by eliminating the need for manual check-in and processing. This can help to speed up the overall parcel delivery process and increase efficiency.

Reduced errors: By allowing customers to check in their own parcels, the likelihood of errors or mistakes in the check-in process can be reduced. This can help to improve accuracy and ensure that parcels are properly accounted for.

Enhanced customer experience: A self-check-in feature can provide customers with greater convenience and flexibility, as they can check in their parcels at their own convenience. Additionally, routing recommendations can help customers to choose the most efficient and cost-effective delivery options, which can help to improve overall satisfaction.

Product Documentation:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .