陈清红
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
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
59
60
61
62
63
64
65
66
67
68
69
Quintiq file version 2.0
#parent: #root
Method UpdateForeignKey (
  String unitid,
  String routingid,
  String routingstepname
)
{
  Description: 'Update foreign IDs'
  TextBody:
  [*
    // desmondt Mar-16-2015 (created)
    this.UnitID( unitid );
    this.RoutingID( routingid );
    this.RoutingStepName( routingstepname );
    this.IsManuallyConfigured( true );
    
    traverse( this, OperationOutput, oo,
              not isnull( oo.ProductInStockingPoint_MP() )
              and oo.ProductInStockingPoint_MP().IsSystem() )
    {
      newproductid := this.MacroPlan().IDHolder().GetWIPProductID( routingid, routingstepname, unitid, oo.OperationLinkGroupID() );
      newsspid := this.MacroPlan().IDHolder().GetWIPStockingPointID( unitid );
      
      // Since the product and stocking point are WIP,
      // we need to update their names to be the same as
      // their IDs
      product := oo.ProductInStockingPoint_MP().Product_MP();
      product.Update( newproductid,
                      product.ParentID(),
                      newproductid,
                      product.UnitOfMeasureName(),
                      product.IsByProduct(),
                      product.IconName(),
                      product.Notes(),
                      product.HasShelfLife(),
                      product.ShelfLife(),
                      product.HasMaturation(),
                      product.MaturationDays(),
                      product.IsExcludedFromOptimization(),
                      product.IsPlannedAfterOptimization(),
                      product.IsExcludedFromFulfillmentKPI(),
                      not product.IsManuallyConfigured()                  
                     );
                     
      sp := oo.ProductInStockingPoint_MP().StockingPoint_MP();                 
      sp.Update( sp.Unit(),
                 newsspid,
                 newsspid,
                 sp.UnitOfMeasure_MP(),
                 sp.Currency_MP(),
                 sp.IconName(),
                 sp.IsPlannedInfinite(),
                 sp.Start(),
                 sp.End(),
                 sp.Group(),
                 sp.GISCountryCode(),
                 sp.GISCity(),
                 sp.GISPostalCode(),
                 sp.Notes(),
                 not sp.IsManuallyConfigured() );
    }
    
    if( not this.GetHasCustomID() )
    {
      this.UpdateTypeIndex( Operation::GetConcatenatedID( routingid, routingstepname, unitid ) );
    }
  *]
}