A defect prevention is a part of manufacturing company practice. Paper proposes a formal approach for solving scheduling problems with unexpected events as extension of general frameworks for Zero-Defect Manufacturing (ZDM) strategy. ZDM aims to improve the process efficiency and the product quality while eliminating defects and minimizing process errors. However, most of ZDM applications focus on using the technological achievements of Industry 4.0 to detect and predict defects, forgetting to optimize the schedule on the production line. We propose formal method to create predictive-reactive schedule for problems with defect detection and repair. Our proposal is based on the formal Algebraic-Logical Meta-Model (ALMM). In particular, it uses the model switching method and combines defect detection, heuristics construction and decision support containing predictions of disturbances in the production process and enabling their prevention. Production defects are detected and repaired, and consequently, production delivers components without defects, and in the shortest possible time. Moreover, the collection and analysis of data related to the occurrence of disturbances in the production process helps the management board in making decisions based on analysis gathered and stored data. Thus, the proposed method includes strategies such as detection, repair, prediction and prevention for defect-free production. We illustrate the proposed method on the example of a flow-shop system with different types of product defect problem.