For a successful company, machines are always required to work continuously to make more profit in a certain period. However, machines can be unavailable due to the scheduled maintenance activities or unexpected failures. Hence, a model connected production scheduling with maintenance planning for a production line which is composed of multiple machines is developed. Suppose preventive maintenance is imperfect and cannot renew all the machines. Age reduction factor and hazard rate increase factor are introduced to illustrate the imperfect character. Aperiodic preventive maintenance policy is adopted. Replacement as perfect maintenance could restore the machine "as good as new". When and whether to perform replacement is based on a cost-time rate function which is defined to judge whether or not the preventive maintenance is economical. The objective of the joint model is to maximize the total profit which is composed of production value, production cost, maintenance cost (including the preventive maintenance cost and replacement cost), and tardiness cost (which is related to the job sequence and maintenance activities). To optimize the objective, immune clonal selection algorithm is utilized. The proposed model is validated by a numerical example.