Quintiq file version 2.0
|
#parent: #root
|
FunctionOverride CalcExpiredInPeriodShelfLifeSupplyQuantity
|
{
|
TextBody:
|
[*
|
value := 0.0;
|
|
product := this.ProductInStockingPoint_MP().Product_MP();
|
shelflife := this.ShelfLife();
|
|
// Check if product has shelf-life
|
if( product.HasShelfLife() and not isnull( shelflife) )
|
{
|
// Get the age and quantity vector of remaining product stock after consumption
|
agevector := RealVector::Construct( shelflife.ShelfLifeSupplyAgeVectorAsBinaryValue() );
|
quantityvector := RealVector::Construct( shelflife.ShelfLifeSupplyQuantityVectorAsBinaryValue() );
|
|
isexpiredinperiodvector := BooleanVector::Construct();
|
traverse( agevector.AsValues(), Elements, age )
|
{
|
isexpiredinperiod := not product.GetIsUsableInTargetPeriod( [Real] age, this.Start(), this.Period_MP() );
|
isexpiredinperiodvector.Append( isexpiredinperiod );
|
}
|
|
// Sum of all elements in the quantity vector that corresponds to element = true in the boolean vector
|
value := quantityvector.GetSelection( isexpiredinperiodvector ).Sum();
|
}
|
|
this.ExpiredInPeriodShelfLifeSupplyQuantity( value );
|
*]
|
}
|