OpenCore MES Try the demo

Docs Designing the system 11

Flow templates: routes and plans

On this page

A flow template is how something goes, drawn: a route a lot goes through step by step, a plan (an OCAP, out-of-control action plan) that an event such as an SPC reading out of limits sets off, or an approval flow: who approves a change to a record, step by step, from the plant's structure (section 12, Approval flows). You draw it in the Flow designer; it is approved like any other design, and every run of it is audited.

The Flow designer drawing the molding route: Start, Drying, Molding, a decision on scrap, Curing, Held for review
The Flow designer: the seed's molding route, step by step, with a decision on the scrap and the end it sends a lot to.
The Flow designer drawing the molding route: Start, Drying, Molding, a decision on scrap, Curing, Held for reviewThe Flow designer: the seed's molding route, step by step, with a decision on the scrap and the end it sends a lot to.

First, the objects take part. Open the object in the change (a lot), and on its General tab under Flows tick how its records may take part:

  • a traveler: goes along a route (a lot). Pick its step field, a text or choice field: the step the lot is at. The route sets it as the lot moves on; and if someone sets it (a form, an import, a transaction that moves it), the route follows. Its policies must let the template write it. If it is a choice field, each step of the route must be one of its choices.
  • a resource: where a step's work is done (a tool).
  • a subject: its records may set a plan off (an SPC reading).
  • a reference: a template may read it (a product).

Then the template. Start one from the designer's home (Flows → New flow template), or add one to a change (+ flow template). Either may start as a copy of another (pick it beside the name): all of it under the new name, its scenarios running the copy. One process's OCAP becomes another's this way: change its start (the step it is set off at), its causes and their actions, and its label. A copy is a new design, reviewed and approved like any other (every kind is copied the same way). Its tabs:

  • Flow: the canvas. Add a node from the palette; drag it into place; click it for its settings beside the canvas; to wire two nodes, drag the dot at the first one's side onto the second. Click a wire for its settings. Shift (or ⌘, Ctrl) and a click, or a drag on the empty ground, selects several nodes, zoomed or not: drag one and they all move, wires with them. Wires are drawn as curves or as angled lines, your choice by the button at the canvas's corner, on every canvas you open. Delete on the canvas removes the selected nodes (with their wires) or wire, asked first. Tidy lays everything out. A node or wire with a problem is outlined in red, its problem said under its settings. On a phone, the canvas is a list. Zoom: the canvas is fitted to the panel; − and + in its corner zoom out and in, as does Ctrl (⌘ on a Mac) with the wheel, or a pinch, about the pointer; the percentage fits it again. Zoomed in, move about with the wheel or the scroll bars, or drag the empty ground with Space or Alt held (a plain drag there selects). A run's map (Show the route, a plan's page) zooms the same way, and there a plain drag moves about. The zoom is yours alone: it is not saved with the design. A node's settings show its id (what a lot's step holds, and what lists and reports show): Rename… gives it one that reads well (adi_cd rather than sequence_1); its wires, its place and the scenarios that expect it follow. Lots already on the route keep the version they started on.
  • General: its label, its kind (a route or a plan: each has its own palette), and Ends early when (a lot merged or scrapped ends its way where it is). A route also has As it enters any step, run and As it leaves any step, run: a transaction it runs on its traveler, as itself, every time. This is how a future hold works without touching each transaction: a transaction that finds the holds engineers set for this lot (or every lot) at the step it leaves, uses them and holds the lot, run as it leaves any step. The transaction appears on the traveler's records, names the route among its callers (Routes), and is signed by nobody. Time links (a route): a queue time between two steps. Each link opens as the lot reaches or leaves one step and closes as it reaches or leaves another, or has one of that step's transactions done there (Track in at the furnace); it says a warning, a maximum and a minimum in minutes, what runs at the warning and past the maximum (a transaction on the lot, run by the route as itself, like the every-step one), and Unless, a condition on the context that lifts the maximum (a waiver the lot carries). Past the maximum, or before the minimum, that transaction is refused in words saying how long the lot has waited and the limit. Each link is drawn as a timing diagram over its fields: the time since it opened, from the opening to the closing, the minimum, the warning and the maximum where they fall, what happens past each (refused, warned, what runs), and the stretches between them toned; it follows the fields as you change them. Links are drawn dotted on the canvas too, below the steps, with their limits.
  • Context: what every run carries and its decisions read: its records (by their names on the Participants tab), the values it starts with (a limit, a number of retries), and what is collected on the way.
  • Participants: its records (the traveler, the resource, what it reads, each taken from another with from: the lot's product), each by a name the context and conditions use (rename… it: lot rather than record_1; the template's conditions follow, while scripts that read it are named for you to change), and what the template itself may do: the roles it acts with when it sets a lot's step and state and makes its scripts' writes. Give it the least it needs. A role on an object that takes no part (the samples a route's script makes, a plan's PM record) is added with + roles on another object.
  • Scenarios, Translations, Stewards, Changes, JSON and Copilot, as for every design.

