...

Two types of approaches can be offered - "scheduled-style" mechanism that check the status of pieces and change the status of the PO line if necessary; “interceptor-style” mechanism that monitor changes in the status of pieces and change the status of the PO line if necessary.

Checking and updating the PO line status upon retrieving

PostgreSQL Trigger Functions

...

#_executing_periodic_and_delayed_actions

Separate Scheduler Application

PostgreSQL cron-job

pg_cron

...