コード例 #1
0
 private void ReprovarLoteSemente()
 {
     if (bsLoteSemente.Current != null)
     {
         if ((bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).St_registro.Trim().ToUpper() != "A")
         {
             MessageBox.Show("Permitido reprovar somente lote com status <ABERTO>.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (MessageBox.Show("Confirma reprovação do lote?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
             == DialogResult.Yes)
         {
             using (TFReprovarLote fRep = new TFReprovarLote())
             {
                 fRep.rSemente = bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente;
                 if (fRep.ShowDialog() == DialogResult.OK)
                 {
                     using (TFPedidoItemSemente fNfOrigem = new TFPedidoItemSemente())
                     {
                         fNfOrigem.Cd_empresa = fRep.rSemente.Cd_empresa;
                         fNfOrigem.Cd_amostra = fRep.rSemente.Cd_amostra;
                         fNfOrigem.Qtd_lote   = fRep.rSemente.Qtd_lote;
                         if (fNfOrigem.ShowDialog() == DialogResult.OK)
                         {
                             fRep.rSemente.lLoteNfItens = fNfOrigem.lNfItem;
                             try
                             {
                                 CamadaNegocio.Sementes.TCN_LoteSemente.Reprovar(fRep.rSemente, null);
                                 MessageBox.Show("Lote reprovado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                             }
                             catch (Exception ex)
                             {
                                 MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                             }
                         }
                     }
                 }
                 afterBusca();
             }
         }
     }
     else
     {
         MessageBox.Show("Obrigatorio selecionar lote para reprovar.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 private bool BuscarNfOrigemLote()
 {
     //Verificar se ja nao foi amarrado a origem do lote
     if (CamadaNegocio.ConfigGer.TCN_CadParamGer.BuscaVL_Bool("APONT_PRODUCAO_SEMENTE", Cd_empresa.Trim(), null).Trim().ToUpper().Equals("S") &&
         Tp_mov.Trim().ToUpper().Equals("S"))
     {
         using (TFPedidoItemSemente fNfOrigem = new TFPedidoItemSemente())
         {
             fNfOrigem.Cd_empresa = (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).Cd_empresa;
             fNfOrigem.Cd_amostra = (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).Cd_amostra;
             fNfOrigem.Qtd_lote   = CamadaNegocio.Estoque.Cadastros.TCN_CadConvUnidade.ConvertUnid(
                 (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).Cd_unidade,
                 (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).Cd_unidamostra,
                 quantidade.Value,
                 3,
                 null);
             if (fNfOrigem.ShowDialog() == DialogResult.OK)
             {
                 if (fNfOrigem.lNfItem != null)
                 {
                     fNfOrigem.lNfItem.ForEach(p =>
                     {
                         p.Id_lote = (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).Id_lote;
                         lLoteNfOrigem.Add(p);
                     });
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
     }
     else
     {
         return(true);
     }
 }
コード例 #3
0
 private void AprovarLoteSemente()
 {
     if (bsLoteSemente.Current != null)
     {
         if ((bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente).St_registro.Trim().ToUpper() != "A")
         {
             MessageBox.Show("Permitido aprovar somente lote com status <ABERTO>.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (MessageBox.Show("Confirma aprovação do lote?", "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
             == DialogResult.Yes)
         {
             using (TFAprovarLote fAprovar = new TFAprovarLote())
             {
                 fAprovar.rSemente = (bsLoteSemente.Current as CamadaDados.Sementes.TRegistro_LoteSemente);
                 if (fAprovar.ShowDialog() == DialogResult.OK)
                 {
                     if (!CamadaNegocio.ConfigGer.TCN_CadParamGer.BuscaVL_Bool("APONT_PRODUCAO_SEMENTE", fAprovar.rSemente.Cd_empresa, null).Trim().ToUpper().Equals("S"))
                     {
                         using (TFPedidoItemSemente fNfOrigem = new TFPedidoItemSemente())
                         {
                             fNfOrigem.Cd_empresa = fAprovar.rSemente.Cd_empresa;
                             fNfOrigem.Cd_amostra = fAprovar.rSemente.Cd_amostra;
                             fNfOrigem.Qtd_lote   = fAprovar.rSemente.Qtd_amostra;
                             if (fNfOrigem.ShowDialog() == DialogResult.OK)
                             {
                                 fAprovar.rSemente.lLoteNfItens = fNfOrigem.lNfItem;
                                 try
                                 {
                                     CamadaNegocio.Sementes.TCN_LoteSemente.Aprovar(fAprovar.rSemente, null);
                                     MessageBox.Show("Lote semente aprovado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                 }
                                 catch (Exception ex)
                                 {
                                     MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                 }
                             }
                         }
                     }
                     else
                     {
                         try
                         {
                             CamadaNegocio.Sementes.TCN_LoteSemente.Aprovar(fAprovar.rSemente, null);
                             MessageBox.Show("Lote semente aprovado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         }
                         catch (Exception ex)
                         {
                             MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
                     }
                 }
                 afterBusca();
             }
         }
     }
     else
     {
         MessageBox.Show("Obrigatorio selecionar lote para aprovar.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }