Number of permutations with limited number of repetitions How many four-digit numbers can be formed with the numbers 1, 1, 1, 2, 2, 3, 3, 4 (it means you can use 1 for three times, 2 and 3 two times, and 4 just once)?
How does a generalization of that look like?
For instance, how many $k$-digit numbers can be formed with the set of numbers $\{a_1,...,a_n\}$, where the number $a_i$ can be repeated for $b_i$ times? Assume that $10 > a_i > 0$ and $b_i > 0$.

There is a theorem that says:

Let $A$ be the set $\{a_1,a_2,...,a_n\}$
and let $b_1, b_2,...,b_n$ be non-negative integers.
The number of permutations of the set $A$ where
each element $a_i$
is repeated exactly $b_i$ times is:
$$\frac{(b_1 + b_2 \:+ \cdots + \: b_n)!}{b_1!b_2! \cdots b_n! }$$

This is of course not exactly what you are looking for.
I dont think there is a closed form solution for your general case.
But the above theorem would work for you in special cases.
