yypsybs
2023-09-18 adbdf611b2caed7ff62031e0c606b6c1724af1f1
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 );
  *]
}