Demand

open inner class Demand : ModelElement.QObject(source)

A demand for a quantity of an ItemType. Flows through the supply chain via a state machine; see DemandState. Listeners can be attached to react to state transitions.

Created only via SupplyChainModel.createDemand.

See sc.inventorylayer.Demand

Properties

Link copied to clipboard

Whether this demand can be backlogged when not immediately filled.

Link copied to clipboard

Whether the demand can be cancelled after receipt.

Link copied to clipboard

Whether partial filling is permitted.

Link copied to clipboard

Quantity supplied so far against this demand.

Link copied to clipboard
Link copied to clipboard

The sender of this demand. Named demandSender (not sender) to avoid hiding QObject.sender, which is the station-layer ksl.modeling.station.QObjectSenderIfc.

Link copied to clipboard
Link copied to clipboard

The filler that this demand was committed to.

Link copied to clipboard
Link copied to clipboard

The original demand this one was forwarded from, if any. Set by ksl.modeling.supplychain.flow.DemandForwarder and routing nodes (cross-docks) that forward a request upstream: the forwarder sends a forwarded request upstream while parking the original in IN_PROCESS; when the forwarded request returns delivered, the receiving endpoint reads this property to recover the typed original and fill it.

Link copied to clipboard

True once the entire originalAmountDemanded has been supplied.

Link copied to clipboard

True iff this demand is part of an order.

Link copied to clipboard

The item type for this demand.

Link copied to clipboard
Link copied to clipboard

The order this demand is attached to, or null.

Link copied to clipboard

The line index within order.

Link copied to clipboard

The original quantity requested when the demand was created.

Link copied to clipboard

Most recent prior state, or null on creation.

Link copied to clipboard

The filler that actually received the demand.

Link copied to clipboard

Quantity not yet filled. Reaches 0 when the demand is filled.

Link copied to clipboard

Outcome status. See DemandStatusCode.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Rolling total demand seen by the filler when this demand arrived.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Register a listener that fires exactly once — on the first transition to targetState — and then removes itself. The action runs inside a try/finally so the listener is unregistered even if action throws.

Link copied to clipboard

Register a listener.

Link copied to clipboard
fun backlog()
Link copied to clipboard
fun cancel()
Link copied to clipboard
fun deliver()
Link copied to clipboard
fun fill(amountSupplied: Int)
Link copied to clipboard

Fulfill this demand in full and dispatch it onward via carrier, or transition directly through shipdeliver if carrier is null.

Link copied to clipboard
Link copied to clipboard
fun negotiate()
Link copied to clipboard

Attach observer to this demand. Returns the underlying DemandStateChangeListener so callers can remove the subscription later via SupplyChainModel.Demand.removeStateChangeListener.

Link copied to clipboard
fun prepare()
Link copied to clipboard
Link copied to clipboard
fun receive(receiver: DemandFillerIfc)
Link copied to clipboard

Accept this demand and start processing it: transitions it through RECEIVED → IN_PROCESS at receiver. Equivalent to the two-call sequence receive(receiver); process(receiver) but named for the intent ("the receiver has taken the demand and is now responsible for finishing it").

Link copied to clipboard
fun reject()
Link copied to clipboard

Unregister a listener.

Link copied to clipboard
fun sent()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ship()
Link copied to clipboard
fun store()
Link copied to clipboard
open override fun toString(): String