This paper studies the dynamic production planning problem with the production and outsourcing when demand is dynamically changed through the given planning horizon. For a discrete and finite time periods, the production planning is to determine the production amount and outsourcing amount for each period to minimize the total cost. The production consists of normal production and excess production. The normal production amount is restricted, but the excess production and outsourcing amount are not restricted. The backlogging is not allowed. The cost factors are the production cost, the outsourcing cost and the inventory holding cost. The production cost is piecewise linear. The problem is analyzed and a mathematical model is formulated. The characteristics of the optimal solution are analyzed and a algorithm is developed. A numerical example is shown to explain the problem.