We consider a serial production system subject to stochastic deterioration with usage. Machines in the system will suffer quality failures and produce non-conforming items when they reach the out-of-control state. Nonconforming items transferred into the downstream machines may accelerate their deterioration process. Inspection is performed on the system to detect the state of all machines before starting each production lot. The predictive maintenance policy based on the predictive failure probability of each machine and the production control policy based on the target service level are proposed to meet the dynamic stochastic demand every period. Moreover, an opportunistic maintenance policy is considered to address the stochastic dependency and economic dependency in the system. An integrated model of production, quality and maintenance is developed to minimize the total cost. The optimal joint policy of the model is obtained by a simulation-based optimization method. Numerical experiments validate the advantages of our model in terms of cost savings and service improvement.