|
07.07.2009, 03:05 | #1 |
Участник
|
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, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|