Skip to content

Feature: Weighted products & scale-generated barcodes (electronic scale, stage 1) #365

Closed

Description

@khaira777

Feature: Weighted products & scale-generated barcodes (electronic scale, stage 1)

Summary

Support deli/grocery-style weighted items. Stage 1 = scale-generated labels: many scales print barcodes that embed a PLU + weight/price. Stage 2 (separate, later) = direct HID/USB/serial scale reading. This issue covers stage 1.

Proposed configuration

Prefix         21
Product digits 5
Weight digits  5
Unit           grams

Scan 2101234012507 → product 01234 → 1.250 kg → add quantity 1.25.

Weighted product metadata

products: sale_unit (each|kg|g|lb), allow_fractional_quantity, weight_precision

What already exists

  • Order creation already accepts positive numerical (non-integer) quantities (main/routes/orders.ts: quantity <= 0 || !Number.isFinite(quantity) is the only guard) — fractional order math is compatible.
  • Concrete inconsistency to fix: held orders require Number.isSafeInteger(item.quantity) (main/routes/held-orders.ts:45), so weighted quantities fail there.
  • Barcode lookup is exact and uniqueness-enforced server-side (main/routes/products.ts ~750/851); scanner hook is global/reusable.

Acceptance criteria

  • Weighted product metadata fields + migration; fractional quantity works end to end.
  • Scale-barcode parser (prefix/PLU/weight config) adds the weighted item with correct quantity/price.
  • Held orders accept fractional quantities for weighted products.
  • Stage 2 (zero/tare/stable reading from a real scale) tracked separately later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions