Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

WHS-on hand entries cleans up inventsum records with inventory

$
0
0

Dear community,

We're running AX 2012 R3 CU10 and the "Inventory Management --> Periodic --> Clean up --> Warehouse management on hand entries clean up" cleans up too many items sometimes.

When the batch jobs cleans up inventsum records with inventory and inventory value we're receiving an error that the standardcosts do not comply. This occurs because records in inventsum are deleted and the total inventory value doesn't match up with the quantity.

When we're running the consistency check it luckily restores the missing inventsum records.

 From what I can analyse the batch checks the Inventsum and WHS inventreserve

WHSInventReserve:

privateboolean validateWHSInventReserveRecsDeleted(InventTable _inventTable, InventDim _inventDim)

{

   WHSInventReserve                   whsInventReserve;

   InventDim                           inventDimCriteria;

   WHSReservationHierarchyElement     resHierarchyElement;

   InventDim                           inventDim;

   InventDimParm                       inventDimParm;

 

   inventDimCriteria.data(_inventDim);

   inventDimCriteria.clearFieldsFromHierarchyList(WHSReservationHierarchyProvider::construct().

                                                   getDimListBelowLocation(_inventTable, WHSReservationHierarchySortOrder::BottomUp));

 

   inventDimParm.initFromInventDim(inventDimCriteria);

 

   selectfirstOnly RecId from whsInventReserve

       where whsInventReserve.ItemId == _inventTable.ItemId

           && (whsInventReserve.AvailOrdered == 0

           && whsInventReserve.AvailPhysical == 0

           && whsInventReserve.ReservOrdered == 0

          && whsInventReserve.ReservPhysical == 0)

           #InventDimExistsJoin(whsInventReserve.InventDimId, InventDim, inventDimCriteria, inventDimParm)

       existsjoin resHierarchyElement

           where resHierarchyElement.ReservationHierarchyLevel == WHSInventReserve.HierarchyLevel

               && resHierarchyElement.ReservationHierarchy     == reservationHierarchy

               && resHierarchyElement.ReservationHierarchyLevel >= highestReservationLevel;

 

   return whsInventReserve.RecId == 0;

}

InventSum

protectedboolean validateInventSumDelete(InventSum _inventSum)

{

   boolean                     ret;

   WHSReservationHierarchyLevel level;

 

   ret = super(_inventSum);

 

   if (ret)

   {

       level = WHSReservationHierarchyInventDimUtil::getLevelOfFirstBlankDim(_inventSum.ItemId,

                                                                             _inventSum.inventDim(),

                                                                              WHSReservationHierarchySortOrder::TopDown);

       // Do not delete <c>InventSum</c> record if the dimension set is above the highest reservation level to delete.

       if (level < highestReservationLevel

           && level != 0) // if there are no blank dimension fields then level will be zero.

       {

           ret = false;

       }

   }

 

   return ret;

}

 

 Is this because the WHSInventReserve and InventSum tables are out of sync? Because the WHSInventReserve validation checks if all records are 0? What I also find strange is that this batch doesn't check if inventsum records are 0 as the regular On Hand entries clean up.

 

Looking at the code isn't it more efficient to clean-up all WHSInventReserve and InventSum records on SQL, where all records are 0?


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>