It has the same meaning of the expression "have your cake and eat it too", that is, when there's a tradeoff you cannot have both things at the same time.
In this case you have three parts:
botte piena = a full barrel [of wine]
moglie ubriaca = a drunk wife
uva sulla vigna = grapes on the vine, the grapes used to make the wine
botte piena = a full barrel [of wine]
moglie ubriaca = a drunk wife
uva sulla vigna = grapes on the vine, the grapes used to make the wine
The third part is sometimes omitted, and you also have "avere la moglie piena e la botte ubriaca".
There are some regional variations, for example, in Ferrara there's an s'pol brisa aver galina, ov e cul cald (non si possono avere gallina, uovo e culo caldo; literally, "you can't have chicken, egg and warm ass," where warm ass means not to have to work).
An s'pol brisa aver galina, ov e cul cald.
Non si possono avere gallina, uovo e culo caldo
You can't have chicken, egg and warm ass (where warm ass means to not have to work)