system.mes.oee.importOeeStatesFromJson
Description
Imports OEE state configurations from JSON formatted data.
Permissions
This method requires the OEE.WRITE.SAVE permission.
Syntax
system.mes.oee.importOeeStatesFromJson(bytes)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
bytes | byte[] | True | The JSON data as a byte array to import. |
Returns
An ApiResponse object indicating success or failure. On success, the data attribute contains the count of imported records.
Code Examples
import system.file
# Path to the JSON file
filePath = "C:/path/to/oee_states.json"
try:
# Read the file content as bytes
jsonBytes = system.file.readFileAsBytes(filePath)
# Import the OEE states
result = system.mes.oee.importOeeStatesFromJson(jsonBytes)
if result.get('success'):
print "Successfully imported {} OEE states.".format(result.get('data'))
else:
print "Import failed: {}".format(result.get('message'))
except Exception as e:
print "An error occurred: {}".format(str(e))