In this paper, a manufacturing system composed by a single-product machine, a manufacturing stock, a purchase warehouse and a constant demand is considered. A stochastic fluid model is adopted to describe the system and to take into account delivery times. The goal of this paper is to evaluate the two optimal inventory levels: that of the manufacturing stock and that of the warehouse. Those optimal levels allow minimizing the total cost which is the sum of inventory, transportation and backlog costs. Infinitesimal perturbation analysis is used for optimisation of the failure-prone manufacturing system. The trajectories of the inventory levels are studied and the infinitesimal perturbation analysis estimates are evaluated. These estimates are shown to be unbiased and then they are implemented in an optimisation algorithm which determines the optimal inventory levels in the presence of constant delivery time.