dev.atedeg.mdm.milkplanning

Type members

Classlikes

Events managed by the bounded context.

Events managed by the bounded context.

Events sent by the bounded context.

Events sent by the bounded context.

final case class ProcessedMilk(quantity: QuintalsOfMilk)

Milk processed in order to produce cheese.

Milk processed in order to produce cheese.

final case class Quantity(n: PositiveNumber)

A quantity of something.

A quantity of something.

Example:

Quantity(-2) is not a valid quantity.

Quantity(20) is a valida quantity.

final case class QuintalsOfMilk(quintals: NonNegativeNumber)

A quantity of milk expressed in quintals.

A quantity of milk expressed in quintals.

final case class RequestedProduct(product: Product, quantity: Quantity, requiredBy: LocalDateTime)

A product requested in a given quantity that has to be produced by the given date.

A product requested in a given quantity that has to be produced by the given date.

final case class StockedQuantity(quantity: NonNegativeNumber)

A quantity of a stocked product, it may also be zero.

A quantity of a stocked product, it may also be zero.

Note:

it must be a non-negative number.

Example:

StockedQuantity(0) is valid.

StockedQuantity(-1) is invalid.

final case class Yield(n: PositiveDecimal)

A decimal that represents the yield of milk when producing a given cheese type: i.e. to produce n quintals of a given cheese type, yield of cheese type * n quintals of milk must be used.

A decimal that represents the yield of milk when producing a given cheese type: i.e. to produce n quintals of a given cheese type, yield of cheese type * n quintals of milk must be used.

Example:

Yield(0) is not a valid yield.

Yield(5.55) is a valid yield.

Types

type RecipeBook = CheeseType => Yield

It defines, for each product, the yield of the milk.

It defines, for each product, the yield of the milk.

type Stock = Product => StockedQuantity

It defines, for each product, the quantity in stock.

It defines, for each product, the quantity in stock.

Value members

Concrete methods

def estimateQuintalsOfMilk[M[_] : Monad](milkOfPreviousYear: QuintalsOfMilk, requestedProductsForWeek: NonEmptyList[RequestedProduct], currentStock: Stock, recipeBook: RecipeBook, stockedMilk: QuintalsOfMilk): M[QuintalsOfMilk]

Estimate the amount of milk needed for the following week's production. The estimate takes into account the milk processed in the same week last year, the products ordered for the following week, the current stock and the quintals of milk currently in stock and return the quintals of milk needed for the following week.

Estimate the amount of milk needed for the following week's production. The estimate takes into account the milk processed in the same week last year, the products ordered for the following week, the current stock and the quintals of milk currently in stock and return the quintals of milk needed for the following week.