yanweiyuan3
2023-10-10 d901b1ab0ee0b690f5ac211b9cdb1db3a58bca86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Quintiq file version 2.0
#parent: #root
StaticMethod VerifySalesDemandInPeriodIsPostponed (
  LibUTF_IterationRun run,
  MacroPlan macroplan,
  NamedValueTree nvt_originalsdip,
  NamedValueTree nvt_postponesdip
)
{
  Description: 'Verify that salesdemand in period is postponed'
  TextBody:
  [*
    dto_oriignalsdip := DTO_SalesDemandInPeriod::ConstructNew( run, nvt_originalsdip ) 
    originalsdip := UI_SalesDemandInPeriod::FindSingle( run, macroplan, true, 
                                                        dto_oriignalsdip.SalesDemandID(), 
                                                        dto_oriignalsdip.StartDate(), dto_oriignalsdip.EndDate() );
    dto_postponed := DTO_SalesDemandInPeriod::ConstructNew( run, nvt_postponesdip );
    //check exist of postponed sales demand 
    postponedsdip := select( originalsdip, PostponedSalesDemand, postponedsdip, 
                             postponedsdip.StartDate() = dto_postponed.StartDate() 
                            and postponedsdip.EndDate() = dto_postponed.EndDate() );
    
    if( run.AssertNotIsNull( postponedsdip, "SalesDemandInPeriod should be postponed from " + dto_oriignalsdip.StartDate().Format( "D-M-Y") + " to " + dto_postponed.StartDate().Format( "D-M-Y" ) + ".") )
    {
      run.AssertEqual( dto_postponed.Quantity().Round( 2 ), postponedsdip.Quantity().Round( 2 ), "Incorrect postponed quantity." );  
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}