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
Quintiq file version 2.0
#parent: #root
MethodOverride Execute
{
  Description: 'Find relevent dataset then export to demand planner'
  TextBody:
  [*
    // OVERRIDE to set export in progress
    opt := DatasetFindOptions::Construct( this.MacroPlanDatasetName() );
    mp := MDSMacroPlan::Find( opt );
    
    opt := DatasetFindOptions::Construct();
    dfrepo := MDSLibDEF_DataRepository::Find( opt );
    
    opt := DatasetFindOptions::Construct();
    db := MDSLibDEF_DataBroker::Find( opt );
    
    this
    ->SetStatusInProgress()
    ->( streamExportSalesDemand )
    {
      mp->ExportToDM( dfrepo,
                      true, // true to export sales demand
                      select( db, System.SetTypeMeta.SetMeta, sm, sm.Name() = this.SetMetaName() and sm.ChannelName() = LibDEC_ChannelManufacturingDemand::CHANNEL_NAME() ),
                      this.IsNewSet(),
                      this.NewSetName(),
                      false, // false to export MPSPlan
                      null( LibDEF_SetMeta ), // pass in null MPSPlan
                      false, // false to create new MPSPlan
                      '' ) // empty name for new mpsplan name
    }
    ->|this->SetStatusDone()
    ->|mp->SetLastExportTime();
  *]
}