| Quintiq file version 2.0 | 
| #parent: #root | 
| Method VerifyQuantityInvSpecPISPIPInvLevelEnd ( | 
|   Product_MP product, | 
|   StockingPoint_MP stockingPoint, | 
|   DateTime start, | 
|   DateTime end, | 
|   Number numberOfPeriods | 
| ) | 
| { | 
|   Description: 'Verify PISPIP in range of periods inventory level end amount is adhered to respective inventory specification configuration.' | 
|   TextBody: | 
|   [* | 
|     // Verify Min Max inventory level calculation | 
|     /* | 
|     For the months when min inventory level is defined in quantity, the value is the same as what's defined in inventory specifications. | 
|     */ | 
|     pisp := product.FindProductInStockingPoint( stockingPoint.ID() ); | 
|     pispips := selectset( pisp, ProductInStockingPointInPeriodPlanning, p, p.Start() >= start and p.Start() < end ); | 
|     uom := pisp.UnitOfMeasureName(); | 
|      | 
|     // Verify number of periods is correct | 
|     this.Run().AssertEqual( numberOfPeriods, pispips.Size() ) | 
|     traverse( pispips, Elements, pispip ) | 
|     { | 
|        | 
|       minInv := pispip.InventorySpecification().MinLevelInQuantity(); | 
|       maxInv := pispip.InventorySpecification().MaxLevelInQuantity(); | 
|       expectedInvLevelEndIsWithin := minInv <= pispip.InventoryLevelEnd() and pispip.InventoryLevelEnd() <= maxInv | 
|        | 
|       this.Run().AssertTrue( expectedInvLevelEndIsWithin, | 
|                              'Verify ' + pisp.Name() + ' by ' + [String] pispip.Start()  | 
|                                        + ' has inventory level end of [' + [String]pispip.InventoryLevelEnd().Round( 2 ) + ' ' + uom | 
|                                        + ' ] within min [' + [String]minInv + ' ' + uom + '] and max [' + [String]maxInv + ' ' + uom + ' ]' ); | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |