yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Quintiq file version 2.0
#parent: #root
Function CalcMinQuantityFactor
{
  TextBody:
  [*
    // The factor is defined as the input min quantity in PISP uom divided by the output quantity in PISP uom.
    targetuom := this.PISPUnitOfMeasurement();
    uomconversion := this.Operation().GetUOMConversionFactor( targetuom );
    
    // Not using QuantityToProcess as the attribute is affected if we exclude some output from unit utilization
    outputbased := this.Operation().Unit().IsQuantityToProcessAsOut();
    outputqtyinspuom := uomconversion * ifexpr( outputbased, this.Operation().OutputQuantity(), this.Operation().InputQuantity() );
    
    value := guard( this.MinQuantity() / outputqtyinspuom, 0.0 );
    
    this.MinQuantityFactor( value );
  *]
}