hongji.li
2023-11-03 aefafd2142478d4fb07d6b8b45c3047e247389e0
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
Quintiq file version 2.0
#parent: #root
Method ExportMPSPlanToDM (
  LibDEF_DataRepository defrepo,
  LibDEF_SetMeta mpsPlanSetMeta_i,
  Boolean mpsPlanAsNew_i,
  String mpsPlanSetName_i
)
{
  Description: 'Export mpsplan to Data Manager via MPSPlan channel'
  TextBody:
  [*
    // Make sure settype is created
    setType := defrepo.FindSetType( LibDEC_ChannelMP_Plan::CHANNEL_NAME(), LibDEC_ChannelMP_Plan::SETTYPE_NAME_MP_Plan() );
    
    if( isnull( setType ) )
    {
      setType := LibDEF_SetType::Create( defrepo, LibDEC_ChannelMP_Plan::CHANNEL_NAME(), LibDEC_ChannelMP_Plan::SETTYPE_NAME_MP_Plan() );
    }
    
    set := selectobject( defrepo, Channel.SetType.Set, s,
                         guard( s.GUID() = mpsPlanSetMeta_i.GUID(), false ) )
    
    if( mpsPlanAsNew_i )
    {
      this.DataTransformationDefinition().CreateSet( setType, mpsPlanSetName_i );
    }
    else
    {
      this.DataTransformationDefinition().UpdateSet( set );
    }
  *]
}