--- title: "Use case: Create lots" slug: "datenaustausch-connect-api-uc-pm-lose" updated: 2026-12-02T08:12:39Z published: 2026-12-02T08:12:39Z canonical: "docs.homag.cloud/datenaustausch-connect-api-uc-pm-lose" --- > ## 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: Create lots **For:** Customers · Partners · Integrators Parts from different orders that can be produced together are grouped into a lot, for example all parts made from the same material for the next production day. ## Challenge Producing orders one at a time leads to frequent material changes, small cutting plans with high waste, and unclear planning: nobody knows exactly which parts will be produced and when. Planning lots by hand takes time every day, especially when there are many small orders. ## Solution Your planning logic reads released orders, selects the related parts that have not yet been scheduled, and creates a lot from their part IDs. The lot gets a name and a planned start and completion date. productionManager uses the lot for production, and the planned lot dates are available in the order details. ## Workflow 1. Read released orders with the `ReadyForProduction` status. 2. Read the details of each order and collect parts whose `lots` list is empty. 3. Group the parts according to your planning criteria. 4. Create a lot for each group using the parts' `id` values as `partIds`. 5. Check the created lot and its parts. ## Find the parts in an order Production items in `items` are hierarchical. Parts can be at the top level or nested within `Position`, `AssemblyGroup`, or `Group` items, which may contain their own `items`. Always traverse the complete hierarchy and select entries whose `type` is `Part`. **C#** ```csharp // Return all parts in an order, including parts nested in positions, assembly groups, and groups static IEnumerable GetParts(IEnumerable? items) {    foreach (var item in items ?? [])    {        if (item is Part part)        {            yield return part;        }        var children = item switch        {            Position position => position.Items,            AssemblyGroup assemblyGroup => assemblyGroup.Items,            Group group => group.Items,            _ => null        };        foreach (var child in GetParts(children))        {            yield return child;        }    } } // 1. Read released orders var orders = await productionManager.GetOrders(OrderStatus.ReadyForProduction, take: 1000); // 2. Collect parts that are not yet scheduled in a lot var parts = new List(); foreach (var order in orders) {    var details = await productionManager.GetOrder(order.Id);    parts.AddRange(GetParts(details!.Items).Where(p => p.Lots == null || p.Lots.Length == 0)); } // 3. Group parts, here by material var groups = parts.GroupBy(p => p.Material); foreach (var group in groups) {    // 4. Create a lot for each group    var response = await productionManager.CreateLotRequest(new CreateLotRequest    {        Name = $"LOT-{DateTime.Today:yyyy-MM-dd}-{group.Key}",        StartDatePlanned = DateTime.Today.AddDays(1),        CompletionDatePlanned = DateTime.Today.AddDays(2),        PartIds = group.Select(p => p.Id!).ToArray()    }); } ``` **REST** ```http # 1. Read released orders GET /api/productionManager/orders?orderStatus=ReadyForProduction&take=1000 # 2. Read each order's details GET /api/productionManager/orders/1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228 200 OK {  "id": "1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228",  "orderStatus": "ReadyForProduction",  "customerName": "Miller Interiors",  "deliveryDatePlanned": "2026-12-11T00:00:00Z",  "quantityOfParts": 9,  "quantityOfPartsPlanned": 0,  "items": [    {      "type": "Position",      "id": "10706260",      "articleNumber": "U50DT",      "items": [        {          "type": "Part",          "id": "10706261",          "identifier": "WEBSEITEL",          "description": "Side left",          "material": "P2_White_19",          "thickness": 16.6,          "edgeFront": "R5703_2,0",          "quantity": 1        }      ]    }  ] } # 4. Create a lot POST /api/productionManager/lots Content-Type: application/json {  "name": "LOT-2026-12-08-P2_White_19",  "startDatePlanned": "2026-12-08T06:00:00Z",  "completionDatePlanned": "2026-12-09T14:00:00Z",  "partIds": [ "10706261", "10706263", "10706264" ] } 200 OK { "lotId": "f6fd8084-29d1-4bba-a4b2-3c9c8d2fd6b1" } # 5. Check the lot GET /api/productionManager/lots/f6fd8084-29d1-4bba-a4b2-3c9c8d2fd6b1 ``` After creation, each part references its lot in the `lots` property, and the order's `quantityOfPartsPlanned` shows how many of its parts are scheduled in lots. Creating lots does not change the order's planned completion date (`completionDatePlanned`). ## Grouping criteria Which parts belong together depends on your production process. Common criteria and the properties to use: | Criterion | Benefit | Properties | | --- | --- | --- | | **Material and thickness** | Fewer material changes and better cutting plans on a saw or nesting machine | Part's `material`, `thickness` | | **Edgebands** | Fewer edgeband changes on the edge bander | Part's `edgeFront`, `edgeBack`, `edgeLeft`, `edgeRight` | | **Planned delivery date** | Parts are produced in time for delivery | Order's `deliveryDatePlanned` | | **Customer** | All parts for one customer are completed together, for example for a combined delivery or assembly | Order's `customerName` or `customerNumber` | | **Complete orders** | Assembly can start as soon as the lot is complete | All parts in an order | Combine criteria, for example all parts with the same material and thickness whose orders are due next week. Material and edgebands are often competing priorities: group by material first when the saw or nesting machine is the bottleneck, and by edgebands when the edge bander is the bottleneck. ## Rework Approved rework is scheduled together with its part. Read it using `GET /api/productionManager/reworks?state=Approved`: a rework's `id` is the part's `id`. If that part is not yet scheduled, creating a lot with its `id` schedules both the part and its approved rework, and the lot includes the additional quantity. To prioritize rework, include these parts in the next lot that fits your other criteria. ## Integration architecture Run lot planning on a schedule, for example once a day before the next production day, or start it manually from your planning system. A part that is fully scheduled in one lot cannot be added to another lot: the request returns `422 Unprocessable Entity`. Use a consistent lot naming convention, for example including the date and material, so production can identify the lot. ## Benefits - Fewer material and edgeband changes and better material yield through larger cutting plans. - Transparent planning according to your own rules instead of daily manual work. - Planned start and completion dates for each lot. > **API reference:** See Endpoints → HOMAG Connect productionManager → Managing Lots ([API reference](https://connect.homag.cloud/productionmanager/#v1/tag/b02-managing-lots)): [Create a lot](https://docs.homag.cloud/apidocs/createlot) ([`POST /api/productionManager/lots`](https://connect.homag.cloud/productionmanager/#v1/tag/b02-managing-lots/POST/api/productionManager/lots)), [Get lots](https://docs.homag.cloud/apidocs/getlots) ([`GET /api/productionManager/lots`](https://connect.homag.cloud/productionmanager/#v1/tag/b02-managing-lots/GET/api/productionManager/lots)), and [Get lot details](https://docs.homag.cloud/apidocs/getlot) ([`GET /api/productionManager/lots/{id}`](https://connect.homag.cloud/productionmanager/#v1/tag/b02-managing-lots/GET/api/productionManager/lots/{id})).