mes.spGetAssetProductionEventSummary
Description
Generates an aggregated summary of production events and performance metrics (OEE) for a given asset over a specified time window. Data is grouped by asset, mode, work order, and item, and includes summarized counters, durations, and calculated KPIs.Syntax
mes.spGetAssetProductionEventSummary @assetId, @rangeStart, @rangeEnd, @modeId, @workOrderId, @strictDatesParameters:
@assetId (int): The asset for which to retrieve production data.
@rangeStart (datetime): Lower bound of the time window to analyze (nullable).
@rangeEnd (datetime): Upper bound of the time window to analyze (nullable).
@modeId (int): Optional filter by mode ID.
@workOrderId (int): Optional filter by work order ID.
@strictDates (bit): Whether to strictly enforce the time window for mode durations.
Returns:
Aggregated table including:
- Mode metadata and asset hierarchy
- Work order and item information
- Total runtime, downtime, production counts
- Target OEE values
- Calculated OEE metrics from fnGetOEEMetrics()
Code Example
-- Return a summarized view of production performance over a time window
EXEC mes.spGetAssetProductionEventSummary
@assetId = 3031,
@rangeStart = '2025-06-01',
@rangeEnd = '2025-06-30',
@modeId = NULL,
@workOrderId = NULL,
@strictDates = 1;