private void TimerEventProcessor(Object myObject, EventArgs myEventArgs) { if (Global.prod_MnMs.getOrderStatus() == "in progress") { if (controlOK) { // Read Coil address 2 et metre sa valeure dans la variable modGo modGo = Global.communicateModbus(1, 1, 2, ""); if (modGo) { controlOK = false; modGo = false; // Go to next image nextImage(); // Use wrapper to analyze the img controlResult = WrapperTraitement.TraitementMnMs(new Bitmap(_list_path[_list_path_pos])); // Tell Runtime that the vision control is done Global.communicateModbus(2, 1, 3, "true"); // string = total - rouge - orange - bleu - marron - jaune updateStats(); // Show the controled image in the picture box pictureBox_imageControl.ImageLocation = _list_path[_list_path_pos]; // Upadtes screen objects updateScreen(); // Update Global level production status Global.update_MnMs_stats(controlStats.get_nbTotal(), controlStats.get_nbRouge(), controlStats.get_nbOrange(), controlStats.get_nbBleu(), controlStats.get_nbJaune(), controlStats.get_nbMarron()); modGo = false; controlOK = true; } } } }
private void TimerEventProcessor(Object myObject, EventArgs myEventArgs) { if (Global.prod_MnMs.getOrderStatus() == "in progress") { if (controlOK) { // Read Coil address 4 et metre sa valeure dans la variable modGo modGo = Global.communicateModbus(1, 1, 4, ""); // check modbus if (modGo) { modGo = false; controlOK = false; // Go to next image nextImage(); // Use wrapper to analyze the img Bitmap imgToTest = new Bitmap(_list_path[_list_path_pos]); controlResult = WrapperTraitement.TraitementSecurity(imgToTest); // OK - warning - danger // Load the controled image in the pictureBox pictureBox_imageControl.ImageLocation = _list_path[_list_path_pos]; nbImage++; if (controlResult == "warning") { nbWarning++; Global.prodSecurity_dangerStatus = "Warning"; // Write coil address 1 à false Global.communicateModbus(2, 1, 1, "true"); } else if (controlResult == "danger") { nbDanger++; Global.prodSecurity_dangerStatus = "danger"; // Write coil address 1 à true bool test; test = Global.communicateModbus(2, 1, 1, "true"); } else { Global.prodSecurity_dangerStatus = "OK"; // Write coil address 1 à false Global.communicateModbus(2, 1, 1, "false"); } Global.communicateModbus(2, 1, 5, "true"); updateScreen(); controlOK = true; } } } }