Using Multiple fields to update Stock

Using Multiple fields to update Stock

Hi,
I want to use multiple fields to update stock for eg:

i have Design No., Shade No., and Meter using the reference of Design No and Shade No meter should get updated.

Note: Design No. and shade no. can have multiple entries of same number.

I have tried that but it doesn't seem to work.
Following is the code i tried.

for each  Stock_Record_Obj in input.Fabric_Details
{
//fetch fabric stock record by using the ID of the record from the lookup field
product_Obj = Fabric_Stock[ID = Stock_Record_Obj.Design_No];
//check if a fabric stock record exists
if(product_Obj.count() > 0)
{
//fetch fabric shade record by using the ID of the record from the lookup field
product_Shade_Obj = Fabric_Stock[ID = Stock_Record_Obj.Shade_No];
//check if a fabric shade record exists
if(product_Shade_Obj.count() > 0)
{
//update the records meter
product_Obj.Meter=product_Obj.Meter - Stock_Record_Obj.Meter;
}
}
}