chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
Method UpdateForDM (
  Unit unit
)
{
  Description: 'This update method is created purposely for DM integration that accept the unit with new value'
  TextBody:
  [*
    // soh yee Jan-7-2015 (created)
    
    // unit is the incoming unit from DMIS that has new value
    // Only perform necessary search for performance propose
    parentunit := ifexpr( this.ParentUnitID() = unit.ParentUnitID(),
                          this.Parent(),
                          Unit::FindUnitTypeIndex( unit.ParentUnitID() ) );
    
    uom := ifexpr( this.UnitOfMeasureName() = unit.UnitOfMeasureName(),
                   this.UnitOfMeasure_MP(),
                   UnitOfMeasure_MP::FindUnitOfMeasureTypeIndex( unit.UnitOfMeasureName() ) );
    
    currency := ifexpr( this.CurrencyID() = unit.CurrencyID(),
                        this.Currency_MP(),
                        Currency_MP::FindCurrencyTypeIndex( this.CurrencyID() ) );
    
    group := ifexpr( this.GroupName() = unit.CurrencyID(),
                     this.Group(),
                     Group::FindGroupTypeIndex( unit.GroupName() ) );
    
    this.Update( unit.ID(), unit.Name(), parentunit, unit.CapacityType(),
                 group, uom, currency,
                 unit.StartDate(), unit.EndDate(), unit.CampaignTypeDuration(),
                 unit.IsPlannedInfinite(),
                 unit.MinimumQuantity(), unit.HasMaximumQuantity(), unit.MaximumQuantity(),
                 unit.LotSize(), unit.IconName(),
                 unit.QuantityToProcess(),
                 unit.GISCountryCode(), unit.GISCity(), unit.GISPostalCode(),
                 unit.Notes(), unit.HasCapacitySmoothing(), unit.IsSmoothCapacityOverAllPeriods(),
                 unit.UserCapacitySmoothingLength(), unit.CapacitySmoothingPercentageDelta(),
                 unit.IsOverlapCapacitySmoothing(), unit.IsIncludedInSupplySpecification(), unit.IsSupplier(),
                 unit.HasUserFrozenFutureDuration(), unit.UserFrozenFutureDuration(),
                 unit.UseShiftOptimization(),
                 false );
    
    this.UpdateIsSoftDeleted( unit.IsSoftDeleted() );
  *]
}