Entry - On Edit

Entry - On Edit

Hello,
I have 2 forms "Inward" and "Stock Book", where both the forms stores the details of Shirts which includes Article No., Color No., Type of Garment, and different sizes ranging from Size XS - Size 6XL.
Now, when a user enters an entry in Inward data duplicates that entry in Stock Book if the Article No., Color No. and Type of Garment matches then the sizes will just add up to that entry. if not it will create a new entry in Stock Book. 
This is the workflow of Inward Entry - When Created.
Now , the problem arises when i try to edit the entry 
For ex: I have the following entry in Inward

Record ID
Article No.
Color No.
Garment
Total Pcs
1001
56459
212
Shirts
50
1002
56459
212
Shirts
40

 So the entry in Stock Book would be


Record ID
Article No.
Color No.
Garment
Total Pcs
1001,1002
56459
212
Shirts
90

Now when i edit in Record ID 1002 Total Pcs to 50, so the entry in stock book should be 100 Pcs.
But the record gets updated as follows:

Record ID
Article No.
Color No.
Garment
Total Pcs
1001,1002
56459
212
Shirts
140


Is there any solution to this?
Please reply ASAP.