As the European Union enacted the RoHS Directive, more and more companies are going to adapt themselves to RoHS compliance, which for many companies increases difficulty in controlling the content of hazardous substances as well as the cost of product. Meeting the requirements of the RoHS and lowering the cost are aims of the work. This paper has presented two models based on product lifecycle. One is zero-one integer linear programming model, and the other one is fuzzy zero-one integer linear programming model. In the end, we shall respectively apply the two models which are substantiated by Matlab to a needle bar of an industrial sewing machine.