A route's nodes

NodeWhat it is for
StartWhere runs begin. For travelers where: which lots this route takes ({"eq": [{"context": "product.route_flow"}, "back_end"]}). A lot made part-way starts at its step. On a plan: For events where, and Due on (a date field of its subject: it sets off when that date arrives) and sets off again (once its last run for a record has ended)
SequenceA step. What to display: the transactions shown on a lot's page at this step and allowed only here (at the other steps they are refused, in words); Which of them move it on: those that take it on to the next step (Move out); Marks its state: optional (a state some action leads to: one nothing leads to is refused here, since entering the step would stop the lot's run); On resources where: only these tools ({"process": ["die_saw"]}), the ones a transaction is given, not those it reads off them (a test cell's tester, an input taken from the cell); Settings: values its transactions read ({"lsl": 28, "usl": 36}, read as {"node": "lsl"}; in a transaction's checks and steps the expression builder offers them as the step's lsl, from the routes that offer it, so "the step's parameter is not empty" keeps a measurement to the steps that say what to measure). What the run carries is read the same way, as {"flow": "layer"} (the builder offers the run's layer): the template's values (its Context tab), what a sub flow was passed, what a script set on the way and, inside a segment, the values of the route it runs inside; In the guide at: where this step is in the route's guide, a page (3) or a moment of a video (0:45), for a screen's file block that follows the route; Its screen: a screen that opens over the lot's page while the lot is at this step, on the lot (its parameter is a lot, or it has none), for the step's people who may open it: by itself when they open the lot, and again from the button with its name on the lot's route line. Closing it changes nothing: the lot stays at its step, as it was. What it saves goes through its transactions; one that moves the lot on closes it, and the next step's screen, if any, opens; For: who acts on the lot here (below)
Auto decisionBranches at once. Click each wire for Taken when, a condition on the context (section 17; {"gt": [{"context": "lot.scrap_qty"}, {"context": "max_scrap"}]}); it may count records and read today ({"lt": [{"count": {"object": "reading", "where": {"product": {"context": "lot.product"}, "created_at": {"within": 240}}}}, 1]}: nothing of this product measured in the last four hours, so measure this lot; {"gt": [{"context": "lot.expiry"}, {"now": "date"}]}); they are tried in order (Try earlier), and the last has no condition: otherwise. With a condition on every wire the designer refuses the node, since a run would stop there the moment none holds
Sub flowRuns another route for the same traveler. The lot goes through that route's steps, then comes back to this route's next step. Runs: the route to run; Outputs context: values put into its context as it starts; Receives context: values taken from its context when it ends, into this route's. What is passed, the segment's steps' transactions read as {"flow": "layer"}: one litho segment, run once per layer, checks the reticle against the run's layer
EndCloses the run, with its outcome (shipped)

A route inside a route. Draw a segment once (a rework loop, a test segment, a common back end) and run it from every route that needs it:

  1. Draw the segment as its own route, and on its General tab set Runs to only inside another route. It then takes up no lot by itself, and needs no scenario of its own: it is tried through the routes that run it.
  2. In each route that needs it, add a Sub flow node where the segment belongs, pick it under Runs, and wire it in like a step.

While a lot is in the segment, its step is the segment's (Strip, Redo), the transactions offered are that step's, and its page shows both: Main route › Rework · at Strip. A transaction the segment offers (a measurement at its metrology step) is the route's to place everywhere: on the main route's own steps, and in other segments, it is refused ("…is at Mold, where Measure is not done"), the lot not yet in the segment or already past it. When the segment reaches its End, the lot goes on to the route's next step. A fix to the segment is one change, and every route that runs it follows: lots entering it afterwards take the new version; a lot already inside finishes on the version it entered. A lot may be carried out of a segment by setting its step to a step of the route it runs inside: the segment ends there, and the route follows, marked off route. Routes nest at most five deep, and never in a circle.

Who acts at a step, and who sees the lot there. A step's For names the groups (departments too) and the people it is for: while a lot is at that step, only they run the transactions it offers on it. Anyone else does not see those buttons on the lot's page, and a run from anywhere (a screen, the transaction's own page, the HTTP API, the copilot) is refused in words: Lot LX-1 is at Final inspection (Back-end route), which is for Quality: not you. The transaction's own callers and the lot's policies still hold: For only narrows who may, it never lets anyone in. Someone standing in for a person named there (the directory's Delegate my signing) acts as that person would; a group's members act; a certification is said where it already is (the transaction's checks, the object's access).

Anyone else says what the others may do while the lot is there:

  • as their policies say (the default): they read it and change it as before; only the step's transactions are refused them.
  • reads it only: they see it, and change nothing of it there: no field, no action, no archiving. A change is refused in words naming the step and whom it is for.
  • does not see it: it is not in their lists, counts, searches, screens, queries, reports or analytics, and its page is not there for them, until it moves on. Auditors, who read every record, still read it.

The canvas says whom each step is for, with a lock where others are held; the lot's route banner says it beside the step (at Final inspection · for Quality; anyone else reads it only), and so does the sandbox's Follow a route, saying whether the person it is followed as is among them. Inside a segment, the step the lot is at decides. A service acting as itself (a tool's adapter tracking a lot out) is no person on the floor and is not held by For: its transaction's callers decide. For is access: once the change is approved it holds for every lot at the step, including those that started on the route's earlier version. Where two routes draw the same step, the strictest of them decides who sees a lot there.

A plan's nodes: Wait (a message and the time remaining; when the time is up it goes on by itself, waits for someone to acknowledge, or also offers Retry, which takes its retry wire back), Manual decision (a person picks one of its wires: name each wire's choice), Input screen (collects list choices, typed values, files, images and links into the context), Transaction (a person runs a transaction from the plan: Runs picks it, Gives fills its inputs from the plan, such as {"context": "deviation.id"}, shown locked on its form, and Keeps its run as names where the run is kept, so the decisions after read what was entered: {"context": "found.input.cause"}. Its form opens over the plan's page by itself; closed without sending, the step waits as it was and Open brings the form back; once it has run, the plan goes on. The transaction's own callers and rules still decide whether the person may run it, and its stewards approve the plan's change), Sub flow (runs another template, passing it values and taking some back; never in a circle: a template whose sub flows lead back to itself, through others too, is refused, the way round named; and at most five plans deep, the first and four below it: a run that would go deeper stops at that sub flow, saying so. The designer checks circles, not depth, so keep chains short), and Auto decision, Start and End as above. An installed suite may add node kinds of its own, listed in the palette under its name, each working as the core kind it extends.

The deviation response plan on the canvas: Contain, Await the lab, a manual decision on the root cause, the disposition
A plan (an OCAP) on the canvas: the seed's deviation response. Its palette offers waits, decisions, input screens and transaction steps.
The deviation response plan on the canvas: Contain, Await the lab, a manual decision on the root cause, the dispositionA plan (an OCAP) on the canvas: the seed's deviation response. Its palette offers waits, decisions, input screens and transaction steps.

Scripts on a node. Every node can run a script On entering and On leaving: a rule script that gets the run's context and gives it back. It can set values in the context for the decisions after, and ask for writes (ctx.writes.push({ record: "lot", action: "ship" })). Those are made after it, as the template, through the record's own rules: its transitions, policies and rule pipes decide, and a refusal stops the run there, saying why. Like every script, it needs its test cases. New script… beside each makes one in the same change, from a template that sets a context variable, with a test case to start from, and names it on the node; Edit opens the one named, under the canvas. A node's script may read a record with await ctx.lookup("wafer", "F26-1004-07") (as the template: only what its roles let it see; null otherwise); its test case gives such records under lookups ({ "wafer/F26-1004-07": { "state": "broken" } }). A variable a script sets (ctx.context.kind = "oven") is shown on the plan's page under What it holds, and the decisions and lists after read it ({"context": "kind"}).

A dropdown from a query. An input screen's field of type from a query draws its list from a named query (Designer, Queries): pick the query, the column kept as the value (id), the columns shown, joined (machine_id, name shows "M-101 · Press 1"), and bind each of its parameters to the run's context ({"context": "kind"}, a variable a script set, or {"context": "lot.product"}, a record's field), the user ({"user": "id"}) or a value. Each person sees the rows the query gives them, under their own access; what they send is checked against that list again.

When a plan runs. A plan sets off by itself when a record of its subject is made or changed where its start's condition holds (a deviation raised as major, an SPC reading out of limits), once per record. Two settings of its start change that. Due on names a date field of the subject (a preventive maintenance's next date): the plan sets off when that date arrives, with nobody writing anything, checked about once a minute. Sets off again lets it run again for the same record once its last run there has ended (a tool that goes down a second time); one runs at a time, however often the record is changed meanwhile. A plan whose start has neither a condition nor a due date runs only as another plan's sub flow. When it reaches a decision, an input screen, a transaction step or a wait to acknowledge, it appears in the bell of the people it is for (Plans waiting for you). Its page shows the plan's own state (in progress, stopped or ended), what set it off with that record's own state beside it (a tool Down while its repair is in progress), and the route that record was on, the time remaining at a wait, a button per choice, or a form to fill in (lists, numbers, yes or no, files, photos, links), with its way so far and what it holds. No mouse is needed: the cursor starts in the form's first field, Space ticks a box, a letter picks from a list, Enter goes to the next field and, on the last, sends it (Esc goes back); at a choice, the cursor starts on the first button, Tab moves to the next and Enter presses it. Files open from there: a picture, a PDF or plain text opens beside the page, anything else (a web page, a drawing with scripts in it) is saved to your device instead of being opened. When two people act on the same step at once, or one clicks twice, the plan goes on once and the other is told someone has just acted. Show the flow draws the plan as it was designed with its way on it: the steps it went through filled in, the wires it took marked (×2 when twice, as after a retry), where it is now outlined, what it never reached faded; point at a step for when it was there and who moved it on. Only the people it is for may act; everything they do is in the audit trail. The record that set it off, and the records it reads (a deviation's lot), show the plan on their page.

A deviation response plan's page: set off by a deviation, waiting at Contain with its form, its way and what it holds
A plan's page: what set it off, the step it waits at (here a form for Quality), its way and what it holds.
A deviation response plan's page: set off by a deviation, waiting at Contain with its form, its way and what it holdsA plan's page: what set it off, the step it waits at (here a form for Quality), its way and what it holds.

Its evidence. A template that sets off by itself (every route; a plan whose start has a condition or a due date) carries at least one scenario, or it is not submitted. Make one in the change's sandbox: pick or give the records, walk one through (run the transactions, or Answer a plan: fill its screen in, pick a choice, acknowledge or retry a wait, or let its time pass), and Keep it as a scenario of the template: it keeps what each step did and the step or node each record reached. Its Scenarios tab lists them with their last result; the fitness test runs them all again on every submit.

When a route runs. On a lot's page you see the route it is on, the step it is at and its way there, and each time link under way: what closes it and the time left, or how far over it is; Show the route draws the route with the lot's way on it, a step set by hand drawn off route, the links dotted (red past their maximum). A sub flow (a box with an arrow on its right) opens when you click it: the sub route's own map with the lot's way through it, or, if the lot has not got there yet, the sub route as it is now, faded. The line above the map (QFN route › Front of line › Bond rework) takes you back up; a sub flow the lot went through more than once lists each time (runs: 1 2). A lot at a step is offered only what that step does. When a transaction that takes it on commits, the route moves it on, through decisions, to the next step. If someone sets its step by hand, the route follows, marked off route in its way. If the step they set is no step of the route, the run stops and says so; the route's moves are refused until the step is put right.

A lot's page with its route drawn: Start went through, Drying now, the rest not reached
A lot on its route: where it is, its way there, and the route drawn with its way on it.
A lot's page with its route drawn: Start went through, Drying now, the rest not reachedA lot on its route: where it is, its way there, and the route drawn with its way on it.

A lot that joins a route later, or moves to another. A lot is taken up when it is made where a route's start holds, and on any later write while it is on no route: an import that sets its product afterwards, a lot returned from a customer, a lot whose route ended. It starts at the step its field names (inside a segment too: the route waits at its sub flow, the segment's run under it), else at the start. Where the route runs a segment twice, a lot made at one of its steps is put in the first pass; one a transaction makes from a lot inside the segment (units split off) goes where that lot is, the second pass included. A lot whose route is done is not taken up again by an edit: only one carried to another step, or whose route's Ends early when no longer holds. To move a lot to another route, give the lot (or its product) a field the routes read: each route's start For travelers where names its own value, and its Ends early when says when the lot is no longer its ({"ne": [{"context": "lot.route"}, "fast_track"]}); a transaction that sets that field, and the step, ends the one route and starts the other on the same write, both audited (use case 47). A plan's script that sets a lot's step is followed like a hand's: off route, audited as the plan; one that takes the lot to a state the route ends on ends its run.

Input flows: entry designed for the keyboard and the scanner

An input flow says how a person at a transaction or a screen fills it in from the keyboard or a scanner. It is part of that transaction or screen: its Input flow tab, Draw an input flow (it starts you with Start → Scan it → Check and confirm → Next), drawn on the same canvas as a route or a plan and approved with the rest of the form by its stewards. A transaction's walks its form wherever it is shown; a screen's runs over its machine and its forms, and then the screen walks those forms itself, their transactions' own flows left aside (one cursor, one flow). Remove the input flow takes it away. Its steps:

  • Ask: the cursor to one input, outlined, with its prompt above the form ("Scan the lot"). On a transaction, an input by name (lot); on a screen, param (its machine) or move_in.lot (the name alone when it has one transaction). Moves on by: Enter (the default, and what a scanner sends), Tab, Enter or Tab, a key of its own (F1–F12, or a scanner's suffix such as *; press it in the box), or by itself, once complete (a scan that found its record, a choice picked, or the entry reaching a length or matching a pattern). An input already filled (by the screen, a row's button, a Fill) is passed over, unless you untick it. On an error: the cursor stays until it is put right (the default), or goes on regardless. Where the input has labels (the transaction's Scanning tab), Expects the label names the one this step waits for: a scan of another is refused there, in words, which is the wrong label on the box.
  • Fill: sets an input on the way (the good quantity from the lot's, {"lookup": "lot.qty"}).
  • Auto decision: its wires' conditions, on what was entered: {"lookup": "lot.state"} is the state of the lot just scanned, so a lot on hold can be asked why and others not.
  • Run: Check, then Enter on Confirm, or confirmed at once; a signature is always asked. If the check refuses, the cursor goes back to the last ask with what it said.
  • End: the start again for the next one (the form is empty again), or stop.

The designer checks it against the form it belongs to: a transaction's input flow asks only for its inputs that a person types, and a screen's only for its machine and its own forms' inputs, each problem shown on the node or wire it concerns. It runs in the browser and writes nothing itself; drawing or changing one needs no new scenario. The copilot and the AI API can draft one, and walk it with sample values to show you what it asks, in order.

Named queries

Queries on the designer's home lists the named queries: one SELECT over the query views (the objects, as the schema explorer on the Query page shows them), with parameters by name, :kind. Start one with New query, or + query in a change. Its tabs: General, Query (the SELECT; parameters it uses but has not declared are named, with Declare them as text), Parameters (each one's type, label, and whether it is required), Ranking, Try and tests (type values and Run it: you see what you may read; Keep these values as a test), Used by, Web, Translations and Stewards. The fitness test runs each test as whoever submits the change: it must run, and give the columns the dropdowns drawn from it name. A query grants nothing: whoever it runs for sees only what their access lets them read, and never a sensitive field. At most its limit of rows (200 unless set, up to 1000).

The Query page: the views on the left, a SELECT of the lots in process, and its rows
The Query page: one SELECT over the plant's objects, its rows exactly what your roles let you read.
The Query page: the views on the left, a SELECT of the lots in process, and its rowsThe Query page: one SELECT over the plant's objects, its rows exactly what your roles let you read.

A reference's choices from a query. A reference field (Fields, its ⋯ panel, Choices) or a transaction's reference input (Inputs, Choices of …) may offer only the rows a query gives, in place of every record of its object: the presses of the lot's line, the tools qualified for the step. Pick the query (it must give an id column), tick the columns that say each one (none: the record's title), and bind each of its parameters: on a form to what is being filled ({"data": "line"}), on a transaction to its inputs and the records they name ({"input": "kind"}, {"lookup": "lot.product"}) or the route step ({"node": "area"}). The picker lists the choices as the field is entered, narrowed as the person types; a save or a run naming any other record is refused, on that field, in words.

A screen's table of a query's rows. On a screen's table block, Rows from: a named query: pick it, tick the columns shown (none: all but id), bind its parameters to the screen's parameter or the viewer, and sort by one of its columns. Each row a record of an object, when the query gives the records' id: a row then links to its record and offers that object's transactions as row buttons.

Kept in line. The query's Used by tab shows the columns it gives (the database describes them without running it) and every design that names them. A change to a query that takes a column away, or adds a parameter that must be bound, names every screen, form, transaction and plan it would break, in the change or not; so does a change that takes from an object a field a query reads. Align (on the change's problems, or the Used by tab) brings those designs into the change, each without what is no longer there, to finish and approve with the rest.

Ranking the rows. The Ranking tab puts a query's rows in order of a score you can explain: add terms, each a name, the words a person is told ("Hot lot"), an expression over the SELECT's own columns (a number, or CASE WHEN priority = 'hot' THEN 1 ELSE 0 END; empty counts as 0; it may use the query's parameters) and a weight (negative takes points away). A row's score is the sum of its terms; Highest score first (or last). The query then also gives rank_score and a rank_<term> column per term, which a screen's table can show: the score is headed Score, each term by its words, and the score's cell says on hover what the row scored for. Rows are ranked before the limit cuts them, so leave LIMIT out of the SELECT; a table that sorts by a column of its own sorts by that instead.

A query read over the web. On its Web tab, tick Published over HTTP and name who may read it (people or groups; nobody until named). An outside system (a BI tool, an ERP) then reads it with GET /svc/v1/<name>?state=created and a token (scope query:run, read only) whose person is among them: a page of rows as that person may read them, each an object by column, at most its limit; offset (the answer's next), limit, sort and dir page through the rest. A parameter missing, of the wrong type or one it does not have is named in the answer. Its name is its address: no web service or transaction published over HTTP may have it. Once others read it, a change that would break them (a parameter or a column taken away) needs their notice first: Deprecated, with a sunset.