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
29
30
31
32
33
34
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod GetDefaultOwner ( 
 |    MacroPlan macroplan, 
 |    Nodes nodes, 
 |    output Product_MP product_o 
 |  ) remote as Unit 
 |  { 
 |    Description: 'Get default owner for new created supply specification in the Designer' 
 |    TextBody: 
 |    [* 
 |      // soh yee Apr-14-2014 (created) 
 |       
 |      // Get the unit selections of units from supply chain structure list. 
 |      unit := select( nodes, Elements.astype( UnitNode ).Unit, u, true ); 
 |      product_o := null( Product_MP ); 
 |       
 |      if( isnull( unit ) ) 
 |      { 
 |        unit := select( macroplan, Unit, u, true ); 
 |      } 
 |       
 |      if( not isnull( unit ) ) 
 |      { 
 |        product_o := select( unit, AllChildren.AsChildren.Process_MP.ProcessOutput.ProductInStockingPoint_MP.Product_MP.AllParent.AsParent, p, 
 |                             not p.IsLeaf() 
 |                             and not p.IsSystem() ); 
 |       
 |       
 |      } 
 |       
 |      return unit; 
 |    *] 
 |  } 
 |  
  |