Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Business modules

Reference

Nesting jobs, parts, and remnants

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.

Scope and source

  • Defined in: the models.py, schemas.py, services.py, routes.py, and metadata.py of nesting_jobs, nesting_parts, and nesting_remnants.
  • Count: 3 tables; 15 job routes, 6 part routes, and 5 remnant routes (@router. decorators in each routes.py, the KPI route excluded).

Job fields

Group Fields Source
Identity and status code, name, status (default queued), notes src/cluster_erp/modules/nesting/nesting_jobs/models.py:25-36, src/cluster_erp/modules/nesting/nesting_jobs/models.py:154
Sheet sheet_length_mm, sheet_width_mm, thickness_mm, material_grade, surface_coating, max_sheets src/cluster_erp/modules/nesting/nesting_jobs/models.py:38-55, src/cluster_erp/modules/nesting/nesting_jobs/models.py:180
Process kerf_width_mm, part_gap_mm, edge_margin_mm, allow_mirror, allowed_rotations, machine_profile, algorithm src/cluster_erp/modules/nesting/nesting_jobs/models.py:56-80, src/cluster_erp/modules/nesting/nesting_jobs/models.py:188-198
Result result_source, external_software, layout_placements, remnants, layout_svg, sheets_used, total_parts, placed_parts, utilization_pct, sheet_area_mm2, used_area_mm2, waste_area_mm2, run_started_at, run_completed_at, run_duration_seconds src/cluster_erp/modules/nesting/nesting_jobs/models.py:87-135, src/cluster_erp/modules/nesting/nesting_jobs/models.py:145-187, src/cluster_erp/modules/nesting/nesting_jobs/models.py:215-224
Approval low_utilization_acknowledged, approved_by, approved_at src/cluster_erp/modules/nesting/nesting_jobs/models.py:116-144
Material sheet_material_id, sheet_material_model_id, sheet_material_version_id, warehouse_id, material_reserved, material_consumed, reservation_id, planned_sheets, actual_sheets, planned_material_qty, actual_material_qty src/cluster_erp/modules/nesting/nesting_jobs/models.py:199-264
Costing cost_per_unit_area, material_cost, scrap_cost, remnant_credit, net_material_cost, currency_code src/cluster_erp/modules/nesting/nesting_jobs/models.py:265-290
Source orders source_orders (JSON list of order references) src/cluster_erp/modules/nesting/nesting_jobs/models.py:149

Part fields

Name Meaning Source
nesting_job_id, part_id Job and product; one live row per job and product src/cluster_erp/modules/nesting/nesting_parts/models.py:15-35
qty_requested, qty_placed Requested and placed counts src/cluster_erp/modules/nesting/nesting_parts/models.py:37-47
part_length_mm, part_width_mm, part_area_mm2 Bounding size and area src/cluster_erp/modules/nesting/nesting_parts/models.py:54-66
geometry_polygon, dxf_parsed, dxf_attachment_id True outline as a coordinate list, and its source src/cluster_erp/modules/nesting/nesting_parts/models.py:49-53, src/cluster_erp/modules/nesting/nesting_parts/models.py:98-108
placed_x, placed_y, rotation_deg, mirror, in_layout, sheet_index First placement of the part in the layout src/cluster_erp/modules/nesting/nesting_parts/models.py:67-114
priority Higher first in exports and summaries src/cluster_erp/modules/nesting/nesting_parts/models.py:92-97, src/cluster_erp/modules/nesting/integration/services.py:121-128
source_order_id, source_order_type, allocated_material_cost Origin order and share of the net material cost src/cluster_erp/modules/nesting/nesting_parts/models.py:117-130

Remnant fields

Name Meaning Source
code Business key from sequence nesting_remnant src/cluster_erp/modules/nesting/nesting_remnants/models.py:17-21, src/cluster_erp/modules/nesting/nesting_remnants/services.py:135
nesting_job_id, sheet_index, x, y, width, height, area_mm2 Position and size on the source sheet src/cluster_erp/modules/nesting/nesting_remnants/models.py:22-55
material_grade, thickness_mm, surface_coating Copied from the job src/cluster_erp/modules/nesting/nesting_remnants/models.py:56-65, src/cluster_erp/modules/nesting/nesting_remnants/services.py:148-150
status available at creation src/cluster_erp/modules/nesting/nesting_remnants/models.py:66-71
warehouse_id, batch_id, inventory_movement_id Stock references src/cluster_erp/modules/nesting/nesting_remnants/models.py:73-85
consumed_by_job_id, consumed_at, scrapped_at, scrap_reason Lifecycle stamps src/cluster_erp/modules/nesting/nesting_remnants/models.py:86-98

Job routes

All paths are under /api/v1/nesting/nesting-jobs.

Method and path Purpose Permission Source
GET /, GET /{job_id} List and read nesting_job.read src/cluster_erp/modules/nesting/nesting_jobs/routes.py:121-158
POST /, PUT /{job_id} Create and update nesting_job.create, nesting_job.update src/cluster_erp/modules/nesting/nesting_jobs/routes.py:161-185
DELETE /{job_id}, POST /bulk-delete Soft-delete nesting_job.delete, nesting_job.bulk_delete src/cluster_erp/modules/nesting/nesting_jobs/routes.py:188-210
POST /{job_id}/approve Approve nesting_job.approve src/cluster_erp/modules/nesting/nesting_jobs/routes.py:213-224
POST /{job_id}/calculate-costs Cost the material nesting_job.update src/cluster_erp/modules/nesting/nesting_jobs/routes.py:227-236
POST /{job_id}/reserve-material Reserve sheet stock nesting_job.update src/cluster_erp/modules/nesting/nesting_jobs/routes.py:239-248
POST /{job_id}/export, POST /{job_id}/import-result Exchange with an external tool nesting_job.read, nesting_job.run src/cluster_erp/modules/nesting/nesting_jobs/routes.py:251-281
POST /{job_id}/pull-parts Add parts from linked orders nesting_job.update src/cluster_erp/modules/nesting/nesting_jobs/routes.py:284-293
GET /{job_id}/summary, GET /{job_id}/svg, GET /{job_id}/dxf Summary and drawings nesting_job.read src/cluster_erp/modules/nesting/nesting_jobs/routes.py:296-396

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).

Constraints and validation

Parts

  • 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).

Material

  • 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).

Costs

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):

Result Formula Source
material_cost sheet area times sheets used times rate src/cluster_erp/modules/nesting/nesting_jobs/services.py:598-602
remnant_credit total remnant area times rate src/cluster_erp/modules/nesting/nesting_jobs/services.py:604-612
scrap_cost (waste area minus remnant area, not below zero) times rate src/cluster_erp/modules/nesting/nesting_jobs/services.py:614-624
net_material_cost material cost minus remnant credit src/cluster_erp/modules/nesting/nesting_jobs/services.py:626-628
allocated_material_cost per part the part's bounding area times placed count, as a share of all placed area, times the net cost src/cluster_erp/modules/nesting/nesting_jobs/services.py:635-652

Approval and remnants

  • 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).

Terms introduced

Term Code identifier Definition Turkish term Source
nesting part NestingPart A product to be placed in a job, with its size and outline. Yerleşim parçası src/cluster_erp/modules/nesting/nesting_parts/models.py:13
remnant credit remnant_credit The value of reusable leftovers deducted from the material cost. Artık alacağı src/cluster_erp/modules/nesting/nesting_jobs/models.py:278
net material cost net_material_cost Material cost minus remnant credit. Net malzeme maliyeti src/cluster_erp/modules/nesting/nesting_jobs/models.py:282

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13