The last step in receiving/check-in flow is to update the status of PO Line to "Partially Received" or "Fully Received". It's possible that something may go wrong and status won't be updated even though the items were actually received.
So the mechanism to guarantee the status is up-to-date needs to be worked out.
Some high-level options:
- eventual consistency is probably the best we can do for now (e.g. check and update the status upon retrieving PO line)
- another option is to create trigger functions in DB to ensure the summary data is updated when the underlying piece records are updated (performance impact should be assessed)