The authors consider a production planning problem in an N-machine flowshop subject to breakdown and repair of machines and to non-negativity constraints on work-in-process. The machine capacities and demand processes are assumed to be finite-state Markov chains. The problem is to choose the rates of production and inventory/backlog over an infinite horizon. It is formulated as a stochastic dynamic programming problem. The authors show that the value function of the problem is locally Lipschitz and is a solution to a dynamic programming equation together with a certain boundary condition. They provide an interpretation of the boundary condition. The authors also prove a verification theorem and derive the optimal feedback control policy in terms of the directional derivatives of the value function. Finally, they obtain a deterministic optimal control problem that is equivalent to the stochastic production planning problem under consideration.