The article deals with a formal approach to solving manufacturing problem with defects removal and presents the application of this approach to flow-shop system with defects. The defects are detected during quality control and thus they are unexpected events. Moreover, a job processing time is not predetermined, and it may contain the unknown time needed to repair. Therefore, stochastic uncertainties are considered, but in addition, we model the process of decision making. The algebraic-logical meta-model methodology constitutes the basis for our approach. A hybrid algorithm for constructing a solution based on the process simulation using special local optimizing task and algebraic-logical models switching when defect detection occurs is presented. In particular, the following elements of the presented approach are shown: disturbances type analyzing, definition of switching states set, definition of subproblems, algebraic-logical metamodels creating for all subproblems, switching types determining, determination of the switching rules, the switching function, and components of special local criterion definition. The article shows results of computer experiments.