Reference for nesting_jobs, nesting_parts, and nesting_remnants, with their fields, routes, material flows, costing, and remnant lifecycle.
This page lists the fields, routes, and rules of the three record types of the nesting module: jobs in nesting_jobs/, parts in nesting_parts/, and remnants in nesting_remnants/, all under src/cluster_erp/modules/nesting/. The export and import of layouts and the KPI report are on integration and KPI. The module overview, with the full pipeline diagram, is on nesting module.
Parts are under /api/v1/nesting/nesting-parts with list, read, create, update, delete, and bulk delete (src/cluster_erp/modules/nesting/nesting_parts/routes.py:25-113). Remnants are under /api/v1/nesting/nesting-remnants with list, GET /available, read, update, and POST /{remnant_id}/scrap (src/cluster_erp/modules/nesting/nesting_remnants/routes.py:27-123).
Parts can be added, changed, or removed only while the job is queued or failed (src/cluster_erp/modules/nesting/nesting_parts/services.py:76, src/cluster_erp/modules/nesting/nesting_parts/services.py:137, src/cluster_erp/modules/nesting/nesting_parts/services.py:185).
A product can appear once per job; a second row answers RESOURCE_CONFLICT (src/cluster_erp/modules/nesting/nesting_parts/services.py:82-93).
A part whose bounding box does not fit the usable sheet, straight or turned by 90 degrees, is refused with NESTING_PART_TOO_LARGE (src/cluster_erp/modules/nesting/nesting_parts/services.py:95-104).
Pull Parts from Orders reads each linked production or sales order over the EventBus, refuses an order whose material grade or thickness differs from the job's, and adds one part per order component with a known size, skipping components already pulled from the same order (src/cluster_erp/modules/nesting/nesting_jobs/services.py:676-802).
Reserving needs a job in queued or failed, no earlier reservation, a sheet material, a warehouse, and the full breakdown; the module calls ReserveStock (src/cluster_erp/modules/nesting/nesting_jobs/services.py:394-468).
Consumption runs during approval when material was reserved and not yet consumed; it calls ConsumeReservation and PostGoodsIssue and logs a failure of either (src/cluster_erp/modules/nesting/nesting_jobs/services.py:361-362, src/cluster_erp/modules/nesting/nesting_jobs/services.py:470-553).
calculate_costs needs a completed job and a cost per unit area (src/cluster_erp/modules/nesting/nesting_jobs/services.py:555-592). With that rate it computes, rounding each money result to four places with ROUND_HALF_EVEN (src/cluster_erp/modules/nesting/nesting_jobs/services.py:594-633):
Only a completed job that is not yet approved can be approved; low utilisation needs acknowledgement (src/cluster_erp/modules/nesting/nesting_jobs/services.py:311-342).
Approval creates one remnant per imported leftover rectangle, with status available, and posts each to stock with PostGoodsReceipt when the job has a warehouse and a sheet material breakdown (src/cluster_erp/modules/nesting/nesting_jobs/services.py:364-375, src/cluster_erp/modules/nesting/nesting_remnants/services.py:125-176, src/cluster_erp/modules/nesting/nesting_remnants/services.py:282-341).
A remnant can be scrapped when available or reserved (src/cluster_erp/modules/nesting/nesting_remnants/services.py:246-262). Consumption requires available (src/cluster_erp/modules/nesting/nesting_remnants/services.py:178-194); a grep for consume_remnant finds no route or other caller at this commit.
GetAvailableRemnants lists available remnants of a material grade and thickness, optionally with a minimum width and height (src/cluster_erp/modules/nesting/nesting_remnants/services.py:71-98, src/cluster_erp/modules/nesting/module.py:111-140).