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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.12.2010, 00:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
Dynamics AX Sustained Engineering: Fields modifiedDateTime and modifiedBy on Table InventSum
Источник: http://blogs.technet.com/b/dynamicsa...inventsum.aspx
==============

Problem:

Fields "modifiedDateTime" and "modifiedBy" on Table InventSum are not updated correct in inventory journals.

Resolution:

The following code changes will update the modifiedDateTime and modifiedBy fields on the InventSum table when posting Inventory Journals.

1.\ Classes\InventUpdateOnHand\sqlUpdateInventSumStrSQLServer


1.1Add comments on added SQL str in the beginning of this method

/* This method will build following statement in a str:

InventSum.LastUpdDateExpected= CASE WHEN InventSum.LastUpdDateExpected > InventSumDelta.MAX_LastUpdDateExpected

THEN InventSum.LastUpdDateExpected

ELSE InventSumDelta.MAX_LastUpdDateExpected

END,

//New added begin

InventSum.ModifiedDateTime = dateadd(ms, -datepart(ms,getutcdate()), getutcdate()),

InventSum.ModifiedBy= currentUserId,

//New added end



1.2Variable definition

Added code is listed as below.

str 256tmpFieldNameModifiedDate= new SysDictField(tablenum(InventSum),fieldnum(InventSum, ModifiedDateTime)).name(DbBackend::Sql,0,FieldNameGenerationMode::FieldList);

str 256tmpFieldNameModifiedBy= new SysDictField(tablenum(InventSum),fieldnum(InventSum, ModifiedBy)).name(DbBackend::Sql,0,FieldNameGenerationMode::FieldList);

userIdcurrentUserId = curuserid();



1.3Added SQL clause

//InventSum.LastUpdDateExpected = CASE WHEN InventSum.LastUpdDateExpected > InventSumDelta.MAX_LastUpdDateExpected

//THEN InventSum.LastUpdDateExpected

//ELSE InventSumDelta.MAX_LastUpdDateExpected

//END,

pct2 += ', ' + inventSumName + '.' + tmpFieldNameUpdExp + ' = CASE WHEN '+ inventSumName + '.' + tmpFieldNameUpdExp + ' > ' + inventSumDeltaName + '.' + maxPrefix + tmpFieldNameUpdExp;

pct2 += ' THEN '+ inventSumName + '.' + tmpFieldNameUpdExp + ' ELSE ' + inventSumDeltaName + '.' + maxPrefix + tmpFieldNameUpdExp + ' END ';



// New added begin

//InventSum.ModifiedDateTime = dateadd(ms, -datepart(ms,getutcdate()), getutcdate()),

pct2 += ', '+ inventSumName + '.' + tmpFieldNameModifiedDate + ' = dateadd(ms, -datepart(ms,getutcdate()), getutcdate()) ';



// InventSum.ModifiedBy = currentUserId,

if (tmpFieldNameModifiedBy) // table property ModifiedBy might not be enabled

{

pct2 += ', ' + inventSumName + '.' + tmpFieldNameModifiedBy + ' = ' + '\'\'' + currentUserId + '\'\'';

}

// New added end



2.Enable table property ModifiedDateTime and CreateRecIdIndex:

“\DataDictionary\Tables\InventSum\TableProperty”

Save table “\DataDictionary\Tables\InventSum”. Synchronize DataDictionary.






Источник: http://blogs.technet.com/b/dynamicsa...inventsum.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 23:22.