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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.07.2009, 03:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
Dynamics AX Sustained Engineering: Upgrade script ReleaseUpdateDB41_Invent\updateInventItemPrice () fails without LogisticsAdvanced license code
Источник: http://blogs.technet.com/dynamicsaxs...ense-code.aspx
==============

During upgrade from Axapta 3.0 to Dynamics AX 4.0 or AX 2009, upgrade script ReleaseUpdateDB41_Invent\updateInventItemPrice () fails in the absence of LogisticsAdvanced license code. License codes are used to enable configuration keys. Absence of LogisticsAdvanced license codes cause the disabling of the LogisticsAdvanced configuration key, which, in turn, removes the InventDimCombination Table from the database. This results in the upgrade script ReleaseUpdateDB41_Invent\updateInventItemPrice () failing.

The fix is to add a configuration key validation before processing table InventDimCombination, in \Classes\ReleaseUpdateDB41_Invent\updateInventItemPrice ()

public void updateInventItemPrice()

{

CostingVersion costingVersion;

InventItemPrice inventItemPrice;

InventItemPrice inventItemPriceExist;

InventTableModule inventTableModule;

InventDimCombination inventDimCombination;

CostingVersionId costingVersionId = #commonCostingVersionId;

InventDimId inventDimId = InventDim::inventDimIdBlank();

InventTable inventTable;

int rowCount = 0;

SkipAOSValidationPermission skipAOS;



void insertInventItemPrice(

CostingVersionId _costingVersionId,

ModuleInventPurchSales _moduleInventPurchSales,

CostingVersionPriceType _priceType,

ItemCostModel _itemCostModel,

boolean _restrictItemCostModel,

ItemPurchModel _itemPurchModel,

boolean _restrictItemPurchModel,

InventItemCostingType _costingType

)

{

;



insert_recordset inventItemPrice (VersionId, ItemId, Price, PriceUnit, PriceQty, Markup, PriceAllocateMarkup, UnitID, PriceType, ActivationDate, InventDimId, CostingType)

select _costingVersionId, ItemId, Price, PriceUnit, PriceQty, Markup, AllocateMarkup, UnitId, _priceType, PriceDate, inventDimId, _costingType from inventTableModule

where inventTableModule.ModuleType == _moduleInventPurchSales

&& inventTableModule.Price != 0

&& inventTableModule.PriceDate != dateNull()

exists join inventTable

where inventTable.ItemDimCostPrice == NoYes::No

&& inventTable.ItemId == inventTableModule.ItemId

&& (inventTable.CostModel == _itemCostModel || !_restrictItemCostModel)

&& (inventTable.PurchModel == _itemPurchModel || !_restrictItemPurchModel)

notexists join inventItemPriceExist

where inventItemPriceExist.ItemId == inventTableModule.ItemId

&& inventItemPriceExist.InventDimId == InventDim::inventDimIdBlank()

&& inventItemPriceExist.PriceType == _priceType

&& inventItemPriceExist.ActivationDate == inventTableModule.PriceDate;



rowCount += inventItemPrice.RowCount();

}



void insertInventItemPriceDimSalesPurchase(

CostingVersionId _costingVersionId,

ModuleInventPurchSales _moduleInventPurchSales,

CostingVersionPriceType _priceType,

ItemPurchModel _itemPurchModel,

boolean _restrictItemPurchModel,

InventItemCostingType _costingType

)

{

;



insert_recordset inventItemPrice (VersionId, UnitID, ItemId, Price, PriceUnit, PriceQty, Markup, PriceAllocateMarkup, PriceType, ActivationDate, CostingType, InventDimId)

select _costingVersionId, UnitId, ItemId, Price, PriceUnit, PriceQty, Markup, AllocateMarkup, _priceType, PriceDate, _costingType from inventTableModule

where inventTableModule.ModuleType == _moduleInventPurchSales

&& inventTableModule.Price != 0

&& inventTableModule.PriceDate != dateNull()

join InventDimId from inventDimCombination

where inventDimCombination.ItemId == inventTableModule.ItemId

exists join inventTable

where inventTable.ItemDimCostPrice == NoYes::Yes

&& inventTable.ItemId == inventTableModule.ItemId

&& (inventTable.PurchModel == _itemPurchModel || !_restrictItemPurchModel)

notexists join inventItemPriceExist

where inventItemPriceExist.ItemId == inventTableModule.ItemId

&& inventItemPriceExist.InventDimId == inventDimCombination.InventDimId

&& inventItemPriceExist.PriceType == _priceType

&& inventItemPriceExist.ActivationDate == inventTableModule.PriceDate;



rowCount += inventItemPrice.RowCount();

}



void insertInventItemPriceDimCost(

CostingVersionId _costingVersionId,

ItemCostModel _itemCostModel,

InventItemCostingType _costingType

)



{

ModuleInventPurchSales moduleInventPurchSales;

CostingVersionPriceType priceType;

;



moduleInventPurchSales = ModuleInventPurchSales::Invent;

priceType = CostingVersionPriceType::Cost;



insert_recordset inventItemPrice (VersionId, UnitID, ItemId, ActivationDate, CostingType, PriceType, InventDimId, Price, PriceUnit, PriceQty, Markup, PriceAllocateMarkup)

select _costingVersionId, UnitId, ItemId, PriceDate, _costingType, priceType from inventTableModule

where inventTableModule.ModuleType == moduleInventPurchSales

&& inventTableModule.Price != 0

&& inventTableModule.PriceDate != dateNull()

join InventDimId, del_CostPrice, del_PriceUnit, del_PriceQty, del_Markup, del_AllocateMarkup from inventDimCombination

where inventDimCombination.ItemId == inventTableModule.ItemId

exists join inventTable

where inventTable.ItemDimCostPrice == NoYes::Yes

&& inventTable.ItemId == inventTableModule.ItemId

&& (inventTable.CostModel == _itemCostModel)

notexists join inventItemPriceExist

where inventItemPriceExist.ItemId == inventTableModule.ItemId

&& inventItemPriceExist.InventDimId == inventDimCombination.InventDimId

&& inventItemPriceExist.PriceType == priceType

&& inventItemPriceExist.ActivationDate == inventTableModule.PriceDate;



rowCount += inventItemPrice.RowCount();

}

;





this.tableProgress(tablenum(InventItemPrice));



skipAOS = new SkipAOSValidationPermission();

skipAOS.assert();

// BP deviation documented

inventItemPrice.skipAosValidation(true);

inventItemPrice.skipDataMethods(true);

inventItemPrice.skipEvents(true);



ttsbegin;

// creating a common costing version

costingVersion = CostingVersion::find(#commonCostingVersionId, true);

if (!costingVersion)

{

costingVersion.VersionId = #commonCostingVersionId;

costingVersion.Blocked = NoYesCombo::Yes;

costingVersion.BlockActivation = NoYesCombo::Yes;

costingVersion.CostingType = CostingVersionCostingType::Normal;

}



// copy records from InventTableModule to InventItemPrice

// copy cost prices

insertInventItemPrice(#commonCostingVersionId, ModuleInventPurchSales::Invent, CostingVersionPriceType::Cost, NoYes::No, NoYes::Yes, NoYes::No, NoYes::No, InventItemCostingType::Undefined);

insertInventItemPrice('', ModuleInventPurchSales::Invent, CostingVersionPriceType::Cost, NoYes::Yes, NoYes::Yes, NoYes::No, NoYes::No, InventItemCostingType::Last);

// copy purchase prices

insertInventItemPrice(#commonCostingVersionId, ModuleInventPurchSales::Purch, CostingVersionPriceType::Purch, NoYes::No, NoYes::No, NoYes::No, NoYes::Yes, InventItemCostingType::Undefined);

insertInventItemPrice('', ModuleInventPurchSales::Purch, CostingVersionPriceType::Purch, NoYes::No, NoYes::No, NoYes::Yes, NoYes::Yes, InventItemCostingType::Last);

// copy sales prices

insertInventItemPrice(#commonCostingVersionId, ModuleInventPurchSales::Sales, CostingVersionPriceType::Sales, NoYes::No, NoYes::No, NoYes::No, NoYes::No, InventItemCostingType::Undefined);



if(new DictConfigurationKey(new DictTable(tablenum(InventDimCombination)).configurationKeyId()).enabled())

{

// copy records from InventDimCombination to InventItemPrice

// copy cost prices

insertInventItemPriceDimCost(#commonCostingVersionId, NoYes::No, InventItemCostingType::Undefined);

insertInventItemPriceDimCost('', NoYes::Yes, InventItemCostingType::Last);

// copy purcahse prices

insertInventItemPriceDimSalesPurchase(#commonCostingVersionId, ModuleInventPurchSales::Purch, CostingVersionPriceType::Purch, NoYes::No, NoYes::Yes, InventItemCostingType::Undefined);

insertInventItemPriceDimSalesPurchase('', ModuleInventPurchSales::Purch, CostingVersionPriceType::Purch, NoYes::Yes, NoYes::Yes, InventItemCostingType::Last);

// copy sales prices

insertInventItemPriceDimSalesPurchase(#commonCostingVersionId, ModuleInventPurchSales::Sales, CostingVersionPriceType::Sales, NoYes::No, NoYes::No, InventItemCostingType::Undefined);

}



// copy records from InventDimCombination to InventItemPrice

// copy cost prices

insertInventItemPriceDimCost(#commonCostingVersionId, NoYes::No, InventItemCostingType::Undefined);

insertInventItemPriceDimCost('', NoYes::Yes, InventItemCostingType::Last);

// copy purcahse prices

insertInventItemPriceDimSalesPurchase(#commonCostingVersionId, ModuleInventPurchSales::Purch, CostingVersionPriceType::Purch, NoYes::No, NoYes::Yes, InventItemCostingType::Undefined);

insertInventItemPriceDimSalesPurchase('', ModuleInventPurchSales::Purch, CostingVersionPriceType::Purch, NoYes::Yes, NoYes::Yes, InventItemCostingType::Last);

// copy sales prices

insertInventItemPriceDimSalesPurchase(#commonCostingVersionId, ModuleInventPurchSales::Sales, CostingVersionPriceType::Sales, NoYes::No, NoYes::No, InventItemCostingType::Undefined);



if (rowCount)

{

costingVersion.LastUpdate = systemdateget();

costingVersion.write();

}

ttscommit;

}







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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
aEremenko: Последние изменения в списке совместимости для AX Blog bot DAX Blogs 7 05.06.2009 05:10
Dynamics AX Sustained Engineering: SQL Server 2005 sp3 & SQL Server 2008 with Dynamics AX Blog bot DAX Blogs 0 12.02.2009 06:08
AX UK: Microsoft Dynamics AX 3.0 to 2009 Data and Code Upgrade Training Blog bot DAX Blogs 1 03.02.2009 11:15
Dynamics AX Sustained Engineering: Dynamics AX 2009 Patching Blog bot DAX Blogs 0 08.10.2008 10:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

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

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

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