Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method VerifyPlanResult ( 
 | 
  ProductInStockingPointInPeriodPlanning pispip 
 | 
) 
 | 
{ 
 | 
  Description: 'Verify plan result' 
 | 
  TextBody: 
 | 
  [* 
 | 
    this.Run().AssertEqual( 60000.0, pispip.TotalSupplyUser(), "Verify total new supply is equal to total demand of pispip"); 
 | 
    this.Run().AssertEqual( pispip.InventoryLevelEnd().Round( 0 ), ( pispip.TotalSupplyUser() - pispip.GetDemandQuantity() ).Round( 0 ), "Verify the extra supply is not pushed to downstream processing.") 
 | 
     
 | 
    // Locked color in product planning matrix is determined with the following condition 
 | 
    this.Run().AssertTrue( pispip.HasUserSupplyLocked(), "Verify user plan is locked." ); 
 | 
     
 | 
    macroplan := pispip.ProductInStockingPoint_MP().MacroPlan(); 
 | 
    sanitycheckgroupbalance := select( macroplan, SanityCheckGroup.astype( SanityCheckGroupBalance ), sgbalance, true ); 
 | 
    this.Run().AssertTrue( sanitycheckgroupbalance.NumberOfViolation() = 0, "Verify no balance violation occurred in the whole supply chain." ); 
 | 
     
 | 
    sm := this.GetScenarioManagerStream(); 
 | 
    sm->( scenariomanager ) 
 | 
    { 
 | 
      // There could be more than 1 base scenario from different sales demo 
 | 
      base := select( scenariomanager, ScenarioMP, scenario, scenario.Name() = this.GetDemoScenario() and scenario.Parent().Name()= this.GetDemoFolder() ) 
 | 
      opt := DatasetFindOptions::Construct( base.DatasetName() ); 
 | 
      mp := MDSMacroPlan::Find( opt ); 
 | 
      mp->( basedataset ) 
 | 
      { 
 | 
        // Verify that test dataset has higher cost 
 | 
        this.Run().AssertEqual( basedataset.GetKPIFulfillment(), macroplan.GetKPIFulfillment(), "Fulfillment same for both test and original dataset."); 
 | 
        this.Run().AssertEqual( basedataset.GetKPIFulfillmentTarget(), macroplan.GetKPIFulfillmentTarget(), 'Fulfillment target same for both test and orignal dataset.'); 
 | 
        this.Run().AssertGreater( this.GetAccountKPI( basedataset, 'Inventory holding cost'), this.GetAccountKPI( macroplan, 'Inventory holding cost'), 'Higher inventory holding cost on test dataset.'); 
 | 
        this.Run().AssertGreater( this.GetAccountKPI( basedataset, 'Cost of sales' ), this.GetAccountKPI( macroplan, 'Cost of sales'), 'Higher cost of sales on test dataset.'); 
 | 
      }                           
 | 
                                           
 | 
     } 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |