Class InventOnhand

The class inventOnhand is very useful when retrieving inventory information for a specific item.

If we want to get the sum of an item for all warehouses and all configurations:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  static void FO_InventOnhand(Args _args)
  {
      InventOnhand        onhand;
      ;
 
      onhand = InventOnhand::newItemId("0001");
 
      // Physical inventory
      print onhand.physicalInvent();
 
      // Physical reserved
      print onhand.reservPhysical();
 
      // Total available
      print onhand.availOrdered();
 
      // Ordered reserved
      print onhand.reservOrdered();
 
      // Available physical
      print onhand.availPhysical();
 
      pause;
  }

Maybe we want the sum of an item in a certain warehouse, in our case the warehouse “GW”:

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
  static void FO_InventOnhand(Args _args)
  {
      InventOnhand        onhand;
      ;
 
      onhand = InventOnhand::newItemId("0001");
      onhand.parmInventLocationId("GW");
 
      // Physical inventory
      print onhand.physicalInvent();
 
      // Physical reserved
      print onhand.reservPhysical();
 
      // Total available
      print onhand.availOrdered();
 
      // Ordered reserved
      print onhand.reservOrdered();
 
      // Available physical
      print onhand.availPhysical();
 
      pause;
  }

If the item has different configurations, let’s say that item “0001” is a lamp that comes in the different colors red, green and black. But we only want to see the sum of the black(Has the configId “Black”) lamps:

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
  static void FO_InventOnhand(Args _args)
  {
      InventOnhand        onhand;
      ;
 
      onhand = InventOnhand::newItemId("0001");
      onhand.parmInventLocationId("GW");
      onhand.parmConfigId("Black");
 
      // Physical inventory
      print onhand.physicalInvent();
 
      // Physical reserved
      print onhand.reservPhysical();
 
      // Total available
      print onhand.availOrdered();
 
      // Ordered reserved
      print onhand.reservOrdered();
 
      // Available physical
      print onhand.availPhysical();
 
      pause;
  }

If we have some SalesLine data we can narrow this calculations even further, this is because in the SalesLine we have access to the InventDimId. With the InventDimId we can get the specific inventory data for this specific salesLine. This can look something like this if the method is created on the salesLine table:

inventDimParm.initDimActive(InventTable::find(this.ItemId)
                            .DimGroupId);
onHand = InventOnHand::newItemDim(this.ItemId, 
                      inventDim::find(this.InventDimId), 
                      inventDimParm);

The static method newItemDim() does just what we have done before with the parameters methods, but behind the scenes in the InventOnhand class. This is what happens:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  static InventOnhand newItemDim( 
                    ItemId             _itemId,
                    InventDim          _inventDim,
                    InventDimParm      _inventDimParm
                    )
  {
      InventOnhand inventOnhand = new InventOnhand();
      ;
 
      inventOnhand.parmInventDim(_inventDim);
      inventOnhand.parmInventDimParm(_inventDimParm);
      inventOnhand.parmItemId(_itemId);
 
      return inventOnhand;
  }

Last 5 posts in Development

Leave a Reply

Your email address will not be published. Required fields are marked *