Skip to main content

mes.spGetOEEDataByInterval

Description

Generates OEE (Overall Equipment Effectiveness) and supporting metrics for an asset over a time range, aggregated by hour/day/week. Utilizes run states, counters, and mode data to derive KPIs. Performs dynamic interval grouping using recursive CTEs.

Syntax

mes.spGetOEEDataByInterval @assetId, @startDate, @endDate, @interval

Parameters:
@assetId (int): ID of the asset to analyze.
@startDate, @endDate (datetime): Time window for analysis.
@interval (varchar): One of 'Hour', 'Day', or 'Week'.

Returns:
List of OEE intervals with:
- Runtime, downtime, production counts
- Item metadata and standard rate
- Cross-applied `fnGetOEEMetrics` values

Code Example

EXEC mes.spGetOEEDataByInterval
@assetId = 1024,
@startDate = '2025-07-01',
@endDate = '2025-07-10',
@interval = 'Day';