private void buy(Person person, Product product) { String response = ""; response = Connect("buy:" + person.id + "=" + product.id); if (response == "debt") { errorTone.Play(); LogInForm logIn = new LogInForm(adminArray); if (logIn.ShowDialog() == DialogResult.OK) { Admin admin = logIn.getSelectedAdmin(); if (admin.pin.Equals(logIn.getPIN())) { //Succes response = Connect("forcebuy:" + person.id + "=" + product.id); statusReport.Text = person.name + " kocht " + product.name; succesTone.Play(); } else { statusReport.Text = "Log In Faaaaal"; errorTone.Play(); } } } else if (response == "succes") { statusReport.Text = person.name + " kocht " + product.name; succesTone.Play(); } }
//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); } }
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); } }
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); } }
//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); } }
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); } }
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(); } }
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); } }
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); } }