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(); 
 | 
    } 
 | 
  *] 
 | 
} 
 |