system.mes.oee.healFaultedOeeRecords
Description
Triggers an on-demand run of the faulted OEE record heal job. Heals OEE State Records, OEE Mode Records, and OEE Records that are stuck in FAULTED status by setting their endDate to the successor record's startDate, recomputing the duration, and flipping the status to COMPLETED so they re-enter OEE calculations.
A heal job also runs automatically on a configurable cron schedule (default: daily at midnight). This method allows the job to be triggered immediately without waiting for the next scheduled run.
Permissions
This method requires the OEE.ADMIN permission.
Syntax
system.mes.oee.healFaultedOeeRecords()
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
| None | - | - | This method does not take any parameters. |
Returns
Returns a dict with the following keys:
| Name | Type | Description |
|---|---|---|
stateHealed | int | Number of OEE State Records healed during this run. |
modeHealed | int | Number of OEE Mode Records healed during this run. |
oeeHealed | int | Number of OEE Records healed during this run. |
stateRemaining | long | Number of OEE State Records still in FAULTED status after this run. |
modeRemaining | long | Number of OEE Mode Records still in FAULTED status after this run. |
oeeRemaining | long | Number of OEE Records still in FAULTED status after this run. |
Raises IllegalStateException if a heal run is already in progress or the OEE service is not active on this node.
Code Examples
# Trigger an on-demand heal and log the results
result = system.mes.oee.healFaultedOeeRecords()
print('Healed: %d state, %d mode, %d OEE records' % (
result['stateHealed'], result['modeHealed'], result['oeeHealed']
))
if result['stateRemaining'] > 0 or result['modeRemaining'] > 0 or result['oeeRemaining'] > 0:
print('Still faulted: %d state, %d mode, %d OEE — run again to continue healing' % (
result['stateRemaining'], result['modeRemaining'], result['oeeRemaining']
))