Add configurable production machine constraints

This commit is contained in:
2026-09-26 10:47:53 +02:00
parent e6a7d4da72
commit 3e13d24405
12 changed files with 904 additions and 3 deletions
+25 -3
View File
@@ -107,6 +107,7 @@ Implemented routes:
| `/api/calculations/roll` | `POST` | Basic Auth | Resolves, validates, and executes a direct roll-diameter request. |
| `/api/calculations/roll/modify` | `POST` | Basic Auth | Applies explicit changes to structured calculation state and recalculates. |
| `/api/calculations/transport` | `POST` | Basic Auth | Executes the shared transport-capacity analysis. |
| `/api/calculations/production-feasibility` | `POST` | Basic Auth | Checks configured production-machine constraints. |
| `/api/reports/roll-calculation.pdf` | `POST` | Basic Auth | Recalculates a request authoritatively and returns a one-page PDF. |
| `/api/conversations` | `POST` | Basic Auth | Creates an in-memory conversation session. |
| `/api/conversations/<id>/messages` | `POST` | Basic Auth | Interprets one utterance and executes the deterministic workflow. |
@@ -119,11 +120,11 @@ Authentication is implemented with `Flask-HTTPAuth`. The current code checks `BE
`mcp_server.py` provides a local stdio-only Model Context Protocol server. It is
a thin adapter over the same domain services used by Flask: article lookup,
direct roll calculation, product-length calculation, material-weight calculation,
and transport analysis.
transport analysis, and configured production-machine feasibility.
The available PoC tools are `get_article`, `search_articles`,
`calculate_material_weight`, `calculate_product_length`,
`calculate_roll_diameter`, and
`analyze_transport_capacity`.
`calculate_roll_diameter`, `analyze_transport_capacity`, `get_machine`, and
`check_production_feasibility`.
Install the pinned dependencies, including `mcp==1.26.0`, in the existing
environment, then start it with:
@@ -165,6 +166,16 @@ Tool calling semantics:
`transport_roll_inputs` unchanged. The supplied `roll_weight_kg` is passed
through unchanged. Callers may use a canonical `transport_preset` or provide
custom transport dimensions and `max_weight_kg`.
- `get_machine` resolves a configured machine by stable ID, display name, or
configured alias. Locations are descriptive metadata only.
- `check_production_feasibility` evaluates all configured independent machine
limits deterministically. Its V1 weight is material-only: it never estimates
core, packaging, or gross weight. Callers pass `average_diameter_mm` and
`maximum_diameter_mm` from `calculate_roll_diameter`; a nominal fit with a
maximum-diameter exceedance is `feasible_with_warnings`, while a nominal
exceedance is `not_feasible`. Missing configured roll inputs produce
`needs_clarification`; line speed is retained in configuration but outside
the initial roll-feasibility scope.
Generate a password hash or user entry with:
@@ -516,6 +527,17 @@ Primary product/article dataset used by the active calculator UI.
JSON configuration for forklift/heavy-roll rules. The active template also contains an inline `window.APP_CONFIG`, so developers should verify which config source is authoritative before changing rule behavior.
### `config/machines.yaml`
Runtime configuration for production-machine constraints, loaded with
`yaml.safe_load` and strict schema validation by `machine_constraints.py`.
It has `schema_version: 1`, stable IDs, names, aliases, locations, and explicit
unit-bearing constraint keys. `null` line-speed constraints mean unknown/not
configured; they do not mean zero or unlimited capability. The CSV in
`data/source/LineLimitations_RollCalc.csv` remains the source/reference
document. The browser currently has no production-machine control; the shared
Flask API and MCP tools expose the capability for later UI work.
### `access_log.json`
JSON audit log written by `app.py`.