Modello dati
Scopo
Mappare i DocType dell'app ez_factoryos (v0.1.0), relazioni e naming series. Fonte: JSON in apps/ez_factoryos/ez_factoryos/ez_factoryos/doctype/.
Prerequisiti
- Concetti Frappe: DocType, List/Form view, Link, Child table, naming series, permessi per ruolo. Vedi Fondamenti Frappe.
Diagramma ER (anagrafiche + produzione)
erDiagram
FactorySupplier ||--o{ FactoryRawMaterial : supplies
FactorySupplier ||--o{ FactoryPackaging : supplies
FactoryProductCategory ||--o{ FactoryProduct : classifies
FactoryProduct ||--o{ FactoryProductMaterialItem : contains
FactoryProduct ||--o{ FactoryProductPackagingItem : uses
FactoryProduct ||--o{ FactoryProductLabelItem : labeled
FactoryRawMaterial ||--o{ FactoryProductMaterialItem : referenced
FactoryPackaging ||--o{ FactoryProductPackagingItem : referenced
FactoryProductLabel ||--o{ FactoryProductLabelItem : referenced
FactoryLine ||--o{ FactoryLineMachineItem : has
FactoryMachine ||--o{ FactoryLineMachineItem : assigned
FactoryLine ||--o{ FactoryProduct : default_line
FactoryShift ||--o{ FactoryOperator : default_shift
FactoryCustomer ||--o{ FactoryWorkOrder : orders
FactoryProduct ||--o{ FactoryWorkOrder : produces
FactoryLine ||--o{ FactoryWorkOrder : on_line
FactoryMachine ||--o{ MachineCommand : commands
FactoryMachine ||--o{ MachineEvent : events
FactoryMachine ||--o{ MachineDataLog : logsDocType — anagrafiche
| DocType | Series / autoname | Campi chiave |
|---|---|---|
| Factory Customer | FC-.YYYY.- | customer_name, tax_id, is_active, contatti |
| Factory Supplier | FS-.YYYY.- | supplier_name, tax_id, is_active |
| Factory Product | FPR-.YYYY.- | product_name, category, default_line, raw_materials, packaging_items, labels |
| Factory Product Category | category_name | is_active, description |
| Factory Product Label | label_name | is_active, description |
| Factory Raw Material | FRM-.YYYY.- | material_name, supplier, uom |
| Factory Packaging | FPK-.YYYY.- | packaging_name, supplier, uom |
| Factory Line | FLN-.YYYY.- | line_name, child machines |
| Factory Machine | FMC-.YYYY.- | vedi Macchine |
| Factory Operator | FOP-.YYYY.- | operator_name, employee_id, default_shift |
| Factory Shift | FSH-.YYYY.- | shift_name, start_time, end_time |
| Factory Work Order | FWO-.YYYY.- | vedi Produzione |
Child table
| Child | Parent / field | Campi |
|---|---|---|
| Factory Product Material Item | Product → raw_materials | raw_material, qty, uom |
| Factory Product Packaging Item | Product → packaging_items | packaging, qty, uom |
| Factory Product Label Item | Product → labels | label |
| Factory Line Machine Item | Line → machines | machine |
Campi comuni sulle anagrafiche master: naming_series, is_active (default 1), notes.
DocType — macchine / OT
| DocType | Tipo | Ruolo |
|---|---|---|
| Machine Connection Profile | Single | Enable, base_url, timeout, TLS, stato connessione |
| Machine Command | MCMD-.YYYY.- | Comandi con approvazione e dispatch |
| Machine Event | MEV-.YYYY.- | Eventi gateway (idempotenti su external_event_id) |
| Machine Data Log | MDL-.YYYY.- | Audit Read / Command / Event |
Settings
| DocType | Contenuto |
|---|---|
| Ez FactoryOS Settings (Single) | Single con i campi Brand cliente (client_name, client_logo, hide_client_logo). La configurazione OT effettiva è in Machine Connection Profile + env (NODE_RED_*) |
Perimetro del modello dati
Il codice contiene esclusivamente i DocType elencati sopra. Non esistono DocType Lot, Quality Check / Non Conformity, Warehouse / Stock Movement, Production Batch.
Per le attività quotidiane di tracciabilità, qualità e magazzino con gli strumenti esistenti vedi:
Ruoli
Creati in install/fixtures: Factory Admin, Production Manager, Line Operator, Warehouse Operator. Permessi nei JSON DocType. Dettaglio operativo: Accesso e Desk.
Verifica
# Nel container Frappe
./scripts/bench-exec.sh bench --site factory.local list-apps
# Desk → Ez FactoryOS: anagrafiche e Number Card visibiliIn Desk, Awesome Bar → digitare il nome DocType (es. Factory Product) → List view con filtri ed export CSV.
