コード例 #1
0
ファイル: FrmDevolucion.cs プロジェクト: JCMDIAZ/SWYRA
 private void txtCodigo_LostFocus(object sender, EventArgs e)
 {
     if (txtCodigo.Text == "")
     {
         return;
     }
     lastCB        = txtCodigo.Text;
     txtCant.Value = 1;
     txtDescr.Text = "";
     try
     {
         var str   = txtCodigo.Text.Split('-');
         var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " +
                     "WHERE CODIGO_BARRA = '" + str[0] + "'";
         cod = Program.GetDataTable(query, 2).ToData <CodigosBarra>();
         if (str.Length == 2)
         {
             //txtCodigo.Text = str[0];
             cod.cant_piezas = Convert.ToInt32(str[1]);
         }
         if (cod != null && str.Length <= 2)
         {
             var tot = det.Count(o => o.codigo_barra == txtCodigo.Text);
             if (tot == 0)
             {
                 MessageBox.Show(@"Artículo no registrado en la lista del surtido", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                 txtCodigo.Focus();
             }
             else if (tot >= 1)
             {
                 txtCant.ReadOnly = true; // !(cod.cant_piezas == 1);
                 txtCant.Value    = cod.cant_piezas;
                 art           = det.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false));
                 art.cant      = art.cant - cod.cant_piezas;
                 art.cancelado = (art.cant <= 0);
                 actualizaDet();
                 if (cod.cant_piezas == 1)
                 {
                     txtCant.Focus();
                 }
             }
         }
         else
         {
             MessageBox.Show(@"Código de Barra INEXISTENTE, favor de validar.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
     }
     if (txtCant.ReadOnly)
     {
         txtCodigo.Text = "";
         txtCodigo.Focus();
     }
 }
コード例 #2
0
 private void txtCodigo_LostFocus(object sender, EventArgs e)
 {
     if (txtCodigo.Text == "")
     {
         return;
     }
     txtCant.Value = 1;
     try
     {
         var str   = txtCodigo.Text.Split('-');
         var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " +
                     "WHERE CODIGO_BARRA = '" + str[0] + "'";
         cod = Program.GetDataTable(query, 2).ToData <CodigosBarra>();
         if (cod != null)
         {
             if (str.Length == 2)
             {
                 //txtCodigo.Text = str[0];
                 cod.cant_piezas = Convert.ToInt32(str[1]);
             }
             if (str.Length <= 2)
             {
                 var tot = det.Count(o => o.codigo_barra == txtCodigo.Text);
                 if (tot == 0)
                 {
                     MessageBox.Show(@"Artículo no registrado en la lista del surtido", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                     txtCodigo.Focus();
                 }
                 else
                 {
                     //txtCant.ReadOnly = !(cod.cant_piezas == 1);
                     txtCant.Value = cod.cant_piezas;
                     if (proceso == "EMP")
                     {
                         art = det.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false) && (o.consec_padre == null || o.consec_padre == 0));
                     }
                     else
                     {
                         art = det.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false) && o.consec_padre == ped.consec);
                     }
                     if (art == null)
                     {
                         if (proceso == "EMP")
                         {
                             MessageBox.Show(@"Artículo ya empaquetado favor de validar", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                         }
                         else
                         {
                             MessageBox.Show(@"Artículo no empaquetado en esta " + ped.tipopaquete + " favor de validar", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                         }
                         txtCodigo.Focus();
                     }
                     else
                     {
                         art.consec_padre = (proceso == "EMP") ? ped.consec : 0;
                         actualizaDet();
                         //if (cod.cant_piezas == 1) { txtCant.Focus(); }
                     }
                 }
             }
         }
         else
         {
             var msj = @"Código de Barra INEXISTENTE, favor de validar.";
             MessageBox.Show(msj, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
     }
     if (txtCant.ReadOnly)
     {
         txtCant.Value  = 1;
         txtCodigo.Text = "";
         txtCodigo.Focus();
     }
 }
コード例 #3
0
ファイル: FrmCancelacion.cs プロジェクト: JCMDIAZ/SWYRA
 private void txtCodigo_LostFocus(object sender, EventArgs e)
 {
     if (txtCodigo.Text == "")
     {
         return;
     }
     lastCB        = txtCodigo.Text;
     txtCant.Value = 1;;
     try
     {
         var str   = txtCodigo.Text.Split('-');
         var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " +
                     "WHERE CODIGO_BARRA = '" + str[0] + "'";
         cod = Program.GetDataTable(query, 1).ToData <CodigosBarra>();
         if (str.Length == 2)
         {
             txtCodigo.Text  = str[0];
             cod.cant_piezas = Convert.ToInt32(str[1]);
         }
         if (cod != null && str.Length <= 2)
         {
             try
             {
                 if (art.cve_art != cod.cve_art)
                 {
                     MessageBox.Show(@"Código NO coincide con el artículo a devolver", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                 }
                 else
                 {
                     var tot = detmerc.Count(o => o.codigo_barra == txtCodigo.Text);
                     if (tot == 0)
                     {
                         MessageBox.Show(@"Artículo no registrado en la lista del surtido", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                         txtCodigo.Focus();
                     }
                     else if (tot >= 1)
                     {
                         txtCant.Value = cod.cant_piezas;
                         mrc           = detmerc.Find(o => o.codigo_barra == txtCodigo.Text && (o.cancelado == null || o.cancelado == false));
                         if (mrc.presentacion >= maxvalue)
                         {
                             mrc.cant      = mrc.cant - cod.cant_piezas;
                             mrc.cancelado = (mrc.cant <= 0);
                             actualizaDet();
                         }
                         else
                         {
                             MessageBox.Show(@"Favor de quitar primero el de mayor presentación.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                             txtCodigo.Focus();
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(@"Artículo NO ASIGNADO al pedido.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
             }
         }
         else
         {
             MessageBox.Show(@"Código de Barra INEXISTENTE, favor de validar.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
     }
     if (txtCant.ReadOnly)
     {
         txtCodigo.Text = "";
         txtCodigo.Focus();
     }
 }
コード例 #4
0
ファイル: FrmSurtit.cs プロジェクト: JCMDIAZ/SWYRA
 private void txtCodigo_LostFocus(object sender, EventArgs e)
 {
     if (txtCodigo.Text == "")
     {
         return;
     }
     lastCB        = txtCodigo.Text;
     txtCant.Value = 1;;
     try
     {
         var str   = txtCodigo.Text.Split('-');
         var query = "SELECT CVE_ART, CANT_PIEZAS, CODIGO_BARRA FROM vw_codigosBarras " +
                     "WHERE CODIGO_BARRA = '" + str[0] + "'";
         cod = Program.GetDataTable(query, 1).ToData <CodigosBarra>();
         if (str.Length == 2)
         {
             txtCodigo.Text  = str[0];
             cod.cant_piezas = Convert.ToInt32(str[1]);
         }
         if (cod != null && str.Length <= 2)
         {
             try
             {
                 if (art.cve_art != cod.cve_art)
                 {
                     MessageBox.Show(@"Código NO coincide con el artículo a surtir", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                 }
                 else
                 {
                     if (cod.cant_piezas > art.exist)
                     {
                         MessageBox.Show(@"Artículo NO HAY EN EXISTENCIA.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                     }
                     else
                     {
                         DialogResult drm = DialogResult.OK;
                         if (cod.cant_piezas > art.cantdiferencia)
                         {
                             var res = "La Presentación del artículo (" + art.cve_art + ") " + art.descr + " excede a la cantidad por surtir. Favor de validar con el ANALISTA DE VENTAS.";
                             MessageBox.Show(res, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                             drm = DialogResult.No;
                         }
                         if (drm == DialogResult.OK)
                         {
                             if (art.exist > art.mas && art.cantdiferencia >= art.mas && cod.cant_piezas < art.mas)
                             {
                                 MessageBox.Show(@"Presentación del artículo debe ser mayor o igual al MASTER.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                             } /*else if (art.exist > art.min && cod.cant_piezas < art.min)
                                * {
                                * MessageBox.Show(@"Presentación del artículo debe ser mayor o igual al MINIMO REQUERIDO DE VENTA.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                                * }*///20181128 Solicitado por HERMINSA Zanabria y diana
                             else
                             {
                                 DialogResult dr = DialogResult.Cancel;
                                 if (art.lin_prod.Contains("EXHIB"))
                                 {
                                     FrmSurtir2 frmConf1 = new FrmSurtir2();
                                     dr = frmConf1.ShowDialog();
                                     frmConf1.Close();
                                 }
                                 if (art.aplicalote)
                                 {
                                     FrmSurtir3 frmConf2 = new FrmSurtir3();
                                     frmConf2.ShowDialog();
                                     Lote = frmConf2.txtLote.Text;
                                     frmConf2.Close();
                                 }
                                 //txtCant.ReadOnly = !(cod.cant_piezas == 1 || dr == DialogResult.Cancel);
                                 txtCant.Value = cod.cant_piezas;
                                 actualizaDet();
                                 //if (cod.cant_piezas == 1) { txtCant.Focus(); }
                             }
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(@"Artículo NO ASIGNADO al pedido.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
             }
         }
         else
         {
             MessageBox.Show(@"Código de Barra INEXISTENTE, favor de validar.", "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "SWYRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
     }
     if (txtCant.ReadOnly)
     {
         txtCodigo.Text = "";
         txtCodigo.Focus();
     }
 }