Delivery & Carrier Management
Relevant source files
The following files were used as context for generating this wiki page:
- packages/core/src/services/carriers/CarriersService.ts
- packages/core/src/services/carriers/CarriersOrdersService.ts
- packages/common/src/entities/Carrier.ts
- packages/carrier-mobile-ionic/src/pages/main/delivery/delivery.ts
- packages/admin-web-angular/src/app/@shared/warehouse/forms/warehouse-manage-tabs/details/warehouse-manage-tabs-details.component.ts
- packages/admin-web-angular/src/assets/i18n/en.json
- README.md
The Ever Demand platform provides a comprehensive system for delivery and shipping management. This includes real-time location tracking for on-demand orders and a dedicated mobile application for carriers (drivers or service providers) to manage their deliveries. The system is designed to be reactive and real-time, integrating with stores/warehouses to process and track orders from allocation to final delivery.
The core of this system revolves around the Carrier entity, backend services to manage carriers and their orders, and a mobile interface for carriers to interact with the platform. Warehouses have fine-grained control over how they utilize carriers, with options to use a shared pool or a restricted list of specific carriers.
Sources: README.md:34-35, README.md:40-41
Core Data Model: The Carrier Entity
The Carrier entity is the central data structure for all carrier-related information. It is linked to a User and contains properties related to their status, location, and delivery history.
Sources: packages/common/src/entities/Carrier.ts
ER Diagram
This diagram shows the structure of the Carrier entity and its relation to the User entity.
Carrier Properties
The table below details the key properties of the Carrier entity.
| Property | Type | Description |
|---|---|---|
userId | string | The ID of the associated user account. |
isSharedCarrier | boolean | Flag indicating if the carrier can be used by multiple warehouses (i.e., part of a shared pool). |
status | string | The current working status of the carrier (e.g., 'active', 'not-active', 'working', 'not-working'). |
lastLatitude | Number | The last known latitude of the carrier for real-time tracking. |
lastLongitude | Number | The last known longitude of the carrier for real-time tracking. |
lastTrackTime | Date | Timestamp of the last location update. |
deliveriesCount | number | Total number of deliveries assigned to the carrier. |
deliveriesSuccessCount | number | Total number of successfully completed deliveries. |
deliveriesFailedCount | number | Total number of failed deliveries. |
deliveriesRefusedCount | number | Total number of deliveries refused by the client. |
warehousesIds | string[] | An array of warehouse IDs that this carrier is associated with, if not a shared carrier. |
Sources: packages/common/src/entities/Carrier.ts:22-56, packages/admin-web-angular/src/assets/i18n/en.json:625-628
Warehouse and Carrier Configuration
Warehouses can configure how they interact with carriers, providing flexibility for different business models. A warehouse can use a general pool of shared carriers or restrict deliveries to a specific, pre-approved list.
Configuration Options
The following settings are available in the warehouse management interface to control carrier assignment.
| Setting | Form Control | Description |
|---|---|---|
| Use only specific carriers | hasRestrictedCarriers | If enabled, the warehouse will only use carriers from its carriersIds list. |
| Carrier required before sale | isCarrierRequired | Specifies if a carrier must be assigned to an order before the sale can be processed. |
| Use only store carriers for delivery | useOnlyRestrictedCarriersForDelivery | A stricter version of hasRestrictedCarriers, forcing the use of only the warehouse's own carriers. |
| Prefer store carriers for delivery | preferRestrictedCarriersForDelivery | The system will try to assign a warehouse's own carrier first before looking at the shared pool. |
| Carrier Work Competition | carrierCompetition | If enabled, multiple carriers can compete for an available order. |
Sources: packages/admin-web-angular/src/app/@shared/warehouse/forms/warehouse-manage-tabs/details/warehouse-manage-tabs-details.component.ts:40-52, packages/admin-web-angular/src/app/@shared/warehouse/forms/warehouse-manage-tabs/details/warehouse-manage-tabs-details.component.ts:205-206, [packages/admin-web-angular/src/assets/i18n/en.json:416-417]
Carrier Selection Logic
The admin UI for warehouse management loads a list of active, shared carriers that can be assigned to a warehouse's restricted list.
This diagram illustrates the flow for setting up carrier restrictions for a warehouse.
Carrier Mobile App Workflow
The Carrier Mobile App, built with Ionic, is the primary interface for carriers to manage their assigned deliveries. It allows them to view available orders, accept jobs, and update the delivery status in real-time.
Sources: packages/carrier-mobile-ionic/src/pages/main/delivery/delivery.ts, README.md:34-35
Delivery Process Sequence
The following sequence diagram shows the typical flow of a carrier handling a delivery via the mobile app.
Delivery and Order Statuses
The platform uses a set of standardized statuses to track an order through the warehouse and delivery process. These statuses are visible across the admin panel and carrier mobile app.
Sources: packages/admin-web-angular/src/assets/i18n/en.json:710-729, packages/admin-web-angular/src/app/@shared/warehouse/forms/warehouse-manage-tabs/details/warehouse-manage-tabs-details.component.ts:68-79
Carrier-Related Statuses
These statuses are specific to the carrier's actions during a delivery.
| Status | Description |
|---|---|
No Carrier | No carrier has been assigned to the order yet. |
Given to Carrier | The warehouse has handed over the packaged order to the assigned carrier. |
Order Selected For Delivery | A carrier has accepted the delivery job. |
Order Picked Up | The carrier has confirmed pickup of the order from the warehouse. |
Order In Delivery | The carrier is en route to the customer's location. |
Arrived To Client | The carrier has arrived at the delivery destination. |
Delivered | The carrier has successfully delivered the order to the customer. |
Delivery Issues | An issue occurred during delivery. |
Client Refuse to Take Order | The customer refused to accept the order upon delivery. |
Sources: packages/admin-web-angular/src/assets/i18n/en.json:719-727, packages/admin-web-angular/src/assets/i18n/en.json:641-655
Order Cancellation States
A warehouse can configure up to which point in the lifecycle an order can be canceled.
| State Value | State Name | Description |
|---|---|---|
| 1 | ORDERING | Immediately after the order is placed. |
| 2 | START_PROCESSING | After the warehouse starts processing the order. |
| 4 | ALLOCATED | After products have been allocated. |
| 6 | PACKAGED | After the order is packaged. |
| 7 | CARRIER_TAKE_WORK | After a carrier has accepted the delivery. |
| 8 | CARRIER_GOT_IT | After the carrier has picked up the order. |
| 9 | CARRIER_START_DELIVERY | After the carrier has started the delivery route. |
| 11 | DELIVERED | After the order has been delivered. |
Sources: packages/admin-web-angular/src/app/@shared/warehouse/forms/warehouse-manage-tabs/details/warehouse-manage-tabs-details.component.ts:68-79, packages/admin-web-angular/src/assets/i18n/en.json:399-410
Summary
The Delivery & Carrier Management system is a critical component of the Ever Demand platform, bridging the gap between merchants and customers. It provides a robust framework for managing a fleet of carriers, enabling real-time tracking, and offering flexible configuration for warehouses to define their delivery logistics. The dedicated carrier mobile app empowers drivers with the tools they need to efficiently manage deliveries, while the detailed status tracking ensures transparency throughout the entire order fulfillment process.