--- title: "Use case: Synchronize orders with the ERP system" slug: "datenaustausch-connect-api-uc-auftrag-status" updated: 2026-12-02T08:12:47Z published: 2026-12-02T08:12:47Z canonical: "docs.homag.cloud/datenaustausch-connect-api-uc-auftrag-status" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.homag.cloud/llms.txt > Use this file to discover all available pages before exploring further. # Use case: Synchronize orders with the ERP system **For:** Customers · Partners · Integrators The ERP system remains the source of truth for the customer order. It needs to know how far production has progressed and when the order will be complete. ## Challenge Sales and customer service answer delivery-date questions using the ERP system. If production progress is not reported back, they have to ask the shop floor, and order confirmations and delivery planning rely on outdated information. At the same time, header data such as the customer's contact person or delivery date may still change in the ERP system after the order has been transferred. ## Solution When an order is imported, productionManager returns its `orderId`. The ERP system stores this `orderId` with its own order. Using the `orderId`, the ERP system updates header data until production starts and regularly reads the order status and planned completion date. ## Workflow 1. Store the `orderId` from the import status with the order in the ERP system. 2. Transfer header changes from the ERP system until production starts. 3. Regularly read orders that are not yet completed. 4. Write `orderStatus` and `completionDatePlanned` to the ERP system when they change. ## Update header data Use `PATCH` to update individual header fields, for example `customerName`, `email`, `personInCharge`, or `deliveryDatePlanned`. This is possible while the order status is `New` or `ReadyForProduction`. After production starts (`InProduction` or `Completed`), updates are rejected. The request uses JSON Merge Patch: only the properties in the request are changed, and `null` removes a value. To replace the complete order, including its parts, import it again with the same `externalSystemId`. This is only possible while the order status is `New`. See [Use case: Import orders](/docs/en/datenaustausch-connect-api-uc-auftrag-anlegen). **C#** ```csharp // PatchOrder expects the merge patch as a Newtonsoft.Json.Linq.JObject var patchData = new JObject {    ["personInCharge"] = "Sarah Miller",    ["deliveryDatePlanned"] = new DateTime(2026, 12, 11, 0, 0, 0, DateTimeKind.Utc) }; await productionManager.PatchOrder(orderId.ToString(), patchData); ``` **REST** ```http PATCH /api/productionManager/orders/1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228 Content-Type: application/merge-patch+json {  "personInCharge": "Sarah Miller",  "deliveryDatePlanned": "2026-12-11T00:00:00Z" } 200 OK ``` ## Read status and planned completion date Read each order that is not yet completed using its saved `orderId`. Alternatively, read all orders with a specific status in one request and match them to your ERP orders using their `id`. Transfer `orderStatus` and `completionDatePlanned` for each order. `completionDatePlanned` is the order's planned completion date. It is set manually in productionManager, during import, or using `PATCH`. If it is empty, leave the date unset in the ERP system. The planned start and completion dates of the lots containing the order's parts are available in `lots`. **C#** ```csharp foreach (var erpOrder in erp.GetOpenOrders()) {    var order = await productionManager.GetOrder(erpOrder.ProductionManagerOrderId);    if (order == null) continue;    erp.UpdateProductionState(erpOrder.Number, order.OrderStatus, order.CompletionDatePlanned); } ``` **REST** ```http GET /api/productionManager/orders/1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228 200 OK {  "id": "1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228",  "orderNumber": "PM-2026-001284",  "externalSystemId": "ERP-2026-001284",  "orderStatus": "InProduction",  "deliveryDatePlanned": "2026-12-11T00:00:00Z",  "completionDatePlanned": "2026-12-09T14:00:00Z",  "quantityOfParts": 42,  "quantityOfPartsPlanned": 42,  "lots": [    {      "lotId": "f6fd8084-29d1-4bba-a4b2-3c9c8d2fd6b1",      "lotName": "LOT-2026-00021",      "quantityOfParts": 24,      "startDatePlanned": "2026-12-07T06:00:00Z",      "completionDatePlanned": "2026-12-08T14:00:00Z"    }  ] } ``` A typical mapping of order status to the ERP system: | `orderStatus` | Typical meaning in the ERP system | | --- | --- | | `New` | Transferred to production, not yet released | | `ReadyForProduction` | Released for production | | `InProduction` | In production | | `Completed` | Production complete | ## Integration architecture Run status synchronization as a scheduled background job, for example every 5 to 15 minutes. Write to the ERP system only when the status or date has changed, so the ERP history stays readable. Stop synchronizing an order once it is `Completed` and its final status has been written. Transfer header changes before production starts. After that, changes must be made directly in productionManager. ## Benefits - Sales and customer service can see production status and planned completion dates in the ERP system. - Order confirmations and delivery planning are based on current production information. - Header changes in the ERP system reach production without manual effort. > **API reference:** See Endpoints → HOMAG Connect productionManager → Managing Orders and Imports ([API reference](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports)): [Get an order](https://docs.homag.cloud/apidocs/getproductionmanagerorder) ([`GET /api/productionManager/orders/{id}`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/GET/api/productionManager/orders/{id})), [Get orders](https://docs.homag.cloud/apidocs/getproductionmanagerorders) ([`GET /api/productionManager/orders`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/GET/api/productionManager/orders)), and [Update an order (Patch)](https://docs.homag.cloud/apidocs/patchproductionmanagerorder) ([`PATCH /api/productionManager/orders/{identifier}`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/PATCH/api/productionManager/orders/{identifier})).