| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod CreateFromUnits ( | 
|   Units units | 
| ) as owning Routings | 
| { | 
|   Description: 'Return multiple routings which are createdfrom multiple units' | 
|   TextBody: | 
|   [* | 
|     // Adhi Feb-16-2016 (created) | 
|     routings := construct( Routings ); | 
|      | 
|     traverse( units, Elements, u ) | 
|     { | 
|       us := construct( Units ); | 
|       us.Add( u ); | 
|       macroplan := u.MacroPlan(); | 
|      | 
|       // Get name, append running numbers in brackets if it exists, only for routing | 
|       name := macroplan.GetUniqueRoutingName( u.Name() ); | 
|       routing := Routing::Create( macroplan, | 
|                                   name, | 
|                                   name, | 
|                                   Date::MinDate(), | 
|                                   Date::MaxDate(), | 
|                                   true, // default allow wip intenvtory | 
|                                   false | 
|                                   ); | 
|      | 
|       /* | 
|         Since the routing is new, it is safe to create routing step with its name follows that of unit. | 
|         Create operation in the routing step | 
|       */ | 
|       routing.CreateRoutingStepAndAddUnits( us ); | 
|       routings.Add( routing ); | 
|     } | 
|      | 
|     return &routings; | 
|   *] | 
| } |