mes.spGetAssetProductionEventsByShift
Description
Returns asset production events sliced by shift. Includes mode, item, and work order data, enriched with runtime and count metrics. Also calculates OEE values per shift segment and provides raw vs. mode-specific counters.Syntax
mes.spGetAssetProductionEventsByShift @assetId, @assetPath, @rangeStart, @rangeEnd, @modeId, @modeName, @workOrderIdParameters:
@assetId (int): ID of the asset to evaluate.
@assetPath (varchar): Optional path filter for the asset hierarchy.
@rangeStart (datetime): Start date for filtering events (nullable).
@rangeEnd (datetime): End date for filtering events (nullable).
@modeId (int): Optional mode ID filter.
@modeName (varchar): Optional mode name filter.
@workOrderId (int): Optional filter by work order ID.
Returns:
Table of production events per shift, including:
- Mode timing and metadata
- Shift boundaries and overlaps
- Production counts (infeed, outfeed, waste)
- OEE components: availability, performance, quality
- Target configuration and counters
Code Example
-- Get shift-level production data for an asset
EXEC mes.spGetAssetProductionEventsByShift
@assetId = 2023,
@assetPath = 'Plant1\\Line3\\Filler',
@rangeStart = '2025-07-01',
@rangeEnd = '2025-07-15',
@modeId = NULL,
@modeName = 'Production',
@workOrderId = NULL;