My guess it may have smth to do with UpdateGoodsReceiptsAvailQty(). (I am not sure why is the purpose of this)
You can probably comment out it and see what happens.
Hi, Paul.
Sounds like you're talking about REST API. And that your are overwriting data with older values if B managed to read record before A finished to update it. Classic conflict resolution ...