Quintiq file version 2.0
|
#parent: #root
|
FunctionOverride CalcImmatureShelfLifeSupplyQuantity
|
{
|
TextBody:
|
[*
|
// Calculate the quantity of immature product stocks
|
value := 0.0;
|
|
product := this.ProductInStockingPoint_MP().Product_MP();
|
// Calculate only if the product has maturation period
|
if( product.HasMaturation() and not isnull( this.ShelfLife() ) )
|
{
|
// Retrieve the shelf-life and maturation vectors
|
shelflife := this.ShelfLife();
|
agevector := RealVector::Construct( shelflife.ShelfLifeSupplyAgeVectorAsBinaryValue() );
|
quantityvector := RealVector::Construct( shelflife.ShelfLifeSupplyQuantityVectorAsBinaryValue() );
|
|
/*maturationdays := product.MaturationDays();
|
// Get the boolean vector of matured product stocks:
|
// - Product is consider matured if its age is > maturation days
|
// - Example of maturation days = 5.2, product stock age vector = 1, 3.3, 4.9, 5.1, 6, 9.1:
|
// - Boolean vector of matured product will be: false, false, false, false, true, true
|
ismaturedvector := agevector.GreaterThan( maturationdays );
|
// Apply NOT to the boolean vector
|
// Example boolean vector of matured product = false, false, false, false, true, true
|
// After applying NOT = true, true, true, true, false, false
|
isimmaturevector := ismaturedvector.NOT();
|
*/
|
|
isimmaturevector := BooleanVector::Construct();
|
traverse( agevector.AsValues(), Elements, age )
|
{
|
isimmature := not product.GetIsMaturedInTargetPeriod( [Real] age, this.Start(), this.Period_MP() );
|
isimmaturevector.Append( isimmature );
|
}
|
|
// Get the sum of immature product stocks
|
value := quantityvector.GetSelection( isimmaturevector ).Sum();
|
}
|
|
this.ImmatureShelfLifeSupplyQuantity( value );
|
*]
|
}
|