陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
StaticMethod GetNewCopiedRoutingStepName (
  Unit unit,
  Routing routing
) as String
{
  Description: 'Return copied routing step name if the routing step name already exists'
  TextBody:
  [*
    // Adhi Feb-12-2016 (created)
    // Adhi Feb-12-2016 (created)
    copiedname := unit.Name()
    retvalue := unit.Name();
    number := 1;
    
    while( exists( routing,
                   RoutingStep,
                   rs,
                   rs.Name() = retvalue ) ) // Check ID because ID conflict is more important than name, but we still want to keep the Name as the source
    {
      retvalue := copiedname + ' (' + [String] number +')';
      number++;
    }
    
    return retvalue;
  *]
}