Total qty per item in BOM structure
I am giving this task.
Giving a BOM structure, try to find the total quantity required per item to build x unit (let say 2) of the parent. The depth of the structure can be more than 5. Any item, except the parent, can be appeared more than 1 time in the BOM structure. Total number of item can be more than 3000.
With the quantity per item, try to find if this quantity can be found from the price list. If yes, retrieve the price.
I am thinking first calculating the total quantity required per item and store it in the array. Later, try to go through the array and compare line by line with price list.
However, I have difficulty in putting the 3000 item into the array. The difficult part is for every item in the BOM, I need to check if this item already in the array. If yes, add up the quantity. Else, create a new entry in the array.
Your advice will be really helpful.