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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod FindCreateUpdate ( 
 |    MacroPlan owner, 
 |    String spid, 
 |    Unit sourceunit, 
 |    Routing routing, 
 |    Boolean isfromdb 
 |  ) as StockingPoint_MP 
 |  { 
 |    Description: 'Create or update StockingPoint_MP' 
 |    TextBody: 
 |    [* 
 |      stockingpoint := owner.FindStockingPoint( spid ); 
 |      parentunit := guard( owner.FindUnit( sourceunit.ParentUnitID() ), null( Unit ) ); 
 |      uom := guard( owner.FindUnitOfMeasure( sourceunit.UnitOfMeasureName() ), null( UnitOfMeasure_MP ) ); 
 |      currency := guard( owner.FindCurrency( sourceunit.CurrencyID() ), null( Currency_MP ) ); 
 |       
 |      if( isnull( stockingpoint ) ) 
 |      { 
 |        stockingpoint := StockingPoint_MP::Create( spid, 
 |                                                   owner, 
 |                                                   parentunit, 
 |                                                   spid, 
 |                                                   '', //iconname 
 |                                                   uom, 
 |                                                   currency, 
 |                                                   routing.AllowWIPInventory(), 
 |                                                   sourceunit.StartDate(), 
 |                                                   sourceunit.EndDate(), 
 |                                                   null( Group ), 
 |                                                   '', //giscountrycode 
 |                                                   '', //giscity 
 |                                                   '', //gispostalcode, 
 |                                                   '', 
 |                                                   isfromdb );  
 |      } 
 |      else 
 |      { 
 |        stockingpoint.Update( parentunit, 
 |                              spid, 
 |                              spid, 
 |                              uom, 
 |                              currency, 
 |                              stockingpoint.IconName(), 
 |                              routing.AllowWIPInventory(), 
 |                              sourceunit.StartDate(), 
 |                              sourceunit.EndDate(), 
 |                              stockingpoint.Group(), 
 |                              stockingpoint.GISCountryCode(), 
 |                              stockingpoint.GISCity(), 
 |                              stockingpoint.GISPostalCode(), 
 |                              stockingpoint.Notes(), 
 |                              isfromdb ); 
 |      } 
 |      return stockingpoint 
 |    *] 
 |  } 
 |  
  |