Logistics Alert & Tracking System

Logistics Alert & Tracking System

Overview

The Logistics Alert & Tracking system monitors vehicle tracking logs and generates alerts when abnormal events occur. Alerts include route deviation, vehicle stoppage, and trip delays. These alerts can be delivered through:

  • Email notifications
  • System notifications
  • Alert logs stored in ERPNext

Modules Covered

  • Logistics Settings
  • Logistics Tracking API Log
  • Alert Processing Engine
  • Email Alert Template
  • Geofence Alert Notification

1. Logistics Settings

Purpose

This DocType manages configuration for logistics alerts including enabling notifications, setting thresholds, and validating email settings.

Main Features

  • Enable or disable alert system
  • Configure tracking link expiry threshold
  • Configure geofence radius
  • Enable email alerts
  • Enable system notifications

Key Validations

Validation Description
Tracking Link Expiry Threshold Must be configured before alerts are enabled
Geofence Radius Required before enabling alerts
Email Validation All email addresses must be valid
Minimum Threshold Tracking expiry must be at least 4 hours

2. Logistics Tracking API Log

Purpose

Stores API request and response logs related to logistics tracking integration. This helps debugging external integrations and monitoring tracking data flow.

Main Functions

Create API Log

  • Stores API request data
  • Stores API response
  • Stores processing stage
  • Stores processed data

Update API Log

  • Updates API processing stage
  • Updates API response after processing

3. Alert Processing Engine

Function

trigger_alert(tracking_id)

This function processes vehicle tracking logs and generates alerts when certain conditions occur.

Alert Types

Alert Type Description
Route Deviation Triggered when vehicle deviates from planned route
Vehicle Stoppage Triggered when vehicle stops longer than threshold
Trip Delay Triggered when trip duration exceeds expected time

Alert Workflow

  1. Fetch logistics tracking document
  2. Validate alert settings
  3. Retrieve latest tracking logs
  4. Check existing alerts to avoid duplicates
  5. Process each log entry
  6. Create alert log entry
  7. Send notifications

4. Email Alert System

Email Generation

Alerts are rendered using a Jinja HTML template which generates structured email notifications.

Email Content Includes

  • Vehicle Number
  • Alert Type
  • Timestamp
  • Location Coordinates
  • Duration or Speed Information
  • Route Deviation Distance
  • Google Maps link

Email Delivery

Emails are sent using the Frappe email communication system.


5. System Notifications

If system notifications are enabled, alerts are stored in the Notification Log DocType. These notifications appear inside the ERPNext notification panel.


6. Geofence Vehicle Alerts

Purpose

Geofence alerts notify users when a vehicle enters or exits a configured geofence area.

Triggered On

  • Vehicle entry into geofence
  • Vehicle exit from geofence

Email Alert Information

Field Description
Vehicle Number Vehicle generating the alert
Location Name Geofence location name
Movement Type Entry or Exit
Timestamp Alert time
Latitude Vehicle location
Longitude Vehicle location

7. Database Entities

  • Logistics Settings
  • Logistics Tracking
  • Logistics Tracking Log
  • Logistics Tracking Alert Log
  • Logistics Tracking API Log
  • Notification Log
  • Geofence Vehicle Alert Log

8. Error Handling

  • API failures are logged in Logistics Tracking API Log
  • Email sending failures are caught and ignored to prevent workflow interruption
  • Alert creation failures are logged using frappe.log_error()

9. Summary

The Logistics Alert system ensures real-time monitoring of vehicle movement and trip performance. It improves operational visibility by automatically detecting abnormal conditions and notifying users through email and system alerts.

Discard
Save
This page has been updated since your last edit. Your draft may contain outdated content. Load Latest Version

On this page

Review Changes ← Back to Content
Message Status Space Raised By Last update on