system.mes.productionOrder.exportAsJson
Description
Exports all or selected production orders as raw bytes in JSON format (UTF-8 encoded).
Streams production order data from the database and formats it as JSON.
When idsOrNames is omitted, all production orders are exported.
Permissions
This method requires the PRODUCTION_ORDER.READ.GET permission.
Syntax
system.mes.productionOrder.exportAsJson()
system.mes.productionOrder.exportAsJson(idsOrNames=["PO-1001"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
idsOrNames | String[] | Yes | The ids or names of the production orders to export. Omit to export all. |
Returns
A byte array (byte[]) containing the raw byte data of the JSON export.
Code Examples
Perspective
jsonBytes = system.mes.productionOrder.exportAsJson()
system.perspective.download("production-orders.json", jsonBytes)
Script Console
jsonBytes = system.mes.productionOrder.exportAsJson()
path = system.file.saveFile("production-orders.json")
if path is not None:
system.file.writeFile(path, jsonBytes)