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
42
43
44
45
Quintiq file version 2.0
#parent: #root
Method Update (
  Product_MP owner,
  StockingPoint_MP stockingpoint,
  Date date,
  Date manufactureddate,
  Real inventoryquantity,
  String description,
  Boolean isfromdb
)
{
  Description: 'Update inventory supply'
  TextBody:
  [*
    // Wayne Apr-15-2013 (created)
    oldpisp := this.ProductInStockingPoint_MP();
    
    needsync := isnull( oldpisp )
                or oldpisp.Product_MP() <> owner
                or oldpisp.StockingPoint_MP() <> stockingpoint;
    
    if( needsync )
    {
      owner.InventorySupply( relmove, this );
    
      // create pisp when there is changes to prodcut / stocking point
      owner.AddToStockingPoint( stockingpoint );
      
      // Update PISPAccount for associated InventorySupplyCost
      traverse( this, InventorySupplyCost, inventorysupplycost, not isnull( inventorysupplycost.PISPAccount() ))
      {
        inventorysupplycost.UpdateCommitLogic();
      }
    }
    
    this.Date( date );
    this.ManufacturedDate( manufactureddate );
    this.Update( inventoryquantity );
    this.Description( description );
    
    this.UpdateForeignKey( owner.ID(), stockingpoint.ID() );
    this.IsManuallyConfigured( not isfromdb );
  *]
}