xiaoding721
2023-11-13 e4edcfd0b987b239526f5375881b919789782dad
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Quintiq file version 2.0
#parent: #root
Method ExportDataToExcelOrDataManager (
  internal[GUIComponent] parent
) id:Method_DialogEDIExport_ExportDataToExcelOrDataManager
{
  #keys: '[108486.1.1111206054]'
  Body:
  [*
    // Export data to excel
    
    Dialog.ConfigureComponentsForExport();
    defaultImportProfile := shadow( MPSync.DefaultImportProfile() );
    Dialog.Data( defaultImportProfile );
    result := Dialog.DoModal( parent );
    
    // UserData is set by text box responses depending on whether there is a user-specified path.
    exportpath := ifexpr( EditorImportExportPath.UserData() = 0 , EditorImportExportPath.Text(), '' );
    binaryvalues := construct( BinaryValues);
    brokernames := construct( Strings );
    smbinaryvalues := construct( BinaryValues );
    smbrokernames := construct( Strings );
    userimportprofilevalues := construct( BinaryValues );
    userimportprofilebrokers := construct( Strings );
    
    isbinaryexport := true ;
    //Format to correct format
    Dialog.FormatPath( exportpath );
    
    if( result > 0 )
    {
      Dialog.Data().Commit();
      
      is3DDrive := RadioButtonGroupExcelOrDataManager.BoundValue() = MPSyncUtility::ID_Source_3DDrive();
      isDEF := RadioButtonGroupExcelOrDataManager.BoundValue() = MPSyncUtility::ID_Source_DEF();
    
      if( isDEF )
      {
        Dialog.ExportToDataManager();
      }
      else // Export to Excel or 3DDrive
      {
        //Preset calendarimportexport.ExportData
        if ( Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Capacities() ))
        {
          exportid := Key::NextPersistentKey();
          ApplicationLibMacroPlanner.LabelExportID().Text([String] exportid );
          MacroPlan.CalendarImportExport().Export( exportid, MacroPlan.CalendarRegistry().GetAllCalendars() );
        }
       MacroPlan.Export( Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_SupplyChainParameters() ),   // general
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_GlobalParameters() ),        // globalparameters
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Periods() ),                 // periods
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_InventorySpecifications() ), // inventoryspecifications
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_InventorySupplies() ),       // inventorysupplies
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Products() ),                // products
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Recipes() ),                 // recipes
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Forecast() ),             // salesdemands
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_ServiceLevels() ),           // servicelevels
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Campaigns() ),               // campaigns and transitions
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Entities() ),                // entities
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Costs() ),                   // entitiescosts
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Lanes() ),                   // lanes
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Routings() ),                // routings
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Capacities() ),              // stockingpointcapacities and unitcapacities
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_SupplySpecifications() ),    // supplyspecifications
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Actuals() ),                 // actuals pispip and actual unit periods
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Feedback() ),                // feedbacks
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_OptimizerPuzzle() ),           // optimier puzzles
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_PostponementSpecAndFulfillmentRestriction() ),           // Postponement and fulfillment restriction
                          Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_CustomerOrder() ),           // Customer order
                          isbinaryexport, //isbinaryexport
                          is3DDrive,
                          DataHolderDirectoryFileItem.Data(),
                          binaryvalues,
                          brokernames
                        );  
        
        ScenarioManager.Export( Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Strategies() ), 
                                Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Accounts() ), 
                                Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_Bookmarks() ), 
                                Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_KPISetting() ),  
                                isbinaryexport, is3DDrive, DataHolderDirectoryFileItem.Data(), 
                                smbinaryvalues, smbrokernames );
    
        MPSync.Export( Dialog.GetIsIncluded( MPSyncUtility::ID_ObjectGroup_ImportProfiles() ),
                                             is3DDrive, DataHolderDirectoryFileItem.Data(),
                                             userimportprofilevalues, userimportprofilebrokers );
                                             
        if( not is3DDrive ) // 3DDrive already exported on server side
        {         
          // Macroplan dataset                        
          this.WriteToDestinationFile( exportpath, binaryvalues, brokernames );
          // ScenarioManager dataset
          this.WriteToDestinationFile( exportpath, smbinaryvalues, smbrokernames );
          // MPSync dataset
          this.WriteToDestinationFile( exportpath, userimportprofilevalues, userimportprofilebrokers );
        }
      }
    
    }
  *]
}