Urgent.News

What's breaking now, across thousands of outlets.

Tech

Model Line Changeover as a State Machine So the Next SKU Cannot Start Before Clearance

By Isaac Muthui, CEO, Tamalaki Business Network Ltd. Originally published at factoraerp.com . If you build production or MES/ERP software for food manufacturers, here is a failure mode worth designing out: the next product's production order can start on a line while the previous product is still, in practice, on it. In small and mid-sized food and agro factories in Kenya, where I work,…

In the food manufacturing industry, particularly in small and mid-sized factories in Kenya, product changeovers on production lines can lead to a failure mode where the next product's production order starts while the previous product is still present on the line. This issue arises due to residue, leftover labels, work in progress, and stale machine settings from the previous product. To address this problem, a line clearance checklist and software modification are needed.

Currently, production orders are often modeled with a status (planned, in_progress, completed) and a line_id. However, this design does not prevent two orders from being in_progress on the same line or starting a new order before the previous one is fully cleared. The solution is to model each line with its own state machine, making orders depend on the line's state.

Key states in the line state machine include RUNNING (for an active order), CLOSED_OUT (when the order is completed with all relevant data recorded), CLEANED (after the cleaning process), and CLEARED (after verification that the line is clear of the previous product). A transition from RUNNING to RUNNING is not allowed, even for administrators, ensuring that no order can start until the previous one has been properly cleared.

The system enforces several rules through code. Only one active order per line is allowed, and start_order can only be triggered when the line is in SETUP state and first-off QC has passed. Skipping states is not permitted, and there is no transition from RUNNING to RUNNING. Changeover type determines the required cleaning program and verification checks, derived from the products being changed over.

Segregation of duties is crucial, with the verify_clearance.checked_by user differing from the record_cleaning.cleaned_by user, and both requiring a QA/supervisor role. The close_out process is a precondition, ensuring that any packaging or work in progress from the previous order has been returned, consumed, or explicitly scrapped before closing the order.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

V+ (Vit Plus): l’ambiente “tutto incluso” che mette ordine in linting, formatting, test e workflow

Un solo CLI, un solo file di configurazione, strumenti coerenti tra loro: meno colla, meno tool scollegati, più velocità e standard condivisi.

  • V+ simplifies front-end project setup, configuration, and management
  • Single CLI with unified commands for project creation, linting, formatting, testing, and building
  • Utilizes Oxlint and Oxformat for superior performance and simplicity over ESLint and Prettier

How to Reply When You Can't Tell If Someone Is Upset in a Text

You get a short message: "fine." or "ok, whatever works." And now you're staring at your phone trying to work out whether the person is annoyed, tired, or just typing fast.

  • Separate message from personal interpretations to avoid negative assumptions
  • Use neutral responses that apply to all possible emotions
  • Keep replies concise, focused, and avoid escalating the situation

Pin the Fault Matrix Before You Refactor a Messy Module

Pin the Fault Matrix Before You Refactor a Messy Module Consider an illustrative composite scenario rather than one specific incident, because the shape repeats across review threads. A service module grows past nine hundred lines, a coding agent returns a four hundred line refactor diff, and the existing suite turns green on the first…

  • Error surface changes first in refactor, not happy path
  • Three patterns cause drift in error surface: type flattening, code loss, ordering drift
  • Fault matrix helps track raised exceptions during refactoring

More from Thursday 15 October →