In electronic product manufacturing, quality control and production cost management pose challenges for enterprises. First, key factors for production decisions are identified: component inspection, assembly, inspection of semi-finished and finished products, and handling defective goods at different stages. Next, dynamic programming and genetic algorithms optimise sampling inspection. A production decision model covers multiple processes and component combinations. The relationship between the inspection and the final product quality is explored, showing that different decision paths affect the total cost and defect rate. Real-time monitoring and a dynamic Bayesian network guide production strategy adjustments to boost efficiency and reduce defects. This study proposes adaptable inspection and disassembly strategies that reduce costs and optimise resource use across production scenarios.