I am interested in computing the number of non-negative integral $n$-tuples $(x_1, \cdots, x_n)$ satisfying the following two conditions, as a function of the parameters $D,T, w_1, \cdots, w_n, v_1, \cdots, v_n$ where $w_1, \cdots, w_n \in \mathbb{N}, \gcd(w_1, \cdots, w_n) = 1$ and $v_1, \cdots, v_n > 0$ say, such that:

$$\displaystyle w_1 x_1 + \cdots + w_n x_n = D,$$ and $$\displaystyle v_1 x_1 + \cdots + v_n x_n \leq T.$$ The latter condition is stated as an inequality so that we do not have obstructions where $v_1, \cdots, v_n$ are not rational and so there are no solutions at all.

Obviously, if $T$ is sufficiently large relative to $D, v_1, \cdots, v_n, w_1, \cdots, w_n$ then the latter condition is vacuous; as every tuple that satisfies the first equality would satisfy the latter inequality. In that case the answer would be $$\displaystyle \sim \frac{D^{n-1}}{w_1 \cdots w_n (n-1)!}.$$ Conversely, if $T$ is sufficiently small relative to the rest of the parameters, then there would be no solutions at all.

I am trying to obtain a precise statement that estimates the count as a function of the parameters above, any help would be appreciated.

In particular, the following more refined question may be a better candidate: Suppose that $T$ is fixed, so that those $(x_1, \cdots, x_n) \in \mathbb{R}_{\geq 0}^n$ satisfying $$\displaystyle v_1 x_1 + \cdots + v_n x_n \leq T$$ form a bounded region $K$, and in particular there exist $D \in \mathbb{N}$ such that the number of solutions of integers $$\displaystyle w_1 x_1 + \cdots + w_n x_n = D$$ in $K$ is non-zero. What value of $D$, as a function of $T$ and the weights, maximize the number of solutions?