陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
69
70
71
72
73
74
Quintiq file version 2.0
#parent: #root
Method UpdateCommitLogic
{
  Description: 'Commit logic for global parameters'
  TextBody:
  [*
    /* When the check HasDefaultInventoryHoldingCost is set to TRUE,
       Every existing product will createt a product account with inventory holding as cost driver
       to the account specified in attribute DefaultAccountForInventoryHolding
    
       Every product that is created after the check is set to TRUE will also perform such action.
    
       When the check is set to FALSE, the ProductAccount that does not override the global parameter
       values will have its attribute IsUsed set to FALSE declarative, hence deleting the said
       instance once the method MacroPlan.RunOptimizer() is executed, when running optimizer */
    
    
    if( this.HasDefaultInventoryHoldingCost() )
    {
      owner := Account_MP::FindAccountTypeIndex( this.DefaultAccountForInventoryHolding() )
      if( not isnull( owner ) )
      {
        products := selectset( this, MacroPlan.Product_MP, p, not p.IsSystem() );
        traverse( products, Elements.ProductInStockingPoint_MP, pisp,
                  not pisp.IsSystem()
                  and not exists( pisp, PISPAccount, pispa,
                                  pispa.Account_MP() = owner
                                  and pispa.IsInventoryHolding() ) )
        {
          PISPAccount::Assign( owner,
                               pisp.Product_MP(),
                               pisp.StockingPoint_MP(),
                               Translations::MP_AccountAssignmentCostDriverInventoryHolding() );
        }
      }
    }
    
    // To set to default leadtime logic if the new leadtime logic is empty
    if( this.LaneLeadTimeLogic() = '' )
    {
      defaultLaneLeadTimeLogic := GlobalParameters_MP::GetAllLaneLeadTimeLogic().Tokenize( ";" ).Element( 0 );
      this.LaneLeadTimeLogic( defaultLaneLeadTimeLogic );
    }
    
    // To set to default leadtime logic if the new leadtime logic is empty
    if( this.OperationLeadTimeLogic() = '' )
    {
      defaultOperationLeadTimeLogic := GlobalParameters_MP::GetAllOperationLeadTimeLogic().Tokenize( ";" ).Element( 0 );
      this.OperationLeadTimeLogic( defaultOperationLeadTimeLogic );  
    }
    
    // Reset plan in case of change of lead time strategy
    if( this.HasNewLeadTimeStrategy() )
    {
      this.MacroPlan().ResetPeriodTasksAndFlushTrips();
      this.HasNewLeadTimeStrategy( false );
    }
    
    // Refresh KPIs in case of change of KPI horizon
    if( this.HasNewKPIHorizon() )
    {
      this.MacroPlan().CalculateKPIScore( false );
      this.HasNewKPIHorizon( false );
    }
    
    
    // Update default capacities and availabilities
    this.UpdateDefaultUnitAvailabilities();
    this.UpdateDefaultTransportCapacities();
    this.UpdateDefaultUnitCapacities();
    this.UpdateDefaultStockingPointCapacities();
  *]
}