陈清红
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
Quintiq file version 2.0
#parent: #root
Method PopulateScenarioComparisonAccountsData (
  structured[MacroPlan] macroplans,
  structured[Period_MP] activePeriods,
  structured[Unit] units,
  structured[StockingPoint_MP] sps,
  structured[Product_MP] products
) id:Method_ApplicationMacroPlanner_PopulateScenarioComparisonAccountsData
{
  #keys: '[138546.0.68205360]'
  Body:
  [*
    // Populate accounts data for scenario comparison
    account := DataHolderScenarioComparisonAccount.Data();
    if( not isnull( account ) )
    {
      // Assign data to DataHolderGlobalParameter
      gp := MacroPlan.GlobalParameters_MP();
      
      owner := shadow( gp );
      accountName := account.Name();
      
      accounts := selectset( macroplans, 
                             Elements.Account_MP, 
                             acc, 
                             acc.Name() = accountName );
                           
      unitIDs := selectvalues( units, Elements, e, true, e.ID() );
      spIDs := selectvalues( sps, Elements, e, true, e.ID() );
      productIDs := selectvalues( products, Elements, e, true, e.ID() );
      
      uas := selectset( accounts, 
                        Elements.UnitAccount, 
                        ua, 
                        ua.Unit().IsInUnitWeb( unitIDs ) );
                      
      spas := selectset( accounts, 
                             Elements.StockingPointAccount, 
                             spa, 
                             spa.StockingPoint_MP().IsInStockingPointWeb( spIDs ) );
                      
      pispas := selectset( accounts, Elements.PISPAccount, 
                               pispa,
                               pispa.ProductInStockingPoint_MP().StockingPoint_MP().IsInStockingPointWeb( spIDs )
                               and pispa.ProductInStockingPoint_MP().Product_MP().IsInProductWeb( productIDs ) );
                               
      ApplicationMacroPlanner.CreateShadowAcountAssignmentInPeriodForUnitAccount( owner, uas, activePeriods );
      ApplicationMacroPlanner.CreateShadowAcountAssignmentInPeriodForStockingPointAccount ( owner, spas, activePeriods );  
      ApplicationMacroPlanner.CreateShadowAcountAssignmentInPeriodForPISPAccount( owner, pispas, activePeriods );
      
      // Software latest behavior, only set once to dataholder after all manipulation is done
      // After storing to dataholder, subsequent manipulation will not take effect
      DataHolderScenarioComparisonGlobalParameters.Data( &owner );
    }
  *]
}