Product

ops product glossary

A Product is a specific item that can be produced at stations. Products belong to a Product Family and carry all the production parameters used for efficiency calculations, job defaults, and cost tracking.

Database Table: ops_products

ColumnTypeDescription
idUUID (PK)Auto-generated
family_idUUID (FK)References Product Family (ops_product_families.id)
product_codeVARCHAR(50)Short identifier, unique within family
product_nameVARCHAR(255)Display name
descriptionTEXTOptional description
standard_hoursNUMERIC(10,2)Target labor hours to produce one unit
default_quantityINTEGERDefault job size when posting a job for this product
target_scrap_rateNUMERIC(5,2)Acceptable scrap percentage
unit_valueNUMERIC(12,2)Sale value per unit
is_activeBOOLEANWhether product is currently available (default TRUE)
sort_orderINTEGERDisplay ordering (default 0)
created_atTIMESTAMPTZAuto-set on creation
updated_atTIMESTAMPTZAuto-set on update

Unique constraint: (family_id, product_code) — each product code is unique within its family.

Index: family_id

Production Fields

All production parameters live on the product, not on the family:

  • standard_hours — drives efficiency calculations. Efficiency = Standard Hours / Actual Hours x 100%.
  • default_quantity — pre-fills the quantity field when an operator posts a job for this product.
  • target_scrap_rate — the expected scrap percentage. Used for quality tracking and reporting.
  • unit_value — what the product sells for. Enables revenue and profitability analysis alongside machine-hours and person-hours from Job Time Tracking.

Referenced By

  • oee_batch_details.product_id — every batch requires a product. When starting a batch, the operator must select a product from the product dropdown in the Start Batch modal (required field).
  • When a product is selected, its default_quantity auto-populates the target_quantity field on the batch.

Deletion Guard

A product cannot be deleted if it is referenced by any batches. Attempting to delete a referenced product raises an exception with the message: “Cannot delete product — it is referenced by existing batches. Consider marking it inactive instead.”

To remove a product from future use without deleting it, set is_active = FALSE. Inactive products do not appear in the product dropdown when starting new batches.

Relationships

  • Belongs to a Product Family (ops_product_families)
  • Referenced by jobs (ops_jobs.product_id)
  • Referenced by batches (oee_batch_details.product_id)
  • Has per-station standard hours via Station Product Standards (ops_station_product_standards)

Equipment Standards

Products can have per-equipment overrides for standard_hours and target_scrap_rate via the Equipment Product Standards junction table (oee_product_equipment_config). This allows different production expectations for the same product on different equipment.

CRUD Operations

Managed via the OEE Settings modal (Product Families tab). Products appear as expandable cards within their family’s detail panel, with inline editing.

OperationEndpointSQL Function
ListGET /api/v1/ops/productsget_ops_products()
CreatePOST /api/v1/ops/productcreate_ops_product()
UpdatePUT /api/v1/ops/product/:productIdupdate_ops_product()
DeleteDELETE /api/v1/ops/product/:productIddelete_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)

See Also