AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 14.09.2017, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
alirazazaidi: Select on InventSum vs InventOnHand Class Dynamics Ax 2012 R3.
Источник: https://www.tech.alirazazaidi.com/se...cs-ax-2012-r3/
==============

Today I face the very strange behavior of X++ code.

We develop customization. We generate transfer and issuance through X++.

Logic was very simple,If stock is available then transfer  / Issuance or Adjustment journal create otherwise generate error message, We took this decision  based of query on Inventsum. It works fine in most of cases but In one case when stock is zero it fails. We create Movement Journal to generate stock in that Item variant.  The select query always return Zero stock in posted quantity. Even I get the recid in debug mode and placed in table explorer, Quantity is available in table explore.

This case occurs when got Zero stock in Inventsum table and we try to increase stock by movement journal, other wise select on InventSum works fine.



The query will be very similar


Select * from InventSum where Inventsum.ItemId == line.ItemId && inventSum.invetdimId == line.fromInventiDimId;

This will not work. Even Db synch, Inc Cil, Cache clear done, even Restart the Test server AOS.



I have to switch code from select query to Class InventOnhand. Very similar to following.


InventOnHand inventOnhand

InventDim       InventDim;

InventDimParm inventDimParm;





inventDimParm.initFormInventDim(_Line.FromInventDimId);

inventOnHand = InventOnhand::newParameters(_line.Itemid,_line.FromInventDimId,inventDimParm);



If (inventOnHand.availPhysical() > _line.RequestedQty)

{

Info( ” Quantity Avalible “);

}

Else

{

Info (” Not available “);

}

Its works perfectly fine. I think  InventonHand class is better the do direct query on Inventsum table.





Источник: https://www.tech.alirazazaidi.com/se...cs-ax-2012-r3/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: AX Performance Troubleshooting Checklist Part 1B [Application and AOS Configuration] Blog bot DAX Blogs 0 05.09.2014 21:11
atinkerersnotebook: Using Excel to Import Customers and Vendors in Dynamics AX 2012 Blog bot DAX Blogs 0 19.07.2013 15:11
DAX: Official Dynamics AX 2012 R2 Content (update) - Where is it, and how can you find out about updates? Blog bot DAX Blogs 0 03.12.2012 11:11
Dynamics AX на Convergence 2012 Blog bot Microsoft и системы Microsoft Dynamics 0 13.01.2012 10:52
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:05.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.