コード例 #1
0
        public void RedisMonitor(Stopwatch tiempoEjecucion)
        {
            string tiempoStyle = "success";

            if (tiempoEjecucion.ElapsedMilliseconds > 4000)
            {
                tiempoStyle = "warning";
            }
            if (tiempoEjecucion.ElapsedMilliseconds > 6000)
            {
                tiempoStyle = "error";
            }

            machine.LogBroadcast(tiempoStyle,
                                 string.Format("Tiempo de ejecucion (ms) {0} ",
                                               tiempoEjecucion.ElapsedMilliseconds)
                                 );

            JObject json = new JObject();

            json["tiempoEjecucion"] = tiempoEjecucion.ElapsedMilliseconds.ToString();
            json["aoibarcode"]      = machine.line_barcode.ToString();
            json["smd"]             = machine.smd.ToString();
            json["tipo"]            = machine.tipo.ToString();
            Realtime.send(json.ToString());
        }
コード例 #2
0
        private void StartInspection()
        {
            aoiLog.verbose("Localizando CSV de Inspeccion");

            // Obtengo archivos CSV en InspectionFolder
            IOrderedEnumerable <FileInfo> csv = FilesHandler.GetFiles("*", aoiConfig.inspectionCsvPath);
            int totalCsv = csv.Count();

            aoiWorker.SetProgressTotal(totalCsv);

            if (totalCsv > 0)
            {
                int file_count = 0;

                foreach (FileInfo file in csv)
                {
                    file_count++;

                    #region REDIS
                    // Dato a enviar
                    JObject json = new JObject();
                    json["mode"]    = "runtime";
                    json["tipo"]    = aoiConfig.machineType;
                    json["current"] = file_count.ToString();
                    json["total"]   = totalCsv.ToString();
                    // Enviar al canal
                    Realtime.send(json.ToString());
                    #endregion

                    aoiLog.info("---------------------------------------------");
                    aoiLog.info(" Procesando " + file_count + " / " + totalCsv);
                    aoiLog.info("---------------------------------------------");

                    HandleInspection(file);

                    aoiWorker.SetProgressWorking(file_count);
                }

                aoiLog.info("No hay mas CSV");
            }
            else
            {
                #region REDIS
                // Dato a enviar
                JObject json = new JObject();
                json["mode"]    = "runtime";
                json["tipo"]    = aoiConfig.machineType;
                json["current"] = 0;
                json["total"]   = 0;
                // Enviar al canal
                Realtime.send(json.ToString());
                #endregion

                aoiLog.info("No se encontraron inspecciones.");
            }
        }
コード例 #3
0
        public void RedisRuntime(string current = "0", string total = "0")
        {
            // Dato a enviar
            JObject json = new JObject();

            json["mode"]    = "runtime";
            json["tipo"]    = aoiConfig.machineType;
            json["current"] = current;
            json["total"]   = total;
            // Enviar al canal
            Realtime.send(json.ToString());
        }
コード例 #4
0
        /// <summary>
        /// La placa que llego a TrazaSave, no se encuentra pendiente de inspeccion.
        /// </summary>
        /// <param name="path"></param>
        public void TrazaSave(string path)
        {
            Stopwatch tiempoEjecucion = Stopwatch.StartNew();

            history = new History();

            // Solo proceso si la etiqueta es FISICA, las etiquetas virtuales no se aceptan mas
            if (tipoBarcode.Equals("E"))
            {
                // Si se detectaron bloques
                if (bloqueList.Count > 0)
                {
                    machine.LogBroadcast("verbose",
                                         string.Format("Aoi: {0} | Inspector: {1} | Falsos: {3} | Reales: {4} | Pendiente: {2}",
                                                       revisionAoi,
                                                       revisionIns,
                                                       pendiente,
                                                       totalErroresFalsos,
                                                       totalErroresReales
                                                       )
                                         );

                    if (pendiente)
                    {
                        machine.LogBroadcast("warning",
                                             string.Format("Agregando panel a estado pendiente, se verificara en la siguiente ronda")
                                             );

                        Pendiente.Save(this);
                    }
                    else
                    {
                        /*
                         * Se consume el service y se obtiene toda la info actual de produccion
                         * OP, Declaracion, Rutas, Regex, Inspector logueado etc...
                         */
                        machine.GetProductionInfoFromIAServer();
                        if (machine.prodService.error == null) // El stack lo muestro en el metodo GetProductionInfoFromIAServer, si es null simplemente finaliza operaciones
                        {
                            if (machine.prodService.result.error == null)
                            {
                                // Existe configuracion de produccion?
                                if (machine.prodService.result.produccion != null)
                                {
                                    // Existe alguna configuracion de ruta?
                                    if (machine.prodService.routeMode != null)
                                    {
                                        PanelHandlerService(path);
                                    }
                                    else
                                    {
                                        machine.LogBroadcast("error",
                                                             string.Format("Se cancela la operacion, no existe puesto de produccion para {0}", machine.prodService.result.produccion.op)
                                                             );
                                    }
                                }
                                else
                                {
                                    machine.LogBroadcast("error",
                                                         string.Format("Error al obtener datos de OP en produccion del service, se cancela la operacion")
                                                         );
                                }
                            }
                            else
                            {
                                machine.LogBroadcast("error",
                                                     string.Format("Error al obtener resultados del service {0}", machine.prodService.result.error)
                                                     );
                            }
                        }
                    }
                }
                else
                {
                    machine.LogBroadcast("error",
                                         string.Format("Error no se detectaron bloques")
                                         );
                }
            }
            else
            {
                machine.LogBroadcast("error",
                                     string.Format("Etiqueta virtual {0} en {1} | Maquina: {2}, se cancela la operacion", barcode, programa, machine.maquina)
                                     );
            }

            #region MONITOR REDIS
            string tiempoStyle = "success";
            if (tiempoEjecucion.ElapsedMilliseconds > 4000)
            {
                tiempoStyle = "warning";
            }
            if (tiempoEjecucion.ElapsedMilliseconds > 6000)
            {
                tiempoStyle = "error";
            }

            machine.LogBroadcast(tiempoStyle,
                                 string.Format("Tiempo de ejecucion (ms) {0} ",
                                               tiempoEjecucion.ElapsedMilliseconds)
                                 );

            JObject json = new JObject();
            json["tiempoEjecucion"] = tiempoEjecucion.ElapsedMilliseconds.ToString();
            json["aoibarcode"]      = machine.line_barcode.ToString();
            json["smd"]             = machine.smd.ToString();
            json["tipo"]            = machine.tipo.ToString();
            Realtime.send(json.ToString());
            #endregion
        }