Inventory Units (UNT)

The unt submodule of inv owns the lowest-level identity-tracked inventory record: an InventoryUnit is one physical "thing" tracked by its cost-unit code (a coil, a roll, a pallet) plus its current location, supplier-lot, and a bundle of operational status flags. The submodule also owns the timestamped status-event and location-transaction streams that drive every status change and physical move. It depends on inv.loc for warehouse locations, inv.bun for the optional bundle a unit belongs to, inv.lot for the supplier lot and item lot, inv.lev for the on-hand inventory levels consulted before a move, acc.cst for the cost unit, and cat.itm for the item.

Concepts

Inventory Unit

A single identity-tracked physical thing. Identified by its CostUnit (one-to-one). Tracks the current location, the supplier lot, a derived availability status, and a small set of status flags (obsolete, complaint, reject, blocked, inspect).

Inventory Unit Status

A reference type that maps a status code to two derived flags — statusBlocked and statusInspect — that a unit inherits when the status is applied.

Inventory Unit Status Event

An immutable timestamped record of a status change on a unit, carrying the user, the (optional) new status, and a free-form description. Goes through DraftProcessed.

Inventory Location Transaction

An immutable timestamped record of a unit moving from one warehouse location to another, optionally as part of a bundle move. Goes through DraftProcessed; processing flips the unit’s current location and rolls the bundle along when present.

Inventory Availability Status

A derived enum (U Unrestricted / B Blocked / I Inspect) that other modules consult to decide whether a unit may participate in a flow.

Inventory Transaction Type

The classifier consumed by HasInventoryTransaction (in inv.loc) to say what kind of inventory operation a row represents — see Inventory Transaction Types below.

Entities

UNT entities

Inventory Unit (InventoryUnit)

A single identity-tracked physical thing.

FieldDescription

costUnit

The cost unit (one-to-one, business key, final).

supplierLot

Optional supplier lot.

currentLocation

Optional current warehouse location.

statusObsolete

Operational flag: marked obsolete. Default false.

statusComplaint

Operational flag: marked under complaint. Default false.

statusReject

Operational flag: marked rejected. Default false.

biStatusBlocked

Derived flag: blocked from outbound flows.

biStatusInspect

Derived flag: requires inspection before release.

biUnitStatus

Optional derived InventoryUnitStatus reflecting the most recently applied status.

biAvailabilityStatus

Derived availability — U Unrestricted, B Blocked, I Inspect. Default U.

item

Internal shortcut to the cost unit’s item (business-information).

A validation rule enforces that the cost unit’s item equals the supplier lot’s item.

Inventory Availability Statuses (InventoryAvailabilityStatus)

CodeNameMeaning

U

Unrestricted

Available for any flow.

B

Blocked

Not available for outbound flows.

I

Inspect

Quarantined pending inspection.

Inventory Transaction Types (InventoryTransactionType)

These are the kinds of inventory operations carried by every HasInventoryTransaction implementation across the ERP.

CodeMeaning

PUR

Purchase receipt

SLS

Sales delivery

WHR

Warehouse receipt

WHI

Warehouse issue

PRI

Production issue

PRR

Production receipt

SLI

Sales issue

SLR

Sales return / receipt

SUI

Subcontract issue

SUR

Subcontract receipt

ADJ

Adjustment

Inventory Unit Status (InventoryUnitStatus)

A reference status code with two derived flags.

FieldDescription

code

Business key (up to 4 characters).

description

Human-readable name.

statusBlocked

Whether units carrying this status are blocked. Default false.

statusInspect

Whether units carrying this status require inspection. Default false.

Inventory Unit Status Event (InventoryUnitStatusEvent)

A timestamped record of a status change. Implements the framework IsEvent interface.

FieldDescription

inventoryUnit

Owning unit (composite business key with eventDateTime).

eventDateTime

When the event was recorded (final).

user

The user who applied the status (final).

inventoryUnitStatus

Optional new status (final).

description

Optional free-form note.

processed

Lifecycle flag.

Inventory Location Transaction (InventoryLocationTransaction)

A timestamped record of a unit moving between warehouse locations.

FieldDescription

inventoryUnit

Owning unit (composite business key with transactionTimeStamp).

transactionTimeStamp

When the move happened (final).

bundle

Optional bundle the move applies to (final).

fromLocation

Optional source location (final).

toLocation

Destination location (final).

processed

Lifecycle flag.

Functionality

Recording a unit move

InventoryLocationTransactionActionWriter.addInventoryLocationTransaction records a fresh InventoryLocationTransaction for a unit (and optional bundle) moving to a target location, in Draft state. The from location is captured from the unit’s currentLocation at the time of recording.

Processing a unit move

processInventoryLocationTransaction is the seam invoked by the confirm action on the move event. It looks up the unit’s on-hand inventory line through inv.lev, raises a business exception if there is no on-hand stock or if there is more than one on-hand line (an integrity invariant), updates the unit’s currentLocation, rolls the bundle along when one is present, and marks the transaction Processed.

Bundle relocation

changeBundleLocation is the bundle-side counterpart used when a whole bundle moves. It records and processes a single transaction per affected unit while keeping the bundle/unit relationship in sync.

Status events

InventoryUnitStatusEventActionWriter is the action handler for the confirm and confirmUndo actions on a InventoryUnitStatusEvent. Confirming the event applies the new status to the unit (recomputing biStatusBlocked, biStatusInspect, and the derived biAvailabilityStatus); confirmUndo reverts to the previous state. The unit entity recalculates biAvailabilityStatus whenever a status flag changes (__setBiStatusBlocked and friends).

Public API

INV_UNT_QueryApi

This submodule does not provide a query API class. Other modules read units, statuses, status events, and location transactions through the standard generated readers.

INV_UNT_CommandApi

Write-side facade. All three methods delegate to InventoryLocationTransactionActionWriter.

MethodDescription

addInventoryLocationTransaction(HasTrace, InventoryUnit, Bundle?, WarehouseLocation)

Records a draft move event for a unit (and optional bundle) to a target location.

changeBundleLocation(HasTrace, Bundle, WarehouseLocation)

Moves a whole bundle to a target location.

processInventoryLocationTransaction(HasTrace, InventoryLocationTransaction)

Processes a draft move event: updates the unit’s current location and (when relevant) the bundle, marks the event processed.

ViewModel actions

ActionUser-visible effect

confirm (on Inventory Location Transaction)

Processes a drafted move: updates the unit’s location and rolls the bundle along.

confirmUndo (on Inventory Location Transaction)

Reverts a processed move back to draft.

confirm (on Inventory Unit Status Event)

Applies the status to the unit and recomputes its availability.

confirmUndo (on Inventory Unit Status Event)

Reverts the status change.