1

I need to Update Prices for bulk of items for each warehouse. The Activate Price button is on InventItemPrice Form (Path: PIM > Released Products > Manage Cost > Item Price).

I have a process where I am using the same code of that Activate Price button to update prices for bulk products for each warehouse.

So the activate Button will go one by one (each product with each warehouse) at one time and will activate.

If I do this way, it is taking lot of time to update prices for bulk amount of Products.

Is there any other alternative for this to Activate price for bulk products?

I observed one more thing in this process, if there are multiple records in InventTrans for an Item then in the process of this activation, InventStdCostAdjust::adjustCostFinancialTrans method has a query which loops as many times as the records in inventTrans which is making this process hangup/making slow because some items have 1000's of records in that table for each item.

So to conclude this, I would need some help or need some tips about Best Approach to Activate Prices for Bulk Products(70000 approx)(5warehouses).

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
Raj
  • 85
  • 14
  • `Activate Price` is a `MenuItemButton`, Invoke `InventItemPriceActivationJob`, your code use this class? can you share your code? – Jonathan Bravetti Jan 04 '17 at 18:50
  • Yes. My code is just looping through each ware house and passing InventItemPriceSim to the activateOneInventItemPriceSim method in InventItemPriceActivationJob Class. I am just calling that class, just like standard. But I have more than 70000 records with those 6 sites/warehouses. So whenever an item comes it takes first warehouse and pass to above method i said. Similarly its doing for all items.... If i debug into that method in the middle its going to InventStdCostAdjust::adjustCostFinancial where the query and looping is taking lot of time. – Raj Jan 04 '17 at 20:16
  • while select siteId from inventsite table { inventItemPriceSim = msftxxxxxRevaluate.createSimulatedItemPrice(inventDim); if (inventItemPriceSim.RecId != 0) { inventItemPriceActivationJob = InventItemPriceActivationJob::construct(); if (inventItemPriceActivationJob != null) { inventItemPriceActivationJob.activateOneInventItemPriceSim(inventItemPriceSim); } } } – Raj Jan 04 '17 at 20:18
  • Looks ok, in `InventStdCostAdjust` class in one part there is a loop in `InventTrans` table, Surely for that reason is taking lot of time. also you have many items. I don't find another way to do that. – Jonathan Bravetti Jan 05 '17 at 11:28
  • Oh Ok. Yes thats taking lot of time. For the number of items/records we have it might take around 60-90 hrs. I am not sure how can i overcome this. Thanks for trying to help. I will see if any other options and will keep you updated here. – Raj Jan 05 '17 at 16:12
  • 1
    You could try splitting up the work (write a job for each warehouse, for example) and running them on your batch server in different tasks. – SShaheen Jan 27 '17 at 20:25

1 Answers1

0

As SShaheen suggested, I wrote a batch job with a query that accepts Warehouse as a Parameter. I tried to run 6 batch jobs at same time, but it throws error saying deadlock for item. This happens because all are picking the same item for 6 warehouses so this happens.

I tried to run the batch job with First ware house and then wait for couple of mins and started second one and similarly 3,4,5,6. This WORKED. This helped me to reduce the time taken by 6. (TotalTime)/6. I am still working on trying to decrease this time as I have around 80000 records. Will keep posted if i found a better solution.

Raj
  • 85
  • 14