admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Quintiq file version 2.0
#parent: #root
MethodOverride OnCreatedUTFDataset
{
  Description: 'On UTF dataset created, remove all forecasts & customer orders then create those needed by UI automation (for easy verification).'
  TextBody:
  [*
    opt := DatasetFindOptions::Construct( this.GetUTFDatasetname() );
    mp := MDSMacroPlan::Find( opt );
    mp->( macroplan )
    {
        sopyear := macroplan.StartOfPlanning().Year();
        currency := "EUR";
        price := 2280.0;
        priority := "Normal";
        segmentCanManChina := "CanMan China"; // NOTE: Use different segment/product/sp for Forecast and CO (for easy verification in UI)
        segmentAllOrganics := "All Organics";
        segmentAudiA8 := "Audi A8";
        uom := "Ton";
        product_bc_cb_wide := macroplan.FindProduct( "BC CB wide" );
        product_bc_ct_clearcoated := macroplan.FindProduct( "BC CT clear coated" );
        product_cpn_coil := macroplan.FindProduct( "CPN coil" );
        sp_northamerica := macroplan.FindStockingPoint( "North America" );
        sp_asia := macroplan.FindStockingPoint( "Asia" );
        sp_europe := macroplan.FindStockingPoint( "Europe" );
        
        isfromdb := false;
        isfornetting := true;
        isfirmed := true;
        isexcludefromfulfillmentKPI := false;
        janstart := Date::Construct( sopyear, 1, 1 );
        febstart := janstart.StartOfNextMonth();
        
        /*
          Data setup for UI automation
          ADSO-50251 - customer order needs 1 with invalid stocking point (to have constraint/sanity check)
          ADSO-50252 - visualize only customer order in customer order view (re-use that 1 invalid customer order from ADSO-50251 + forecast & customer order have non-overlapping values for SP/product/sales segment)
          ADSO-50247 - adjust 2 customers (multiply quantity)
          ADSO-50239 - Visualize/navigate customer orders
          ADSO-50253 - Postpone customer order in period (uses the Europe stocking point customer orders as the quantity are not touched by other test cases)
        */
        // Clear all customer orders and just create those that UI automation needs
        toDeleteCOs := selectset( macroplan, SalesDemand.astype( CustomerOrder ), co, true );
        CustomerOrder::Delete( toDeleteCOs );
        
        co := CustomerOrder::Create( product_bc_cb_wide, null( StockingPoint_MP ), "CO1_invalidSP", janstart, 100.0, price, priority, segmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
        co.StockingPointID( 'Invalid_SP_ID' ); // Set invalid SP ID so that sanity check gets flagged on CustomerOrder for invalid PISP
        
        CustomerOrder::Create( product_bc_cb_wide, sp_asia, "CO2", janstart, 300.0, 10.0, priority, segmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
        CustomerOrder::Create( product_bc_cb_wide, sp_asia, "CO3", janstart, 400.0, 10.0, priority, segmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
        CustomerOrder::Create( product_bc_ct_clearcoated, sp_asia, "CO4", janstart, 100.0, 10.0, priority, segmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
        CustomerOrder::Create( product_bc_cb_wide, sp_europe, "CO5", janstart, 100.0, 10.0, priority, segmentAudiA8, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, false, isfromdb );
        CustomerOrder::Create( product_bc_cb_wide, sp_europe, "CO6", febstart, 100.0, 10.0, priority, segmentAudiA8, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
        CustomerOrder::Create( product_bc_cb_wide, sp_europe, "CO7_batchedit", janstart, 999.0, 10.0, priority, segmentAudiA8, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
        CustomerOrder::Create( product_bc_cb_wide, sp_europe, "CO8_batchedit", febstart, 999.0, 10.0, priority, segmentAudiA8, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
    
        // Clear all forecast and just create those that UI automation needs
        toDeleteForecasts := selectset( macroplan, SalesDemand.astype( Forecast ), f, true );
        Forecast::Delete( toDeleteForecasts );
        
        Forecast::Create( product_cpn_coil, sp_northamerica, "FC1", janstart, febstart, 10000.0, 8888.0, priority, segmentAllOrganics, currency, uom, 0.0, isexcludefromfulfillmentKPI, isfromdb );
        
        // ADSO-50253 - Create postponement spec for customer order
        months := Translations::MP_GlobalParameters_Month(); 
        PostponementSpecification::Create( macroplan.FindSalesSegment( segmentAudiA8 ), months, 6, months, 3, false );
    }
  *]
}