dev.atedeg.mdm.stocking

Type members

Classlikes

final case class AvailableQuantity(n: NonNegativeNumber)

The available quantity of a certain product.

The available quantity of a certain product.

final case class AvailableStock(availableStock: Map[Product, AvailableQuantity])

The currently available products in stock; each one is available in a certain quantity (that could also be zero if the product is out-of-stock).

The currently available products in stock; each one is available in a certain quantity (that could also be zero if the product is out-of-stock).

enum Batch

A batch of products of a certain type, uniquely identified by an ID, which hasn't been quality assured.

A batch of products of a certain type, uniquely identified by an ID, which hasn't been quality assured.

final case class BatchID(id: UUID)

Uniquely identifies a batch.

Uniquely identifies a batch.

final case class DesiredQuantity(n: PositiveNumber)

The desired quantity of a certain product.

The desired quantity of a certain product.

final case class DesiredStock(desiredStock: Map[Product, DesiredQuantity])

The desired quantity of each product that should always be in stock in order to have a safe margin to keep order fulfillment going.

The desired quantity of each product that should always be in stock in order to have a safe margin to keep order fulfillment going.

enum Error

The errors that have to be handled by the bounded context.

The errors that have to be handled by the bounded context.

The events that have to be handled by the bounded context.

The events that have to be handled by the bounded context.

final case class LabelledProduct(product: Product, quantity: AvailableQuantity, batchID: BatchID)

A product with its respective quantity and the ID of the batch it belongs to.

A product with its respective quantity and the ID of the batch it belongs to.

object Main extends IOApp
final case class MissingQuantity(n: NonNegativeNumber)

The required quantity of a certain product to reach the desired stock level.

The required quantity of a certain product to reach the desired stock level.

The events that may be produced by the bounded context.

The events that may be produced by the bounded context.

A batch of products of a certain type uniquely identified by an ID, which has undergone quality assurance.

A batch of products of a certain type uniquely identified by an ID, which has undergone quality assurance.

final case class Quantity(n: PositiveNumber)

A quantity of something.

A quantity of something.

Value members

Concrete methods

Approves a batch after quality assurance.

Approves a batch after quality assurance.

def getMissingCountFromProductStock(availableStock: AvailableStock, desiredStock: DesiredStock)(product: Product): MissingQuantity

Gets how many products are missing from the stock, given the desired stock.

Gets how many products are missing from the stock, given the desired stock.

def labelProduct[M[_] : CanEmit[ProductStocked]](batch: Passed, actualWeight: Grams): M[LabelledProduct]

Labels a product given the batch it comes from and its actual weight as given by the scale.

Labels a product given the batch it comes from and its actual weight as given by the scale.

Rejects a batch after quality assurance.

Rejects a batch after quality assurance.

def removeFromStock[M[_] : CanRaise[NotEnoughStock]](stock: AvailableStock)(product: Product, quantity: Quantity): M[AvailableStock]

Removes the given quantity of a certain product from the stock, giving the new current stock.

Removes the given quantity of a certain product from the stock, giving the new current stock.