Skip to main content

Module interchange

Module interchange 

Source
Expand description

Interchangeable parts (feature 6, see docs/src/research/supersede-alternates.md):

  • Alternates – item B may be built in instead of item A in every assembly (item_alternates, one row per direction; “two-way” stores both). Item-level, not revisioned.
  • Supersession – item A is superseded by B: do not use A for new designs any more (item_supersessions, at most one successor, no chain back to A). The lifecycle state of A does not change.
  • Replace in assemblies – a mass change on the where-used list of A: every assembly whose latest revision is in work and not checked out by somebody else gets B instead of A (quantity, find number and notes kept); released assemblies and assemblies in review are listed as needing a new revision. plan_replace is the preview, replace applies exactly the same plan under row locks.

Items in groups the actor may not read are left out (and counted where a list is about usages of the actor’s item).

Structs§

LinkedItem
An item linked to another one as alternate, successor or predecessor, with the data of its latest revision.
NewAlternate
ReplacePlan
The preview (or, after replace, the outcome) of a replacement.
ReplaceRow
One BOM line of the latest revision of an assembly that uses the item.

Enums§

ReplaceAction
What replace does with one BOM line.

Functions§

add_alternate
Declares input.number an alternate of item_id.
alternate_for
Items for which item_id is a one-way alternate (the two-way ones are already in alternates).
alternates
Items that may be used instead of item_id (only those the actor may read).
clear_supersession
Withdraws the supersession of item_id.
plan_replace
Preview: what replace would do with every assembly using old_item_id.
predecessors
Items that item_id supersedes (only those the actor may read).
remove_alternate
Removes the alternate alternate_item_id of item_id – both directions when the actor may also edit the alternate’s group, otherwise only this one. Returns the number of directions removed.
replace
Replaces old_item_id by new_number in every assembly the plan marks ReplaceAction::Replace, in one transaction. A revision that is not checked out is changed directly (like check out, edit, check in); one checked out by the actor stays checked out. Fails when nothing can be replaced.
successor
The item that supersedes item_id; a successor in a group the actor may not read is a placeholder (the item is still superseded).
supersede
Declares item_id superseded by successor_number (replacing an earlier successor).
superseded_among
Which of the given items are superseded: item id → number of the successor (None when the successor is in a group the actor may not read). For marking BOM lines.