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
40
41
42
Quintiq file version 2.0
#parent: #root
Method CreateTestData (
  MacroPlan macroplan
)
{
  Description: 'Create postponement spec and sale demand'
  TextBody:
  [*
    // Setup for sales demand
    strawberry := UI_Product::FindSingle( this.Run(), macroplan, true, 'Strawberry'); 
    priority := 'Normal';
    uom := 'MT'; 
    dewarehouseraw := UI_StockingPoint::FindSingle( this.Run(), macroplan, true, 'DE Warehouse Raw Material' );
    carrefourAustria := macroplan.FindSalesSegment( 'Carrefour Austria' );
    currency := macroplan.BaseCurrency();
    sop := macroplan.StartOfPlanning();
    sopyear := sop.Year();
    janSop := Date::Construct( sopyear, 1, 1 );
    marSop := Date::Construct( sopyear, 3, 1 );
    F1_ID := "F1_" + strawberry.Name();
    
    // Create a sales demand for Lowfat in DC-Austria for Carrefour Austria in Jan-sop year with quantity 1000 MT
    dto_forecast := DTO_Forecast::Construct().CurrencyID( currency.ID() )
                                             .StockingPointID( dewarehouseraw.ID() )
                                             .SalesSegmentName( carrefourAustria.Name() )
                                             .UnitOfMeasureName( uom )
                                             .Price( 1000.0 ).PriorityName( priority)
                                             .StartDate( janSop )
                                             .EndDate( janSop );
    UI_Forecast::MenuNew( this.Run(), macroplan, dto_forecast.ID( F1_ID ).ProductID( strawberry.ID() ).Quantity ( 1000.0 ).ToNVT() )
    
    // Create a postponement specifications for Carrefour Austria: Horizon = 6 Month, Max postponement = 3 months
    PostponementSpecification::Create( carrefourAustria, 'Month', 6, 'Month', 3, false );
    
    // only make it possible to get strawberry from March onwards, so in order to fulfill the above demand we must postpone
    // however, with smart plan one should only do this postponement if the Jan psipip is actually explicitly selected. We'll test for both situations
    dto_routing := DTO_Routing::Construct().ID( 'DE Purchase Strawberry' ).Start( marSop ); 
    UI_Routing::MenuEdit( this.Run(), macroplan, dto_routing.ID(), dto_routing.ToNVT() );
  *]
  InterfaceProperties { Accessibility: 'Module' }
}