Palletize mix of assemblies and single products

Hello colleagues,

I have one pallet in the middle of the hall on which human resource is creating the pattern of 16 boxes (4x4). It would be no problem if the TransportIn products were only signle boxes, but I need to palletize the combination of single boxes and boxstacks containing 4 products. So If I use “TransportPatternIn” statement, its counting one boxstack as one product instead of 4.

The result should be “If I have 16 products on the pallet, transport pallet out of the hall”.

Is there any simplier solution than combination of “IF” statements and creating of integers in routine properties or creating another process node next to the pallet and breakdown the boxstack to signle boxes?