yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
Method UpdateForDM (
  StockingPoint_MP newstockingpoint
)
{
  Description: 'This update method is created purposely for DM integration that accept the stocking point with new value'
  TextBody:
  [*
    // soh yee Jan-7-2015 (created)
    
    // stockingpoint is the incoming stocking point from DMIS that has new value
    // Only perform necessary search for performance propose
    unit := ifexpr( this.UnitID() = newstockingpoint.UnitID(),
                    this.Unit(),
                    Unit::FindUnitTypeIndex( newstockingpoint.UnitID() ) );
    
    currency := ifexpr( this.CurrencyID() = newstockingpoint.CurrencyID(),
                        this.Currency_MP(),
                        Currency_MP::FindCurrencyTypeIndex( newstockingpoint.CurrencyID() ) );
    
    uom := ifexpr( this.UnitOfMeasureName() = newstockingpoint.UnitOfMeasureName(),
                   this.UnitOfMeasure_MP(),
                   UnitOfMeasure_MP::FindUnitOfMeasureTypeIndex( newstockingpoint.UnitOfMeasureName() ) );
    
    group := ifexpr( this.GroupName() = newstockingpoint.CurrencyID(),
                     this.Group(),
                     Group::FindGroupTypeIndex( newstockingpoint.GroupName() ) );
    
    this.Update( unit, newstockingpoint.ID(), newstockingpoint.Name(),
                 uom, currency,
                 newstockingpoint.IconName(), newstockingpoint.IsPlannedInfinite(),
                 newstockingpoint.Start(), newstockingpoint.End(),
                 group,
                 newstockingpoint.GISCountryCode(), newstockingpoint.GISCity(),
                 newstockingpoint.GISPostalCode(), newstockingpoint.Notes(), 
                 false );
    
    this.UpdateIsSoftDeleted( newstockingpoint.IsSoftDeleted() );
  *]
}