Product
A Product is a specific item that can be produced at stations. Products belong to a Product Family and carry a standard_hours value used for efficiency calculations.
Database Table: ops_products
| Column | Type | Description |
|---|---|---|
id | UUID (PK) | Auto-generated |
family_id | UUID (FK) | References Product Family (ops_product_families.id) |
product_code | VARCHAR(50) | Short identifier, unique within family |
product_name | VARCHAR(255) | Display name |
standard_hours | DECIMAL(10,2) | Expected labor hours to produce one unit |
description | TEXT | Optional description |
is_active | BOOLEAN | Whether product is currently available |
sort_order | INTEGER | Display ordering |
Unique constraint: (family_id, product_code) — each product code is unique within its family.
Standard Hours
The standard_hours field is critical for efficiency calculations:
- Efficiency = Standard Hours / Actual Hours x 100%
- When calculating efficiency, the system checks
ops_products.standard_hoursfirst, then falls back toops_product_families.standard_hours - See Efficiency Calculation for details
Relationships
- Belongs to a Product Family (
ops_product_families) - Referenced by OPS Jobs (
ops_jobs.product_id) - Has per-station standard hours via Station Product Standards (
ops_station_product_standards)
CRUD Operations
Managed via the OEE Settings modal (gear icon on the OEE dashboard):
| Operation | Endpoint | SQL Function |
|---|---|---|
| List | GET /api/v1/ops/products | get_ops_products() |
| Create | POST /api/v1/ops/product | create_ops_product() |
| Update | PUT /api/v1/ops/product/:productId | update_ops_product() |
| Delete | DELETE /api/v1/ops/product/:productId | delete_ops_product() |
Codebase Paths
- Table:
database/sql_scripts/tables/ops_products.sql - Functions:
database/sql_scripts/functions/ops/ops_product_functions.sql - Backend:
backend/endpoints/ops.ts(handlers:handleGetProducts,handleCreateProduct,handleUpdateProduct,handleDeleteProduct)
Dollar Amount and Cost Tracking
Products carry a dollar amount (unit price/sale value):
- Revenue = units produced x product dollar amount
- Combined with machine-hours and person-hours from Job Time Tracking, enables profitability analysis
- OEE is trackable per product across all jobs for that product
- See Cost Tracking for the full revenue/cost model
The dollar_amount field on ops_products stores the per-unit sale value. Family-level cost is stored as unit_cost on ops_product_families.