Receiving cargo doesn't follow ratio between UOMs

Hi everyone
We usually receive cargo in different containers. This is standard practice in most businesses.
I think this scenario is very common but let me explain it with an example:
lets say we buy tiles. we buy it on square meter and sell it based on sqaure meter but when a cargo arrives its based on pallets and boxes which don’t follow the same ratio. for example one box might contain 200 sqm another 170 etc…
But the number of boxes and pallets (or containers) sent is set when the purchase is made
So we need a way for stock user to count the number of pallets and boxes not the actual sqm and receive the cargo if everything is there.
Also while maintaining the warehouses we count these pallets and boxes no the actual square meters inside.
any suggestions?