In this thesis, we address the critical issue of drug shortages that has persisted during and after the Covid-19 pandemic. We develop a two-stage stochastic model aimed at understanding how a compounding pharmaceutical company can balance supplier selection, drug production, back orders, and inventory management when faced with uncertain demand. To explore and resolve the application of two models under varying conditions, we introduce the Sample Average Approximation (SAA) and Lagrangean Decomposition methods. Additionally, to better simulate the uncertainties present in real-world scenarios, we employ Monte Carlo simulations to generate diverse cases, enabling the model to produce more reliable results.