yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
MethodOverride Execute
{
  Description: 'Find relevent dataset then export to respective mode'
  TextBody:
  [*
    // Overriden, logic to export DEF or Excel
    opt := DatasetFindOptions::Construct( this.MacroPlanDatasetName() );
    mp := MDSMacroPlan::Find( opt );
    
    opt := DatasetFindOptions::Construct();
    dr := MDSLibDEF_DataRepository::Find( opt );
    
    opt := DatasetFindOptions::Construct();
    db := MDSLibDEF_DataBroker::Find( opt );
    
    isDEF := this.ExportType() = MPSyncUtility::ID_Source_DEF();
    
    if( isDEF )
    {
      this
      ->SetStatusInProgress()
      ->(streamExportPlannedOrder)
      {
        mp->ExportMPSPlanToDM( dr,
                               select( db, System.SetTypeMeta.SetMeta, sm, sm.Name() = this.DEFSetName() and sm.ChannelName() = LibDEC_ChannelMP_Plan::CHANNEL_NAME() ),
                               this.IsNewDEFSet(),
                               this.DEFSetName() ) 
      }
      ->|this->SetStatusDone()
      ->|mp->SetLastExportTime();
    }
    else
    {
      this
      ->SetStatusInProgress()
      ->|mp->ExportPlannedOrder( this ) 
      ->|this->SetStatusDone()
      ->|mp->SetLastExportTime();
    }
  *]
}