예제 #1
0
 private void afterGrava()
 {
     if (pnl_Pecas.validarCampoObrigatorio())
     {
         if (St_obrigaCusto && !pSt_servico && vl_custo.Value.Equals(decimal.Zero))
         {
             MessageBox.Show("Obrigatorio informar custo!", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             vl_custo.Focus();
             return;
         }
         if (string.IsNullOrEmpty(CD_Produto.Text) &&
             string.IsNullOrEmpty(DS_Produto.Text))
         {
             MessageBox.Show("Obrigatorio informar peça/serviço.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CD_Produto.Focus();
             return;
         }
         if ((!st_servico.Checked) &&
             (!string.IsNullOrEmpty(CD_Produto.Text)) &&
             string.IsNullOrEmpty(CD_Local.Text) && !St_consumoInterno)
         {
             MessageBox.Show("Obrigatorio informar local armazenagem da peça.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CD_Local.Focus();
             return;
         }
         DialogResult = DialogResult.OK;
     }
 }
예제 #2
0
 private void afterGrava()
 {
     if (string.IsNullOrEmpty(DT_Lancamento.Text) || (DT_Lancamento.Text.Trim().Equals("/  /")))
     {
         MessageBox.Show("Obrigatorio informar data lançamento.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         DT_Lancamento.Focus();
         return;
     }
     if (string.IsNullOrEmpty(CD_Local.Text))
     {
         MessageBox.Show("Obrigatorio informar local de armazenagem.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Local.Focus();
         return;
     }
     if (tp_movimento.Text.Trim().ToUpper().Equals("ENTRADA") && Qtd_Entrada.Value.Equals(0))
     {
         MessageBox.Show("Obrigatorio informar quantidade de entrada.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Qtd_Entrada.Focus();
         return;
     }
     if (tp_movimento.Text.Trim().ToUpper().Equals("SAIDA") && Qtd_Saida.Value.Equals(0))
     {
         MessageBox.Show("Obrigatorio informar quantidade de saida.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Qtd_Saida.Focus();
         return;
     }
     if (VL_Unitario.Value.Equals(0))
     {
         MessageBox.Show("Obrigatorio informar valor unitario.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         VL_Unitario.Focus();
         return;
     }
     this.DialogResult = DialogResult.OK;
 }
예제 #3
0
 private void CD_Produto_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode.Equals(Keys.Enter))
     {
         BuscarProduto();
         CD_Local.Focus();
     }
 }
예제 #4
0
 private void CD_Local_EnabledChanged(object sender, EventArgs e)
 {
     if (!CD_Local.Enabled)
     {
         CD_Local.Clear();
         DS_Local.Clear();
     }
 }
예제 #5
0
 private void LimpaCampos()
 {
     DT_Inicial.Clear();
     DT_Final.Clear();
     id_lanctoestoque.Clear();
     cd_empresa.Clear();
     CD_Produto.Clear();
     CD_Local.Clear();
 }
예제 #6
0
 public override void afterNovo()
 {
     if ((vTP_Modo == TTpModo.tm_busca) || (vTP_Modo == TTpModo.tm_Standby))
     {
         BS_CadLocalArm_X_Empresa.AddNew();
         base.afterNovo();
         if (!CD_Empresa.Focus())
         {
             CD_Local.Focus();
         }
     }
 }
예제 #7
0
 private void afterGrava()
 {
     if (CD_Produto.Text.Trim().Equals(string.Empty))
     {
         MessageBox.Show("Obrigatorio informar produto.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Produto.Focus();
         return;
     }
     if (CD_Local.Text.Trim().Equals(string.Empty))
     {
         MessageBox.Show("Obrigatorio informar local armazenagem.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Local.Focus();
         return;
     }
     if (CD_Unidade.Text.Trim().Equals(string.Empty))
     {
         MessageBox.Show("Obrigatorio informar unidade.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CD_Unidade.Focus();
         return;
     }
     if (Quantidade.Value <= 0)
     {
         MessageBox.Show("Obrigatorio informar quantidade.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Quantidade.Focus();
         return;
     }
     if (Quantidade.Focused)
     {
         (bsFichaTec_MPrima.Current as CamadaDados.Producao.Producao.TRegistro_FichaTec_MPrima).Qtd_produto = Quantidade.Value;
     }
     if (PC_QuebraTecnica.Focused)
     {
         (bsFichaTec_MPrima.Current as CamadaDados.Producao.Producao.TRegistro_FichaTec_MPrima).Pc_quebra_tec = PC_QuebraTecnica.Value;
     }
     bsFichaTec_MPrima.EndEdit();
     this.DialogResult = DialogResult.OK;
 }
예제 #8
0
        private void BuscarProduto()
        {
            TpBusca[] filtro = new TpBusca[1];
            filtro[0].vNM_Campo = "isnull(e.ST_Servico, 'N')";
            filtro[0].vOperador = pSt_servico ? "=" : "<>";
            filtro[0].vVL_Busca = "'S'";
            if (St_consumoInterno)
            {
                Array.Resize(ref filtro, filtro.Length + 1);
                filtro[filtro.Length - 1].vNM_Campo = "isnull(e.ST_consumointerno, 'N')";
                filtro[filtro.Length - 1].vOperador = "=";
                filtro[filtro.Length - 1].vVL_Busca = "'S'";
            }
            TRegistro_CadProduto rProd = null;

            if (string.IsNullOrEmpty(CD_Produto.Text))
            {
                rProd = UtilPesquisa.BuscarProduto(string.Empty,
                                                   CD_Empresa,
                                                   Nm_empresa,
                                                   CD_TabelaPreco,
                                                   new Componentes.EditDefault[] { CD_Produto, DS_Produto },
                                                   filtro);
            }
            else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length)
            {
                rProd = UtilPesquisa.BuscarProduto(CD_Produto.Text,
                                                   CD_Empresa,
                                                   Nm_empresa,
                                                   CD_TabelaPreco,
                                                   new Componentes.EditDefault[] { CD_Produto, DS_Produto },
                                                   filtro);
            }
            else
            {
                Array.Resize(ref filtro, filtro.Length + 2);
                filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')";
                filtro[filtro.Length - 2].vOperador = "<>";
                filtro[filtro.Length - 2].vVL_Busca = "'C'";
                filtro[filtro.Length - 1].vNM_Campo = string.Empty;
                filtro[filtro.Length - 1].vOperador = string.Empty;
                filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + CD_Produto.Text.Trim() + "') or " +
                                                      "(a.Codigo_Alternativo = '" + (CD_Produto.TextOld != null ? CD_Produto.TextOld.ToString() : CD_Produto.Text.Trim()) + "') or " +
                                                      "(exists(select 1 from tb_est_codbarra x " +
                                                      "           where x.cd_produto = a.cd_produto " +
                                                      "           and x.cd_codbarra = '" + CD_Produto.Text.Trim() + "'))";
                TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty);
                if (lProd.Count > 0)
                {
                    rProd = lProd[0];
                }
            }

            if (rProd != null)
            {
                CD_Produto.Text    = rProd.CD_Produto;
                DS_Produto.Text    = rProd.DS_Produto;
                sigla_unidade.Text = rProd.Sigla_unidade;
                DS_Observacao.Text = rProd.DS_Tecnica;
                st_kit.Checked     = rProd.St_composto;
                if ((!st_servico.Checked))
                {
                    //Buscar local armazenagem
                    object obj = new TCD_CadLocalArm().BuscarEscalar(
                        new TpBusca[]
                    {
                        new TpBusca()
                        {
                            vNM_Campo = string.Empty,
                            vOperador = "exists",
                            vVL_Busca = "(select 1 from tb_est_empresa_x_localarm x " +
                                        "where x.cd_local = a.cd_local " +
                                        "and x.cd_empresa = '" + CD_Empresa.Trim() + "')"
                        },
                        new TpBusca()
                        {
                            vNM_Campo = string.Empty,
                            vOperador = "exists",
                            vVL_Busca = "(select 1 from tb_est_localarm_x_produto x " +
                                        "where x.cd_local = a.cd_local " +
                                        "and x.cd_produto = '" + CD_Produto.Text.Trim() + "')"
                        }
                    }, "a.cd_local");
                    if (obj != null)
                    {
                        CD_Local.Text = obj.ToString();
                        CD_Local_Leave(this, new EventArgs());
                        Quantidade.Focus();
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(CD_Local.Text))
                        {
                            CD_Local.Focus();
                        }
                        else
                        {
                            Quantidade.Focus();
                        }
                    }
                }
                if (st_kit.Checked)
                {
                    Height           = 900;
                    Quantidade.Value = 1;
                    try
                    {
                        (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS =
                            TCN_LanServicoPecas.MontarFichaTecOS(CD_Produto.Text,
                                                                 CD_Empresa,
                                                                 Quantidade.Value,
                                                                 null);
                        BS_Pecas.ResetCurrentItem();
                    }
                    catch (Exception ex)
                    { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information); }
                }
                else
                {
                    Height = 456;
                    (BS_Pecas.Current as TRegistro_LanServicosPecas).lFichaTecOS.Clear();
                    BS_Pecas.ResetCurrentItem();
                }
            }
            ConsultaPreco();
        }
예제 #9
0
 private void BuscarProduto()
 {
     TpBusca[] filtro = new TpBusca[0];
     if (string.IsNullOrEmpty(CD_Produto.Text))
     {
         if (UtilPesquisa.BuscarProduto(string.Empty,
                                        string.Empty,
                                        string.Empty,
                                        string.Empty,
                                        new Componentes.EditDefault[] { CD_Produto, DS_Produto },
                                        null) == null)
         {
             MessageBox.Show("Produto não encontrado.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CD_Produto.Clear();
             CD_Produto.Focus();
             return;
         }
     }
     else if (CD_Produto.Text.SoNumero().Trim().Length != CD_Produto.Text.Trim().Length)
     {
         if (UtilPesquisa.BuscarProduto(CD_Produto.Text,
                                        string.Empty,
                                        string.Empty,
                                        string.Empty,
                                        new Componentes.EditDefault[] { CD_Produto, DS_Produto },
                                        null) == null)
         {
             MessageBox.Show("Produto não encontrado.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CD_Produto.Clear();
             CD_Produto.Focus();
             return;
         }
     }
     else
     {
         Array.Resize(ref filtro, filtro.Length + 2);
         filtro[filtro.Length - 2].vNM_Campo = "isnull(a.st_registro, 'A')";
         filtro[filtro.Length - 2].vOperador = "<>";
         filtro[filtro.Length - 2].vVL_Busca = "'C'";
         filtro[filtro.Length - 1].vNM_Campo = string.Empty;
         filtro[filtro.Length - 1].vOperador = string.Empty;
         filtro[filtro.Length - 1].vVL_Busca = "(a.cd_produto like '%" + CD_Produto.Text.Trim() + "') or " +
                                               "(a.Codigo_Alternativo = '" + (CD_Produto.TextOld != null ? CD_Produto.TextOld.ToString() : CD_Produto.Text.Trim()) + "') or " +
                                               "(exists(select 1 from tb_est_codbarra x " +
                                               "           where x.cd_produto = a.cd_produto " +
                                               "           and x.cd_codbarra = '" + CD_Produto.Text.Trim() + "'))";
         TList_CadProduto lProd = new TCD_CadProduto().Select(filtro, 0, string.Empty, string.Empty, string.Empty);
         if (lProd.Count > 0)
         {
             CD_Produto.Text = lProd[0].CD_Produto;
             DS_Produto.Text = lProd[0].DS_Produto;
         }
     }
     if (!string.IsNullOrEmpty(CD_Produto.Text))
     {
         if (!string.IsNullOrEmpty(CD_Local.Text))
         {
             Quantidade.Focus();
         }
         else
         {
             CD_Local.Focus();
         }
     }
 }