예제 #1
0
파일: Imprimir.cs 프로젝트: tidovale/GI
        private void btImpRoteiro_Click(object sender, EventArgs e)
        {
            try
            {
                if (Properties.Settings.Default.ImpressoraRoteiro == "" && Properties.Settings.Default.ImpressoraRoteiro == "")
                {
                    MessageBox.Show("Por favor, configure as impressoras", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    ListOP = op.BuscaOP(tbOP.Text);
                    if (ListOP != null)
                    {
                        GeraEtiquetaOP(Convert.ToInt32(tbOP.Text));
                        ListRoteiroSQL = roteiroSQL.BuscaRoteiro(tbOP.Text);
                        ListProduto    = produto.ListaProduto(ListOP[0].CodProduto.ToString());

                        for (var i = 0; i < ListRoteiroSQL.Count; i++)
                        {
                            GeraEtiquetaRoteiro(Convert.ToInt32(ListRoteiroSQL[i].IdRoteiro));
                        }

                        pdOpRoteiro.PrinterSettings.PrinterName = Properties.Settings.Default.ImpressoraRoteiro;
                        pdOpRoteiro.PrintPage += pdOpRoteiro_PrintPage;
                        pdOpRoteiro.Print();

                        DeletaImagens();
                    }
                    else
                    {
                        MessageBox.Show("OP não encontrada", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        tbOP.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                log.Tipo       = "Erro";
                log.Local      = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Login      = usuario;
                log.Computador = Environment.MachineName.ToString();
                log.Mensagem   = ex.Message;
                ListLog.Add(log);
                log.GravaLog(ListLog);
                MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 private void tbNumOP_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(tbNumOP.Text))
         {
             if (tbNumOP.TextLength == 8)
             {
                 ListOP = op.BuscaOP(tbNumOP.Text);
                 if (ListOP != null)
                 {
                     lbCodProduto.Text   = ListOP[0].CodProduto.ToString();
                     ListProduto         = produto.ListaProduto(ListOP[0].CodProduto.ToString());
                     lbDescProd.Text     = ListProduto[0].Descricao;
                     lbEstampo.Text      = ListOP[0].Estampo.ToString();
                     lbMateriaPrima.Text = ListOP[0].MateriaPrima.ToString();
                     cbPrioridade.Text   = ListOP[0].Prioridade.ToString();
                     cbFabrica.Text      = ListOP[0].IdFabrica.ToString();
                     cbStatus.Text       = ListOP[0].Status.ToString();
                     tbQtde.Text         = ListOP[0].Qtde.ToString();
                     tbObs.Text          = ListOP[0].Obs.ToString();
                     btSalvar.Enabled    = true;
                     btExcluir.Enabled   = true;
                 }
                 else
                 {
                     MessageBox.Show("Não foi encontrado nenhuma OP com este número", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     btSalvar.Enabled  = false;
                     btExcluir.Enabled = false;
                     tbNumOP.Focus();
                 }
             }
         }
         else
         {
             tbNumOP.Focus();
             btSalvar.Enabled  = false;
             btExcluir.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         log.Tipo       = "Erro";
         log.Local      = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Login      = usuario;
         log.Computador = Environment.MachineName.ToString();
         log.Mensagem   = ex.Message;
         ListLog.Add(log);
         log.GravaLog(ListLog);
         MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
파일: Apontamento.cs 프로젝트: tidovale/GI
        private void tbNumAtividade_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(tbNumAtividade.Text))
                {
                    if (tbNumAtividade.TextLength == 8)
                    {
                        cbMotivo.Focus();

                        ListRoteiroSQL = roteiroSQL.BuscaAtividade(tbNumAtividade.Text);
                        if (ListRoteiroSQL == null)
                        {
                            MessageBox.Show("Não foi encontrado nenhuma atividade com este número", "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            tbNumAtividade.SelectionStart = 0;
                            btApontar.Enabled             = false;
                        }
                        else
                        {
                            lbOP.Text         = ListRoteiroSQL[0].IdOP.ToString();
                            lbSequencia.Text  = ListRoteiroSQL[0].Sequencia.ToString() + "-";
                            lbAtividade.Text  = ListRoteiroSQL[0].NomeSetor;
                            lbDescricao.Text  = ListRoteiroSQL[0].DescricaoAtividade;
                            ListOP            = op.BuscaOP(ListRoteiroSQL[0].IdOP.ToString());
                            ListProduto       = produto.ListaProduto(ListOP[0].CodProduto.ToString());
                            lbCodProduto.Text = ListOP[0].CodProduto.ToString();
                            lbDescProd.Text   = ListProduto[0].Descricao;
                            lbPrioridade.Text = ListOP[0].Prioridade.ToString();
                            if (ListOP[0].Prioridade.ToString() == "1- Vermelho")
                            {
                                lbPrioridadeCor.BackColor = Color.Red;
                            }
                            else if (ListOP[0].Prioridade.ToString() == "2- Amarelo")
                            {
                                lbPrioridadeCor.BackColor = Color.Yellow;
                            }
                            else
                            {
                                lbPrioridadeCor.BackColor = Color.Green;
                            }
                            lbEstampo.Text = ListOP[0].Estampo.ToString();
                            lbMP.Text      = ListOP[0].MateriaPrima;
                            lbFabrica.Text = ListOP[0].IdFabrica.ToString();
                            lbQtde.Text    = ListOP[0].Qtde.ToString();
                            lbObs.Text     = ListOP[0].Obs;

                            List <string> ListResultadoJaApontado = new List <string>();

                            if (ListRoteiroSQL[0].Sequencia > 1)
                            {
                                if (roteiroSQL.BuscaAtividadeAnterior(ListRoteiroSQL[0].IdRoteiro) == 0)
                                {
                                    lbAviso.Text                   = "Não é possível apontar esta atividade, pois o setor anterior ainda não finalizou sua atividade!";
                                    btApontar.Enabled              = false;
                                    tbNumAtividade.SelectionStart  = 0;
                                    tbNumAtividade.SelectionLength = tbNumAtividade.Text.Length;
                                    tbNumAtividade.Focus();
                                }
                                else
                                {
                                    if (cbMotivo.SelectedValue.ToString() == "1")
                                    {
                                        ListResultadoJaApontado = roteiroSQL.BuscaQtdeAtividadeAnteriorApontada(ListRoteiroSQL[0].IdOP);
                                        if (ListResultadoJaApontado != null)
                                        {
                                            tbQtde.Text = ListResultadoJaApontado[1];
                                        }
                                    }

                                    lbAviso.Text                   = "";
                                    btApontar.Enabled              = true;
                                    btFi.Enabled                   = true;
                                    btDesenho.Enabled              = true;
                                    tbQtde.Enabled                 = true;
                                    tbPeso.Enabled                 = true;
                                    cbMotivo.Enabled               = true;
                                    tbNumAtividade.SelectionStart  = 0;
                                    tbNumAtividade.SelectionLength = tbNumAtividade.Text.Length;
                                    tbNumAtividade.Focus();
                                }
                            }
                            else
                            {
                                if (cbMotivo.SelectedValue.ToString() == "1")
                                {
                                    ListResultadoJaApontado = roteiroSQL.BuscaQtdeAtividadeAnteriorApontada(ListRoteiroSQL[0].IdOP);
                                    if (ListResultadoJaApontado != null)
                                    {
                                        tbQtde.Text = ListResultadoJaApontado[1];
                                    }
                                    else
                                    {
                                        tbQtde.Text = ListOP[0].Qtde.ToString();
                                    }
                                }

                                lbAviso.Text                   = "";
                                tbQtde.Enabled                 = true;
                                tbPeso.Enabled                 = true;
                                cbMotivo.Enabled               = true;
                                btApontar.Enabled              = true;
                                btFi.Enabled                   = true;
                                btDesenho.Enabled              = true;
                                tbNumAtividade.SelectionStart  = 0;
                                tbNumAtividade.SelectionLength = tbNumAtividade.Text.Length;
                                tbNumAtividade.Focus();
                            }

                            if (ListOP[0].Status == "Fechada")
                            {
                                btApontar.Enabled = false;
                                lbAviso.Text      = "Esta OP já foi fechada!";
                            }
                            else if (ListOP[0].Status == "Cancelada")
                            {
                                btApontar.Enabled = false;
                                lbAviso.Text      = "Esta OP foi cancelada!";
                            }
                            else
                            {
                                btApontar.Enabled = true;
                            }
                        }
                    }
                }
                else
                {
                    tbNumAtividade.Focus();
                    btApontar.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                log.Tipo       = "Erro";
                log.Local      = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Login      = usuario;
                log.Computador = Environment.MachineName.ToString();
                log.Mensagem   = ex.Message;
                ListLog.Add(log);
                log.GravaLog(ListLog);
                MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }