OrderItemShipGrpInv records that share the same inventoryItemId calculate incorrect results when receiving inventory for the product.
1. Create an order for product "PEPPERS-G" with a quantity of 10 and click "Finish Order"
2. Add another ship group and click "Continue"
3. Assign 5 of the order items to the second ship group created and then finish the order
4. Navigate to the Receive Inventory page of the WebStoreWarehouse facility
5. Enter "PEPPERS-G" into the productId field and click "Receive Product"
6. Enter a quantity of 6 into the quantityAccepted field and click "Receive"
7. Open the OrderItemShipGrpInvRes table and notice that the quantityNotAvailable field has been set to blank for the first record and 4 for the second record and that they both share the same inventoryItemId
8. Now navigate back to the Receive Items page and receive in the product again but with a quantity of 1
9. Refresh the OrderItemShipGrpInvRes results and notice that the first record has a new inventory item applied to it with a quantity of 1 and the other record has been updated to reflect a new quantityNotAvailable value.
It seems like OrderItemShipGrpInvRes should be deleted anytime the quantityNotAvailable field gets set to 0, blank, or null. I've noticed this logic performed in other methods that deal the entity.
Step 9 should not add quantityNotAvailable back to the first record one it has been fulfilled. The second item was supposed to have its quantityNotAvailable field decremented by 1 but no change took plce for it.
I believe this problem is probably caused by an inventoryItemId being associated with more than one record in the table.
This problem basically happens anytime the inventory received is greater than the quantityNotAvailable field of the first OrderItemShipGrpRes table. It happens when you have orders from two different customers and you receive more inventory than the quantityNotAvailable for the first customer order item.