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
Quintiq file version 2.0
#parent: #root
MethodOverride ExecuteMove (
  Boolean isundo
)
{
  TextBody:
  [*
    // edz1 Aug-31-2016 (created)
    
    // Select the source and target inventory specification and current target values
    sourceinvspec := this.SourceInventorySpecification();
    destinationinvspec := this.DestinationInventorySpecification();
    sourcetargetvalue := sourceinvspec.TargetInQuantity_DELETED_Nov19();
    destinationtargetvalue := destinationinvspec.TargetInQuantity_DELETED_Nov19();
    
    // If this is a regular move, the move quantity is moved from the source to the destination
    quantity := this.Quantity();
    newsourcetarget := sourcetargetvalue - quantity;
    newdestinationtarget := destinationtargetvalue + quantity;
    
    // If this is an undo move, the undo quantity is moved from the destination to the source
    if( isundo )
    {
      quantity := this.QuantityForUndo();
      newsourcetarget := sourcetargetvalue + quantity;
      newdestinationtarget := destinationtargetvalue - quantity;
    }
    
    sourceinvspec.UpdateTargetInQuantity( newsourcetarget );
    destinationinvspec.UpdateTargetInQuantity( newdestinationtarget );
    
    // Update the iteration inventory specifications with the new target inventory if this was not an undo move
    if( not isundo )
    {
      this.UpdateIterationInventorySpecification( this.SourceInventorySpecification(), newsourcetarget );
      this.UpdateIterationInventorySpecification( this.DestinationInventorySpecification(), newdestinationtarget );
    }
  *]
}