Quintiq file version 2.0
#parent: #root
Method GetMacroPlanByMDSID (
  OfflinePlanTableInfo offlinePlanInfo
) as MacroPlan id:Method_ApplicationMacroPlanner_GetMacroPlanByMDSID
{
  #keys: '[414996.1.122222878]'
  Body:
  [*
    componentmds := ApplicationScope.ComponentMDS();
    
    demandMacroPlan := null( MacroPlan );
    
    if( exists( ScenarioManager,ScenarioMP,scemp,scemp.IsLoaded() and scemp.DatasetMDSID() = offlinePlanInfo.MacroPlanMDSID() )){
      mdsinstance     := select( componentmds, ComponentMDSKinds.ComponentMDSInstances, m, m.MDSID().MDSKey() = offlinePlanInfo.MacroPlanMDSID() );
      handle          := mdsinstance.GetMDSHandle();
      demandMacroPlan := handle.AsMacroPlan();
    }else{
      error( "MacroPlan[ " + offlinePlanInfo.MacroPlanName() + "] is not load." );
    }
    
    return demandMacroPlan;
  *]
}
