The textile industry is one of the world's major sources of industrial pollution, and related environmental issues are becoming an ever greater concern. This paper considers the environmental issues of carbon emissions, energy recycling, and waste reuse, and uses a mathematical programming model with Activity-Based Costing (ABC) and the Theory of Constraints (TOC) to achieve profit maximization. This paper discusses the combination of mathematical programming and Industry 4.0 techniques to achieve the purpose of green production planning and control for the textile industry in the new era. The mathematical programming model is used to determine the optimal product mix under various production constraints, while Industry 4.0 techniques are used to control the production progress to achieve the planning targets. With the help of an Industry 4.0 real-time sensor and detection system, it can achieve the purposes of recycling waste, reducing carbon emission, saving energy and cost, and finally achieving a maximization of profit. The main contributions of this research are using mathematical programming approach to formulate the decision model with ABC cost data and TOC constraints for the textile companies and clarifying the relation between mathematical programming models and Industry 4.0 techniques. Managers in the textile companies can apply this decision model to achieve the optimal product-mix under various constraints and to evaluate the effect on profit of carbon emissions, energy recycling, waste reuse, and material quantity discount.