Показать сообщение отдельно
Старый 24.02.2020, 20:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
a33ik: Available physical on exact dimensions
Источник: http://daxonline.org/1679-available-...imensions.html
==============

If case of following conditions
  • Item is enabled for advanced warehousing
    WHSInventEnabled::exist(ItemId);
  • some warehouses have negative stock
You will see that Available physical figure is different from what you most probably want to get:




In this case Available physical will display total value across all warehouses or any other dimensions you stated as a criteria.
Available physical on exact dimensions will display correct value considering specified dimensions.


Here is how to get correct values from X++:
static void VKAvailablePhysical(Args _args){ Qty qty; InventDim inventDim; InventDimParm inventDimParm; InventOnHandQty inventOnHandQty; ItemId itemId = '11011'; InventAvailabilityByUnit inventAvailabilityByUnit; WhsInventReserveQty whsInventReserveQty; InventIAvailability inventIAvailability; inventDim.clear(); inventDim.InventSiteId = 'SiteId'; inventDim.InventLocationId = 'Warehouse'; inventDim = inventDim::findOrCreate(inventDim); // Available physical inventDimParm.initFromInventDim(inventDim); inventOnHandQty = InventOnHandQty::newItemDim(itemId, inventDim, inventDimParm); qty = inventOnHandQty.availPhysical(); // Available physical on exact dimensions inventAvailabilityByUnit = inventAvailabilityProvider::findByItemIdDim(itemId, inventDim); inventIAvailability = inventAvailabilityByUnit.parmInventAvailability(); if (inventIAvailability is WhsInventReserveQty) { whsInventReserveQty = inventIAvailability as WhsInventReserveQty; qty = whsInventReserveQty.availPhysicalLevel(); }}







Источник: http://daxonline.org/1679-available-...imensions.html