Self-adjustment

Hello everyone, I would like to seek some assistance from you.
I hope to achieve the following logic:
Before moving the workpieces from A to B, we need to check if there are any workpieces in D. If there are workpieces in D, we can move them to B. Since the number of workpieces in D is dynamic, we need to dynamically adjust whether the workpieces in A can be moved to B.

This is the current logic I have written, but it hasn't been implemented. Haha

Thank you for your help!