Our objective is to find jointly the optimal production lot size Q, the optimal inventory surplus S, the optimal sampling parameters n and c, and the optimal overhaul threshold r that minimize the total incurred cost. This includes the inventory and backlog costs, quality control costs and maintenance (setup, overhaul and CM) costs. The optimal solution must satisfy a number of constraints related to the system dynamic and the customer-perceived quality.