Skip to main content

Dispatch Route

Dispatch routes are daily operational routes assigned to drivers. A route has a date, route type, status, optional driver/equipment/division assignment, and an ordered list of stops. Routes can be created manually or generated from dispatch route templates.

DispatchRoute

PropertyTypeRequiredDescription
DispatchRouteIdintYesPrimary key
OrganizationIdintYesTenant scope
NamestringYesRoute name
RouteTypeDispatchRouteTypeYesDelivery or Pickup
RouteDateDateYesOperational route date (yyyy-MM-dd)
DispatchRouteStatusIdintYesCurrent route status
DispatchRouteTemplateIdint?NoSource template when generated
DivisionIdint?NoOptional division assignment
DriverContactIdint?NoAssigned driver contact; must be a driver contact
EquipmentIdint?NoAssigned equipment
IsDraftboolYesNew/generated routes start as drafts
IsInactiveboolYesSoft-delete flag
CollapsedIntoDispatchRouteIdint?NoRoute this route was merged into
StopsDispatchRouteStop[]NoOrdered route stops
CustomValuesDictionaryNoExtensible custom properties

DispatchRouteStop

PropertyTypeRequiredDescription
DispatchRouteStopIdintYesPrimary key
DispatchRouteIdintYesParent route
StopContactIdint?NoStore/location contact (nullable; use with or without contactAddressId)
ContactAddressIdint?NoSpecific stop address
StopTypeDispatchRouteTypeYesDefaults to the parent route type when omitted
PlannedSequenceintYes1-based planned stop order
ActualSequenceint?NoFinal execution order
EstimatedServiceMinutesint?NoPlanned dwell/service time
ActualArrivalTimeDateTime?NoActual arrival timestamp
ActualCompletionTimeDateTime?NoActual completion timestamp
OrderIdsint[]NoAttached order IDs for this stop
OrdersDispatchRouteStopOrder[]NoAttached order links; expand order when full order data is needed
CustomValuesDictionaryNoExtensible custom properties (use for ad-hoc stop address when not using a contact)

DispatchRouteStopOrder

PropertyTypeRequiredDescription
DispatchRouteStopOrderIdintYesPrimary key
DispatchRouteStopIdintYesParent stop
OrderIdintYesAttached order
OrderOrder?NoOptional expanded order
CustomValuesDictionaryNoExtensible custom properties for the stop/order link

Behavior

  • Create accepts nested stops; planned sequences are assigned contiguously in input order. Stops may attach orders through orderIds.
  • Route updates can replace the nested stops array. Existing stops with dispatchRouteStopId are sparse-updated and resequenced by array order; new stops are added; omitted existing stops are soft-deleted. Stop orderIds reconcile the attached orders to exactly the provided IDs when present. Stop-specific mutations remain available for targeted changes.
  • Draft routes become operational through activateDispatchRoute.
  • Stops cannot be removed, and routes cannot be deleted, when stops have attached orders.
  • Removing or reordering a stop resequences remaining active stops.
  • Generated routes copy template name, route type, division, and stops; driver/equipment assignment happens later.
  • Stop location/order anchor: A stop's location is either a contact address (contactAddressId, optionally with stopContactId) or an ad-hoc address placed in customValues; alternatively, an order-attached stop can be created with orderIds. A stop must have at least one of stopContactId / contactAddressId / non-empty customValues / non-empty orderIds.