Esempio n. 1
0
        /// <summary>
        /// 单次读取  命令:RSSI ANT
        /// </summary>
        private ReturnMessage SingleShotRead()
        {
            ReturnMessage returnMsg = new ReturnMessage();

            try
            {
                m_RFIDReader.Read(null, "RSSI ANT");

                // Other read example:
                // Besides the tag key (EPCID) which is read by default, also
                // read the	antenna number (where read occurs) and 4 bytes of
                // data in memory bank 2 starting from address 0.
                // m_RFIDReader.Read(null, "ANT, HEX(2:0,4)");

                returnMsg.CallStatus  = false;
                returnMsg.CallMessage = "单次读取";
                //解析标签
                AnalysisTags(m_RFIDReader.Tags);
            }
            catch (Exception ex)
            {
                returnMsg.CallStatus  = false;
                returnMsg.CallMessage = "异常:读取失败.错误信息:" + ex.Message;
            }
            return(returnMsg);
        }
Esempio n. 2
0
        //Función para la lectura de 1 tag y posicionarlo en el txtTagEPC y la variable tag.
        public void leer_tag()
        {
            try {
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        int contador = 0;
                        foreach (Tag eti in reader.Tags)
                        {
                            if (contador == 0)
                            {
                                Ptone1.Play();
                                if (txtEPC.InvokeRequired)
                                {
                                    txtEPC.Invoke((Action)(() => txtEPC.Text = eti.ToString()));
                                    tag = eti.ToString();
                                }
                                Ptone2.Play();
                                RFID = false;
                                if (btnLeer.InvokeRequired)
                                {
                                    btnLeer.Invoke((Action)(() => btnLeer.Visible = true));
                                    btnLeer.Invoke((Action)(() => btnLeer.Enabled = true));
                                }

                                if (lblStatus.InvokeRequired)
                                {
                                    lblStatus.Invoke((Action)(() => lblStatus.Text = "Tag leído."));
                                    if (dgTarimas.InvokeRequired)
                                    {
                                        dgTarimas.Invoke((Action)(() => dgTarimas.Visible = false));
                                        //JLMQ Intentar poner aqui la validacion que ejecute la accion de doble click
                                        dgTarimas.Invoke((Action)(() => dgTarimas_DoubleClick(dgTarimas, ee)));
                                        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                        //dgTarimas.Enabled = true;//ACTIVA EL DT
                                        //dgTarimas.Visible = true;
                                    }
                                }
                                if (btnMover.InvokeRequired)
                                {
                                    btnMover.Invoke((Action)(() => btnMover.Focus()));
                                }
                            }
                            contador++;
                            break;
                        }
                    }
                }
            } catch (ObjectDisposedException odex) {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            } catch (ThreadAbortException ex) {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            } catch (Exception eex) {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
        public void leer_tag()
        {
            // Bloque nuevo
            bool cierre = false;

            try
            {
                // MessageBox.Show("Lectura Iniciada", "INICIO");
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        foreach (Tag eti in reader.Tags)
                        {
                            //Ptone1.Play();
                            string tag = eti.ToString();
                            epc = tag;
                            if (txtEPC.InvokeRequired)
                            {
                                //dataGrid1.Invoke((Action)(() => fillDataGrid()));
                                btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                Ptone1.Play();
                                btnFinalizar.Invoke((Action)(() => btnFinalizar_Click(btnFinalizar, ee)));
                                //pnlNiveles.Invoke((Action)(() => llenaPanelNiv(tr)));
                            }
                            break;
                        }
                    }
                    if (cierre == true)
                    {
                        break;
                    }
                }
                //MessageBox.Show("Lectura Finalizada", "FIN");
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message);
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 4
0
        //Función para la lectura de 1 tag y posicionarlo en el txtTagEPC y la variable tag.
        public void leer_tag()
        {
            try {
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        int contador = 0;
                        foreach (Tag eti in reader.Tags)
                        {
                            if (contador == 0)
                            {
                                //Ptone1.Play();
                                if (txtEPC.InvokeRequired)
                                {
                                    txtEPC.Invoke((Action)(() => txtEPC.Text = eti.ToString()));
                                    tag = eti.ToString();
                                }
                                //Ptone2.Play();
                                RFID = false;
                                if (btnLeer.InvokeRequired)
                                {
                                    btnLeer.Invoke((Action)(() => btnLeer.Visible = true));
                                    btnLeer.Invoke((Action)(() => btnLeer.Enabled = true));
                                }

                                if (lblStatus.InvokeRequired)
                                {
                                    lblStatus.Invoke((Action)(() => lblStatus.Text = "Tag leído."));
                                }
                                if (btnMover.InvokeRequired)
                                {
                                    btnMover.Invoke((Action)(() => btnMover.Focus()));
                                }
                            }
                            contador++;
                            break;
                        }
                    }
                }
            } catch (ObjectDisposedException odex) {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            } catch (ThreadAbortException ex) {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            } catch (Exception eex) {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 读取数据 达州
        /// </summary>
        /// <param name="strPort"></param>
        /// <param name="nBaudrate"></param>
        /// <param name="errString"></param>
        /// <returns></returns>
        //public List<string> LoadTagList(string strPort, int nBaudrate, out string errString)
        //{
        //    List<string> listRfid = new List<string>();
        //    errString = string.Empty;
        //    string[] MyTagList = new string[100];
        //    try
        //    {
        //        brdr = new BRIReader(null, "SERIAL://" + strPort);
        //        DateTime now = DateTime.Now;
        //        do
        //        {
        //            bool state = brdr.Read();
        //            if (brdr.TagCount > 0)
        //            {
        //                foreach (Tag tt in brdr.Tags)
        //                {
        //                    listRfid.Add(tt.ToString());
        //                    //MyTagList[++iTagCount] = tt.ToString();
        //                    //if (tt.TagFields.ItemCount > 0)
        //                    //{
        //                    //    foreach (TagField tf in tt.TagFields.FieldArray)
        //                    //    {
        //                    //        if (tf.Status < 0)
        //                    //        {
        //                    //            //code to handle read or write error on this field
        //                    //        }
        //                    //        else
        //                    //        {
        //                    //            //get field data such as ANT, COUNT, TIME, AFI, etc.
        //                    //            MyTagList[iTagCount] += " " + tf.ToString();
        //                    //        }
        //                    //    }
        //                    //}
        //                    //listRfid.Add(MyTagList[iTagCount]);
        //                }
        //            }
        //            if (listRfid.Count != 0)//读取到数据就跳出
        //            {
        //                break;
        //            }
        //        } while (((TimeSpan)(DateTime.Now - now)).TotalSeconds < 8);//5秒后无数据就返回
        //        brdr.Dispose();
        //        // this.CloseCom();
        //        return listRfid;
        //    }
        //    catch (Exception e)
        //    {
        //        brdr.Dispose();
        //        throw new Exception("错误:" + e.Message + "," + errString + ",数据:" + listRfid.ToArray());
        //    }
        //}

        public List <string> LoadTagList(string strPort, int nBaudrate, out string errString)
        {
            List <string> listRfid = new List <string>();

            errString = string.Empty;
            string[] MyTagList = new string[100];
            try
            {
                brdr = new BRIReader(null, "SERIAL://" + strPort);
            }
            catch (Exception ex)
            {
                THOKUtil.ShowError("BRIReader读取串口 [ " + strPort + " ] 失败!" + "内部:" + ex.Message);
                //throw new Exception("BRI读取串口:" + ex.Message);
                return(null);
            }
            try
            {
                DateTime now = DateTime.Now;
                do
                {
                    bool state = brdr.Read();
                    if (brdr.TagCount > 0)
                    {
                        foreach (Tag tt in brdr.Tags)
                        {
                            listRfid.Add(tt.ToString());
                        }
                    }
                    if (listRfid.Count != 0)//读取到数据就跳出
                    {
                        break;
                    }
                }while (((TimeSpan)(DateTime.Now - now)).TotalSeconds < 8);//5秒后无数据就返回
                brdr.Dispose();
                return(listRfid);
            }
            catch (Exception e)
            {
                brdr.Dispose();
                THOKUtil.ShowError("方法LoadTagList错误:" + e.Message + "," + errString + ",数据:" + listRfid.ToArray());
                return(null);
            }
        }
Esempio n. 6
0
        public void leer_tag()
        {
            bool cierre = false;

            string[] booya = getEPCS();
            try
            {
                // MessageBox.Show("Lectura Iniciada", "INICIO");
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        foreach (Tag eti in reader.Tags)
                        {
                            //Ptone1.Play();
                            string tag = eti.ToString();
                            for (int x = 0; x < booya.Length; x++)
                            {
                                if (!epcs.Contains(tag))
                                {
                                    if (tag.Equals(booya[x]))
                                    {
                                        epcs.Add(tag);
                                        cierre = true;
                                        Ptone1.Play();
                                        lectura = ws.detalleEscuadra(tag);
                                        epc     = tag;
                                        if (dataGrid1.InvokeRequired)
                                        {
                                            dataGrid1.Invoke((Action)(() => fillDataGrid()));
                                            btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                        }
                                        break;
                                    }
                                    else
                                    {
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                    if (cierre == true)
                    {
                        break;
                    }
                }
                //MessageBox.Show("Lectura Finalizada", "FIN");
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message);
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 7
0
        public void leer_tag()
        {
            bool cierre = false;

            try
            {
                // MessageBox.Show("Lectura Iniciada", "INICIO");
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        foreach (Tag eti in reader.Tags)
                        {
                            Ptone1.Play();
                            if (epcs.Contains(eti.ToString()) == false)
                            {
                                if (epcsNo.Contains(eti.ToString()) == false)
                                {
                                    epcsNo.Add(eti.ToString());
                                }
                            }
                            for (int i = 0; i < lstSerie.Items.Count; i++)
                            {
                                DataRowView dr  = lstSerie.Items[i] as DataRowView;
                                String      tmp = dr[1].ToString();
                                if (tmp.Equals(eti.ToString()))
                                {
                                    articuloEpc = eti.ToString();
                                    //update_SDF();
                                    if (pnlDetalles.InvokeRequired)
                                    {
                                        pnlDetalles.Invoke((Action)(() => update_SDF()));
                                    }
                                    //ANterior
                                    //this.button3.Click += new EventHandler(button3_Click);
                                    //cierre = true;
                                    //if (pnlDetalles.InvokeRequired)
                                    //{
                                    //    pnlDetalles.Invoke((Action)(() => llenaPanelDet(articuloEpc)));
                                    //    pnlDetalles.Invoke((Action)(() => button3_Click(this.button3, ee)));
                                    //}
                                    break;
                                }
                            }
                            if (cierre == true)
                            {
                                break;
                            }
                        }
                    }
                }
                //MessageBox.Show("Lectura Finalizada", "FIN");
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                //button3_Click(this.button3, ee);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
        public void leer_tag()
        {
            int calculo;

            string[]      parametros = cm.getParametros("Solutia");
            SqlConnection conn       = new SqlConnection("Data Source=" + parametros[1] + "; Initial Catalog=" + parametros[4] + "; Persist Security Info=True; User ID=" + parametros[2] + "; Password="******"");
            SqlCommand    cmd        = new SqlCommand();

            cmd.Connection = conn;

            estimada = cr.cantidad(tipoRack, codigo);
            total    = cr.cantidadReal(op, racksCalculados, codigo, renglon, lote);
            //PONER BIEN LA VALIDACION PARA QUE PASE DE RACK EN RACK LA CANTIDAD CORRECTA
            //calculo = Convert.ToInt32(racksCalculados);
            if (estimada <= total)
            {
                estimada = cr.cantidad(tipoRack, codigo);
            }
            else if (total < estimada)
            {
                estimada = total;
            }

            try
            {
                while (RFID == true)
                {
                    for (int posActual = 0; posActual < racksFaltantes; posActual++)
                    {
                        if (opcion == false)
                        {
                            reader.Read();
                            if (reader.TagCount > 0)
                            {
                                foreach (Tag eti in reader.Tags)
                                {
                                    Ptone1.Play();
                                    epc       = eti.ToString();
                                    validaEPC = cr.validaEPC(epc, tipoRack);
                                    if (validaEPC == true)
                                    {
                                        updateR        = cr.RealUpdate(op, estimada, tipoRack, codigo, renglon, epc, total, lote, cantidadParcialidad, newId);
                                        pedido         = cr.cantidadReal(op, racksCalculados, codigo, renglon, lote);
                                        RacksAsignados = cr.RacksAsignados(op, pedido, codigo, renglon, lote);
                                        numRacks       = (RacksAsignados + 1);
                                        total          = cr.cantidadReal(op, racksCalculados, codigo, renglon, lote);
                                        conteoRacks    = cr.contRAcksAsign(op, total, codigo, renglon, numRacks, lote);

                                        RFID = false;

                                        if (lblRacksAsignados.InvokeRequired)
                                        {
                                            lblRacksAsignados.Invoke((Action)(() => lblRacksAsignados.Text = "Racks Asignados: " + numRacks + ""));
                                        }

                                        if (btnConectar.InvokeRequired)
                                        {
                                            btnConectar.Invoke((Action)(() => btnConectar.Visible = true));
                                            btnConectar.Invoke((Action)(() => btnConectar.Enabled = true));
                                        }
                                        //if (btnLeer.InvokeRequired)
                                        //{
                                        //    btnLeer.Invoke((Action)(() => btnLeer.Visible = true));
                                        //    btnLeer.Invoke((Action)(() => btnLeer.Enabled = true));
                                        //}

                                        if (lblEstatus.InvokeRequired)
                                        {
                                            lblEstatus.Invoke((Action)(() => lblEstatus.Text = "Rack Asignado Correctamente"));
                                        }

                                        if (btnCalcula.InvokeRequired)
                                        {
                                            btnCalcula.Invoke((Action)(() => btnCalcula_Click(btnCalcula, ee)));
                                        }
                                        opcion = true;
                                        break;
                                    }
                                    else
                                    {
                                        if (btnValidaciones.InvokeRequired)
                                        {
                                            btnValidaciones.Invoke((Action)(() => btnValidaciones_Click(btnValidaciones, ee)));
                                            RFID = false;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                }
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 9
0
        //HASTA AQUI
        public void leer_tag()
        {
            bool cierre = false;

            try
            {
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        foreach (Tag eti in reader.Tags)
                        {
                            Ptone1.Play();
                            if (lstEpc.InvokeRequired)
                            {
                                lstEpc.Invoke((Action)(() => lstEpc.Items.Add(eti)));
                            }
                            if (eti.ToString().Equals(tag))
                            {
                                cierre = true;
                                this.btnDetener.Click += new EventHandler(btnDetener_Click);
                                if (btnDetener.InvokeRequired)
                                {
                                    btnDetener.Invoke((Action)(() => btnDetener_Click(this.btnDetener, ee)));
                                }
                                if (lblEstatus.InvokeRequired)
                                {
                                    lblEstatus.Invoke((Action)(() => lblEstatus.Text = "Tag Encontrado!!"));
                                }
                                for (int x = 0; x < 5; x++)
                                {
                                    Ptone2.Play();
                                }
                            }
                            if (cierre == true)
                            {
                                break;
                            }
                        }
                    }
                }
                if (cierre == false)
                {
                    if (lblEstatus.InvokeRequired)
                    {
                        lblEstatus.Invoke((Action)(() => lblEstatus.Text = "Lectura Finalizada"));
                    }
                }
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 10
0
 /// <summary>
 /// 读取数据 达州
 /// </summary>
 /// <param name="strPort"></param>
 /// <param name="nBaudrate"></param>
 /// <param name="errString"></param>
 /// <returns></returns>
 //public List<string> LoadTagList(string strPort, int nBaudrate, out string errString)
 //{
 //    List<string> listRfid = new List<string>();
 //    errString = string.Empty;
 //    string[] MyTagList = new string[100];
 //    try
 //    {
 //        brdr = new BRIReader(null, "SERIAL://" + strPort);
 //        DateTime now = DateTime.Now;
 //        do
 //        {
 //            bool state = brdr.Read();
 //            if (brdr.TagCount > 0)
 //            {
 //                foreach (Tag tt in brdr.Tags)
 //                {
 //                    listRfid.Add(tt.ToString());
 //                    //MyTagList[++iTagCount] = tt.ToString();
 //                    //if (tt.TagFields.ItemCount > 0)
 //                    //{
 //                    //    foreach (TagField tf in tt.TagFields.FieldArray)
 //                    //    {
 //                    //        if (tf.Status < 0)
 //                    //        {
 //                    //            //code to handle read or write error on this field
 //                    //        }
 //                    //        else
 //                    //        {
 //                    //            //get field data such as ANT, COUNT, TIME, AFI, etc.
 //                    //            MyTagList[iTagCount] += " " + tf.ToString();
 //                    //        }
 //                    //    }
 //                    //}
 //                    //listRfid.Add(MyTagList[iTagCount]);
 //                }
 //            }
 //            if (listRfid.Count != 0)//读取到数据就跳出
 //            {
 //                break;
 //            }
 //        } while (((TimeSpan)(DateTime.Now - now)).TotalSeconds < 8);//5秒后无数据就返回
 //        brdr.Dispose();
 //        // this.CloseCom();
 //        return listRfid;
 //    }
 //    catch (Exception e)
 //    {
 //        brdr.Dispose();
 //        throw new Exception("错误:" + e.Message + "," + errString + ",数据:" + listRfid.ToArray());
 //    }
 //}
 public List<string> LoadTagList(string strPort, int nBaudrate, out string errString)
 {
     List<string> listRfid = new List<string>();
     errString = string.Empty;
     string[] MyTagList = new string[100];
     try
     {
         brdr = new BRIReader(null, "SERIAL://" + strPort);
     }
     catch (Exception ex)
     {
         THOKUtil.ShowError("BRIReader读取串口 [ " + strPort + " ] 失败!" + "内部:" + ex.Message);
         //throw new Exception("BRI读取串口:" + ex.Message);
         return null;
     }
     try
     {
         DateTime now = DateTime.Now;
         do
         {
             bool state = brdr.Read();
             if (brdr.TagCount > 0)
             {
                 foreach (Tag tt in brdr.Tags)
                 {
                     listRfid.Add(tt.ToString());
                 }
             }
             if (listRfid.Count != 0)//读取到数据就跳出
             {
                 break;
             }
         }
         while (((TimeSpan)(DateTime.Now - now)).TotalSeconds < 8);//5秒后无数据就返回
         brdr.Dispose();
         return listRfid;
     }
     catch (Exception e)
     {
         brdr.Dispose();
         THOKUtil.ShowError("方法LoadTagList错误:" + e.Message + "," + errString + ",数据:" + listRfid.ToArray());
         return null;
     }
 }
        public void leer_tag()
        {
            bool cierre = false;

            string[] booya = getEPCS();
            try
            {
                // MessageBox.Show("Lectura Iniciada", "INICIO");
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        foreach (Tag eti in reader.Tags)
                        {
                            //Ptone1.Play();
                            string tag = eti.ToString();
                            for (int x = 0; x < booya.Length; x++)
                            {
                                if (!epcs.Contains(tag))
                                {
                                    if (tag.Equals(booya[x]))
                                    {
                                        cierre = true;
                                        epcs.Add(tag);
                                        Ptone1.Play();
                                        if (noRack == 1)
                                        {
                                            //if (ws.ubicaEscuadra(epcEscuadra, codigoProd, cantProd.ToString(), tag, bandera, 1) == 0)//int.Parse(zr[1]) se quito JLMQ
                                            //{
                                            //    if (dataGrid1.InvokeRequired)
                                            //    {

                                            //        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                            //        dataGrid1.Invoke((Action)(() => fillDataGrid()));
                                            //        btnFinalizar.Invoke((Action)(() => btnFinalizar_Click(btnFinalizar, ee)));
                                            //    }
                                            //    break;
                                            //}
                                            //else
                                            //{
                                            //    MessageBox.Show("Hubo un problema durante la asignación. Por favor intentelo nuevamente.");
                                            //    if (dataGrid1.InvokeRequired)
                                            //    {
                                            //        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                            //        epcs.Remove(tag);
                                            //    }
                                            //}
                                        }
                                        else
                                        {
                                            //if (ws.ubicaEscuadra(epcEscuadra, codigoProd, cantProd.ToString(), tag, bandera, 0) == 0)//int.Parse(zr[1]) se quito JLMQ
                                            //{
                                            //    if (dataGrid1.InvokeRequired)
                                            //    {

                                            //        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                            //        dataGrid1.Invoke((Action)(() => fillDataGrid()));
                                            //        btnFinalizar.Invoke((Action)(() => btnFinalizar_Click(btnFinalizar, ee)));
                                            //    }
                                            //    break;
                                            //}
                                            //else
                                            //{
                                            //    MessageBox.Show("Hubo un problema durante la asignación. Por favor intentelo nuevamente.");
                                            //    if (dataGrid1.InvokeRequired)
                                            //    {
                                            //        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                            //        epcs.Remove(tag);
                                            //    }
                                            //}
                                        }
                                    }
                                    else
                                    {
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                    if (cierre == true)
                    {
                        break;
                    }
                }
                //MessageBox.Show("Lectura Finalizada", "FIN");
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 12
0
        public void leer_tag()
        {
            bool cierre = false;

            string[] booya = cm.getEpcEsc(remi, codigo);
            if (booya != null)
            {
                try
                {
                    while (RFID == true)
                    {
                        reader.Read();
                        if (reader.TagCount > 0)
                        {
                            foreach (Tag eti in reader.Tags)
                            {
                                string tag = eti.ToString();
                                for (int x = 0; x < booya.Length; x++)
                                {
                                    if (!epcs.Contains(tag))
                                    {
                                        if (tag.Equals(booya[x]))
                                        {
                                            epcs.Add(tag);//AQUI AGREGAR FUNCIONALIDAD DE CICLAR LAS ESCUADRAS HASTA QUE SE CUMPLA EL TOTAL DE PZAS DE UNA REMISION
                                            cierre = true;
                                            Ptone1.Play();
                                            bool UpdtNewEsc = false;
                                            UpdtNewEsc = cm.ActualizaEscInvInicial(codigo, pzaRemi, tag);
                                            if (UpdtNewEsc == true)
                                            {
                                                //lectura = cm.detalleEscuadra(tag);
                                                epc = tag;
                                                if (dataGrid1.InvokeRequired)
                                                {
                                                    cierre = false;
                                                    MessageBox.Show("Se desconto la cantidad en la escudra de inventario inicial", "EXITO");
                                                    menuItem2.Enabled = true;
                                                    dataGrid1.Invoke((Action)(() => fillDataGrid()));
                                                    btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                                }
                                                break;
                                            }
                                        }
                                        else
                                        {
                                        }
                                    }
                                    else
                                    {
                                    }
                                }
                                break;
                            }
                        }
                        if (cierre == true)
                        {
                            break;
                        }
                    }
                }
                catch (ObjectDisposedException odex)
                {
                    MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
                catch (ThreadAbortException ex)
                {
                    MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
                catch (Exception eex)
                {
                    MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                RFID = false;
                MessageBox.Show("No hay escuadras disponibles para este producto", "Alerta");
                this.Close();
            }
        }
Esempio n. 13
0
        public void leer_tag()
        {
            bool cierre = false;

            string[] booya = getEPCS();
            try
            {
                // MessageBox.Show("Lectura Iniciada", "INICIO");//VERIFICAR ESTE PUTO METODO QUE DUPLICO LECTURA HE HIZO 2 VECES UPDATE
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        foreach (Tag eti in reader.Tags)
                        {
                            //Ptone1.Play();
                            string tag = eti.ToString();
                            for (int x = 0; x < booya.Length; x++)
                            {
                                if (!epcs.Contains(tag))
                                {
                                    if (tag.Equals(booya[x]))
                                    {
                                        cierre = true;
                                        epcs.Add(tag);
                                        Ptone1.Play();
                                        noRack = 1;
                                        if (noRack == 1)
                                        {
                                            if (RFID == true)
                                            {
                                                int idtag = 4;//se puso esto para que compilara 19nov2019


                                                if (ws.ubicaEscuadra(idtag, detalle, UbicacionAlm)) //epcEscuadra, codigoProd, cantProd.ToString(), tag, bandera, 1) == 0)//int.Parse(zr[1]) se quito JLMQ
                                                {
                                                    if (dataGrid1.InvokeRequired)
                                                    {
                                                        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                                        dataGrid1.Invoke((Action)(() => fillDataGrid()));
                                                        btnFinalizar.Invoke((Action)(() => btnFinalizar_Click(btnFinalizar, ee)));
                                                        RFID   = false;
                                                        cierre = false;
                                                        break;
                                                    }
                                                    //break;
                                                }
                                                else
                                                {
                                                    MessageBox.Show("Hubo un problema durante la asignación. Por favor intentelo nuevamente.");
                                                    if (dataGrid1.InvokeRequired)
                                                    {
                                                        btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                                        epcs.Remove(tag);
                                                        RFID   = false;
                                                        cierre = false;
                                                    }
                                                }
                                            }
                                            RFID   = false;
                                            cierre = false;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                    if (cierre == true)//estaba true
                    {
                        break;
                    }
                }
            }
            catch (ObjectDisposedException odex)
            {
                //MessageBox.Show(odex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (ThreadAbortException ex)
            {
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 14
0
        public void leer_tag()
        {
            //bool cierre = false;
            string[] booya    = getEPCS();
            int      posicion = 0;

            try
            {
                // MessageBox.Show("Lectura Iniciada", "INICIO");
                while (RFID == true)
                {
                    reader.Read();
                    if (reader.TagCount > 0)
                    {
                        bool cierre = false;
                        foreach (Tag eti in reader.Tags)
                        {
                            if (cierre)
                            {
                                break;
                            }

                            //dtRemi2 = cm.InfoRemision(remi);
                            //numProdRemi = dtRemi2.Rows.Count;
                            string tag = eti.ToString();
                            //for (int x = 0; x < numProdRemi; x++)
                            for (int x = 0; x < booya.Length; x++)
                            {
                                if (!epcs.Contains(tag))
                                {
                                    if (tag.Equals(booya[x]))
                                    {
                                        epece = tag;
                                        epcs.Add(epece);

                                        Ptone1.Play();
                                        //result = cm.verificarEscuadra(epece, folios[1], folios[8], pxt, folios[12]);
                                        //string pedidoOrigen = cm.getPedidoRemision(remi);
                                        //string codigoprod = cm.getcodiremi(remi);
                                        //result = cm.asignaEscuadraFisica(epece, qtyTarima, completo, remi, pos, codigoprod, pedidoOrigen, remision);
                                        dtRemi  = cm.remiforescvirtual(remi, ArtRemision);//ESTA USAR EN NUEVA FUNCIONALIDAD
                                        dtRemi2 = cm.InfoRemision(remi);
                                        //posicionEsc = Convert.ToInt32(ubicacion);
                                        newid  = cm.newIdEscVirtual(remi, ArtRemision, pzaArtRemi);
                                        result = cm.remiEscuadraVirtual(epece, dtRemi, posicion, newid);//ESTA USAR EN NUEVA FUNCIONALIDAD
                                        //updateDetremision = cm.updateDetremi(remi, ArtRemision);//ESTA USAR EN NUEVA FUNCIONALIDAD
                                        posicion++;

                                        if (posicion >= dtRemi2.Rows.Count)
                                        {
                                            MessageBox.Show("SE ASIGNARON LAS ESCUADRAS PARA TODOS LOS ARTICULOS DE LA REMISION '" + remi + "'", "EXITO");
                                            comboArticulo.Invoke((Action)(() => comboArticulo.Enabled = true));
                                            btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                            btnSalir.Invoke((Action)(() => btnSalir_Click(btnSalir, ee)));
                                            cierre = true;
                                            RFID   = false;
                                            break;
                                        }
                                        else
                                        {
                                            btnDetener.Invoke((Action)(() => btnDetener_Click(btnDetener, ee)));
                                            comboArticulo.Invoke((Action)(() => comboArticulo.Enabled = true));
                                            MessageBox.Show("Escuadra Asignada para '" + ArtRemision + "'", "EXITO");
                                            txtPza.Invoke((Action)(() => txtPza.Text = ""));
                                            cierre = true;
                                            break;
                                            //dataGrid1.Invoke((Action)(() => fillDataGridEsc()));
                                        }
                                        //break;//de aqui regresa al foreach despues de que asigno la escuadra virtual
                                    }
                                    else
                                    {
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                        //if (cierre == true)
                        break;
                        Cursor.Current = Cursors.Default;
                    }
                }
            }

            catch (ObjectDisposedException odex)
            {
                Cursor.Current = Cursors.Default;
                elimina        = cm.deleteRemision(remi);
            }
            catch (ThreadAbortException ex)
            {
                Cursor.Current = Cursors.Default;
                elimina        = cm.deleteRemision(remi);
                MessageBox.Show(ex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            catch (Exception eex)
            {
                Cursor.Current = Cursors.Default;
                elimina        = cm.deleteRemision(remi);
                MessageBox.Show(eex.Message, "Error de lectura.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }