Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod Dispatch ( 
 | 
  const MacroPlan macroPlan, 
 | 
  RecycleBin owner, 
 | 
  String versionFlag 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Akari Aug-21-2024 (created) 
 | 
    owner.DispatchShiftPlan( relflush ); 
 | 
    // owner.RB_DispatchShiftPlanBroker().Source().FlatQuery( "truncate table A_DispatchShiftPlan" ); 
 | 
     
 | 
    now := DateTime::Now(); 
 | 
    macroPlanName := macroPlan.MDSMacroPlan().Description(); 
 | 
    traverse( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan,shiftPlan ){ 
 | 
       factory := shiftPlan.UnitPeriodTime().Unit(); 
 | 
       while( factory.HasParent() ){ 
 | 
         temp1 := factory; 
 | 
         factory := factory.Parent(); 
 | 
         if( not factory.HasParent() ){ 
 | 
           factory := temp1; 
 | 
         } 
 | 
       } 
 | 
       
 | 
       owner.DispatchShiftPlan( relnew,ID := OS::GenerateGUIDAsString(), 
 | 
                                ProductLine := shiftPlan.UnitPeriodTime().Unit().ID(), 
 | 
                                ShiftDate := shiftPlan.UnitPeriodTime().Period_MP().StartDate(), 
 | 
                                Tips := shiftPlan.Remark(), 
 | 
                                VersionName := macroPlanName, 
 | 
                                VersionFlag := versionFlag, 
 | 
                                FactoryName := factory.ID(), 
 | 
                                InterfaceTime := now 
 | 
                                ); 
 | 
                                 
 | 
    } 
 | 
     
 | 
    owner.RB_DispatchShiftPlanBroker().AsyncExecute(); 
 | 
  *] 
 | 
} 
 |