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
Quintiq file version 2.0
#parent: #root
StaticMethod Create (
  Iteration owner
) as Simulation_MP
{
  Description: 'Static method to create an algorithm iteration'
  TextBody:
  [*
    // Martijn Aug-23-2016 (created)
    result := owner.Simulation( relnew );
    
    // We need to propagate these KPIs before saving them
    Transaction::Transaction().Propagate( attribute( Period_MP, SalesDemandQuantityWithExclusion ) );
    Transaction::Transaction().Propagate( attribute( Period_MP, SalesDemandFulfillmentWithExclusion ) );
    Transaction::Transaction().Propagate( attribute( AccountAssignment, BaseCostWithinKPIHorizon ) );
    
    // Copy the KPI values from MacroPlan
    macroplan := result.Iteration().DEPRECATED_InventoryOptimization().MacroPlan();
    result.KPIFulfillment( macroplan.GetKPIFulfillmentInPercentage() );
    result.KPIInventoryHoldingCosts( macroplan.GetKPIInventoryHoldingCost() );
    
    // Set the simulation number
    result.Start( DateTime::ActualTime() );
    
    return result;
  *]
}