haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
30
31
32
33
34
35
36
37
38
39
Quintiq file version 2.0
#parent: #root
Method VerifyIncludeExcludeSetupExpectationStockingPoints (
  MacroPlan macroplan,
  Strings lines,
  Boolean expectedDefaultAllIncluded
) as owning StockingPoint_MPs
{
  TextBody:
  [*
    // Setup test - what entities expected include or exclude
    linesSP := selectset( lines, Elements, line, line.StartsWith( 'Excluded,SP,' ) or line.StartsWith( 'Included,SP,' ) );
    
    expectedIncludedStockingPoints := construct( StockingPoint_MPs );
    expectedExcludedStockingPoints := construct( StockingPoint_MPs );
    traverse( linesSP, Elements, line )
    {
      if( line.StartsWith( 'Included,SP,' ) )
      {
        stockingPointID := line.ReplaceAll( 'Included,SP,', '' ).TrimBoth();
        expectedIncludedStockingPoints.Add( select( macroplan, StockingPoint_MP, sp, sp.ID() = stockingPointID ) );
      }
      else
      {
        stockingPointID := line.ReplaceAll( 'Excluded,SP,', '' ).TrimBoth();
        expectedExcludedStockingPoints.Add( select( macroplan, StockingPoint_MP, sp, sp.ID() = stockingPointID ) );   
      }
    }
    
    expectedStockingPoints := selectset( macroplan, StockingPoint_MP, sp, expectedDefaultAllIncluded );
    
    expectedStockingPoints := ifexpr( expectedDefaultAllIncluded,
                                      expectedStockingPoints.Difference( expectedExcludedStockingPoints ),
                                      expectedStockingPoints.Add( expectedIncludedStockingPoints ) );
    
    return &expectedStockingPoints;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}