Quintiq file version 2.0
|
#parent: #root
|
Method GetSuggestedQuantity (
|
ProductInStockingPointInPeriod pispip
|
) as Real
|
{
|
Description: 'Get sugested quantity for product in trip'
|
TextBody:
|
[*
|
// desmondt May-18-2015 (created)
|
|
upt := this.DepartureUnitPeriod()
|
|
// First, get what is the demanded quantity
|
suggestedqty := pispip.GetUnfulfilledQuantity();
|
|
if( isnull( upt ) )
|
{
|
// Use UnitPeriodTransport instead of "this" because we need suggested quantity in one tracsaction quite often.
|
upt := maxselect( this,
|
LaneLeg.Lane.Unit.UnitPeriod.astype( UnitPeriodTransportBase ),
|
unitperiod,
|
unitperiod.Start() <= this.Arrival() - this.LaneLeg().LeadTime(),
|
unitperiod.Period_MP().SequenceNr() );
|
}
|
|
//upt can be null when trip departs before the start of planning horizon
|
if( not isnull( upt ) and suggestedqty > 0 )
|
{
|
if( upt.MinimumPerLot() > 0 ) // If have minimum per lot
|
{
|
/*
|
The lot devision remainder, eg, lot size 10, demand quantity 512
|
The remainder is 2, which means we have 51 lot with 10 ton/lot.
|
The remainder quantity(ton) will be use to check with minimum per lot
|
*/
|
|
remainedqty := GlobalParameters_MP::GetRemainder( suggestedqty, upt.LotSize() ); // eg. 51.123, number = 51, real = 51.123, real - number = 0.123 (remainder)
|
|
// Then check if lot remainder is greater than min per lot, if < min per lot, increase it to fulfill conform minimum per lot.
|
if( remainedqty < upt.MinimumPerLot() )
|
{
|
suggestedqty := suggestedqty - remainedqty + upt.MinimumPerLot();
|
}
|
}
|
}
|
|
return suggestedqty;
|
*]
|
}
|