Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
Quintiq file version 2.0
#parent: #root
Method CreateRoutingStepAndAddUnits (
  Units units
) as owning Operations
{
  Description:
  [*
    Create a routing step when a unit is dragged into the canvas, and add the unit as operation. Used in designer.
    Routing step name will be derived from unit.
  *]
  TextBody:
  [*
    // Adhi Feb-4-2016 (created)
    // If multiple units are added, the name will be derived from the first unit
    name := RoutingStep::GetNewCopiedRoutingStepName( units.Element( 0 ),
                                                      this );
    
    // New routing step
    rs := RoutingStep::Create( this, name, '', false );
    
    // Add a unit to routing step to create an operation
    operations := rs.AddOperations( units );
    
    return &operations;
  *]
}