Countering the inventory management problem of manufacturing enterprise, according to the optimal control theory, considering the numbers of products as control variables and the stocks as the state variables, this essay establishes systemic real-time dynamic model, gives the objective function, and makes use of dynamic programming method to solve the optimal control and obtains the optimal inventory, which provides a theoretical foundation for the production and inventory management of manufacturing enterprise.