Ir para conteúdo
  • Cadastre-se

dev botao

Consulta evento manifestação


  • Este tópico foi criado há 2485 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

Senhores, bom dia.

Eu como emissor de NFe, gostaria de consultar e armazenar os protocolos/eventos de manifestação efetuadas em minhas NFe's pelos meus destinatários.

Entendo as manifestações como eventos.

Utilizei o código abaixo, porém só consegui visualizar eventos de cancelamentos, os eventos de manifestação não consegui.

  ACBrNFe1.WebServices.Consulta.Executar;

  if ACBrNFe1.WebServices.Consulta.procEventoNFe.Count > 0 then
  begin
    for i := 0 to ACBrNFe1.WebServices.Consulta.procEventoNFe.Count - 1 do
    begin
      for j := 0 to ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Count - 1 do
      begin
        memoLog.Lines.Add('***********************');
        memoLog.Lines.Add('');
        memoLog.Lines.Add('Sequência do evento: ' + IntToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.InfEvento.nSeqEvento));
        memoLog.Lines.Add('Tipo de evento.....: ' + TpEventoToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.InfEvento.TpEvento));
        memoLog.Lines.Add('Descrição do evento: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.InfEvento.DescEvento);
        memoLog.Lines.Add('Cód. status evento.: ' + IntToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.cStat));
        memoLog.Lines.Add('Desc. status evento: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.xMotivo);
        memoLog.Lines.Add('Status evento......: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.xEvento);
        memoLog.Lines.Add('Protocolo..........: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.nProt);
        memoLog.Lines.Add('Data/hora do evento: ' + DateToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.dhRegEvento));
      end;
    end;
  end;
 

Alguém pode me ajudar.

Obrigado.

Link para o comentário
Compartilhar em outros sites

  • Consultores

Bom dia Luis,

Peço que leia a Nota Técnica 2014/002 versão 1.01 que trata sobre a Distribuição DF-e.

O componente ACBrNFe possui um método chamado DistribuicaoDFe, para mais detalhes sobre esse método leia o Manual do ACBrNFe versão 1.04 que esta disponível na pasta: ...\Doctos\Manuais

Não é através de uma consulta a situação atual da nota que você vai ter o que deseja e sim através do DistribuicaoDFe.

Espero ter ajudado.

Consultor SAC ACBr

Italo Giurizzato Junior
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

Analista de Sistemas / e-mail: [email protected] / Fone: (16) 9-9701-5030 / Araraquara-SP

Araraquara - A era dos Trólebus

Link para o comentário
Compartilhar em outros sites

Boa tarde Italo.

Obrigado pelas informações, ajudou e muito.

Porém me restou uma dúvida.

Pelo que entendi com a Nota Técnica 2014/002 e com o teste que acabo de realizar com o DistribuicaoDFe, este me retorna dados das notas no qual sou o destinatário.

Na qualidade de emissor, meu objetivo é armazenar em minha aplicação os protocolos/eventos de manifestação que meus destinatários/clientes efetuaram nas notas emitidas por mim.

Segue abaixo o código que utilizei no teste.

Você pode me ajudar?

Muito obrigado.

ACBrNFe1.DistribuicaoDFe(:UF, :CNPJ, '0', '');

  memoLog.Lines.Add('Status: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat));
  memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
    memoLog.Lines.Add('Tem mais? Sim')
  else
    memoLog.Lines.Add('Tem mais? Não');
  memoLog.Lines.Add('Último NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 138 then
  begin
    memoLog.Lines.Add(' Documento Localizado para o Destinatário');
    memoLog.Lines.Add(' ');

    for i := 0 to ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count - 1  do
    begin
      memoLog.Lines.Add('************************');
      memoLog.Lines.Add(' ');

      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.chNFe <> '' then
      begin
        memoLog.Lines.Add('Chave de Acesso: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.chNFe);
        memoLog.Lines.Add('CNPJ: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.CNPJCPF);
        memoLog.Lines.Add('Nome: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.xNome);
        memoLog.Lines.Add('IE: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.IE);

        case ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.tpNF of
          tnEntrada: memoLog.Lines.Add('Tipo: Entrada');
          tnSaida:   memoLog.Lines.Add('Tipo: Saída');
        end;
        memoLog.Lines.Add('NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.NSU);
        case ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.cSitNFe of
          snAutorizado: memoLog.Lines.Add('Situação: Autorizado');
          snDenegado:   memoLog.Lines.Add('Situação: Denegado');
          snCancelada:  memoLog.Lines.Add('Situação: Canelada');
        end;
      end;
    end;
  end
  else
  begin
   // Nenhum Documento Localizado para o Destinatário
    if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137
    then begin
      memoLog.Lines.Add(' Nenhum Documento Localizado para o Destinatário');
      memoLog.Lines.Add(' Utilizar o número que esta no campo: Último NSU');
      memoLog.Lines.Add(' Para uma nova pesquisa ('+ ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU +').');
      memoLog.Lines.Add(' ');
    end
    else begin
      memoLog.Lines.Add(' Falha ao realizar a consulta.');
      memoLog.Lines.Add('  ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat) + ' - ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
      memoLog.Lines.Add(' ');
    end;
  end;
 

 

Link para o comentário
Compartilhar em outros sites

  • Consultores

Boa tarde Luis,

Quando você checa a chave retornada em items[ I ].resNFe.chNFe <> '', esta pegando o resumo das notas destinadas a você, é isso que você quer?

Você deixou claro que deseja obter os eventos de manifestação do destinatário, sendo assim você deve checar se Items[ I ].procEvento.Id <> ''

Abra a unit pcnRetDistDFeInt.pas para saber quais são propriedades alimentadas quando é retornado um Evento.

Consultor SAC ACBr

Italo Giurizzato Junior
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

Analista de Sistemas / e-mail: [email protected] / Fone: (16) 9-9701-5030 / Araraquara-SP

Araraquara - A era dos Trólebus

Link para o comentário
Compartilhar em outros sites

  • 1 ano depois...
  • 3 semanas depois ...

Boa tarde Rodrigo,

Pelo DistribuicaoDFe, nele você visualiza todos os eventos de suas notas.

Segue o exemplo abaixo.

Espero ter ajudado.

abs.

  memoLog.Lines.Clear;
  ACBrNFe1.Configuracoes.Geral.ModeloDF := moNFe;
  ACBrNFe1.Configuracoes.Geral.VersaoDF := ve310;
  ACBrNFe1.WebServices.Consulta.procEventoNFe.Clear;
  ACBrNFe1.Configuracoes.WebServices.Ambiente := taProducao;
  ACBrNFe1.Configuracoes.WebServices.UF := cbUF.Text;

  ACBrNFe1.DistribuicaoDFe(35, '68960244000150', '0', '');

  memoLog.Lines.Add('Status: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat));
  memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
    memoLog.Lines.Add('Tem mais? Sim')
  else
    memoLog.Lines.Add('Tem mais? Não');
  memoLog.Lines.Add('Último NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 138 then
  begin
    memoLog.Lines.Add(' Documento Localizado para o Destinatário');
    memoLog.Lines.Add(' ');

    for i := 0 to ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count - 1  do
    begin
      memoLog.Lines.Add('************************');
      memoLog.Lines.Add(' ');

      memoLog.Lines.Add('NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.NSU);      

      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id <> '' then
      begin
        memoLog.Lines.Add('ProcEvento');
        memoLog.Lines.Add('ID : ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id);
        memoLog.Lines.Add('Tipo Ambiente: ' + TpAmbToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpAmb));
        memoLog.Lines.Add('CNPJ: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.CNPJ);
        memoLog.Lines.Add('Chave: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.chNFe);
        memoLog.Lines.Add('Data Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.dhEvento));
        memoLog.Lines.Add('Tipo: ' + TpEventoToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpEvento));
        memoLog.Lines.Add('Seq: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.nSeqEvento));
        memoLog.Lines.Add('Versão: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.verEvento);
        memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xMotivo);
        memoLog.Lines.Add('Evento: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xEvento);
        memoLog.Lines.Add('Seq2: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nSeqEvento));
        memoLog.Lines.Add('CNPJ Dest: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.CNPJDest);
        memoLog.Lines.Add('Data Reg. Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.dhRegEvento));
        memoLog.Lines.Add('Prot: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nProt);
        memoLog.Lines.Add('Prot. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.nProt);
        memoLog.Lines.Add('Just. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.xJust);
      end;

    end;
  end
  else
  begin
   // Nenhum Documento Localizado para o Destinatário
    if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137
    then begin
      memoLog.Lines.Add(' Nenhum Documento Localizado para o Destinatário');
      memoLog.Lines.Add(' Utilizar o número que esta no campo: Último NSU');
      memoLog.Lines.Add(' Para uma nova pesquisa ('+ ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU +').');
      memoLog.Lines.Add(' ');
    end
    else begin
      memoLog.Lines.Add(' Falha ao realizar a consulta.');
      memoLog.Lines.Add('  ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat) + ' - ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
      memoLog.Lines.Add(' ');
    end;
  end;

Link para o comentário
Compartilhar em outros sites

Boa noite, estou com a seguinte situação.

Tenho uma nota que no Sefaz esta com evento de Autorizado, Ciência e Cancelamento. Quanto utilizo o DistribuicaoDfe ele me retorna 3 arquivos na pasta :

1101113517034435806700246455003000058924100927803901-procEventoNFe.xml
35170344358067002464550030000589241009278039-nfe.xml
35170344358067002464550030000589241009278039-resNFe.xml

Essa nota esta Cancelada, foi o ultimo evento enviado, porém nesse arquivo -nfe ela esta Autorizada, porém no procEventoNFE ela esta com evento de Cancelada, porém não estou conseguindo ler isso, esse evento de Cancelado, e com isso acabou importando a nota para o sistema como se tivesse autorizada e não esta.
Alguém sabe uma forma que eu possa ler isso ?

Obrigado e aguardo.

Link para o comentário
Compartilhar em outros sites

  • 2 meses depois ...
Em 23/03/2017 at 15:20, Luis Fernando Ravanelli disse:

Boa tarde Rodrigo,

Pelo DistribuicaoDFe, nele você visualiza todos os eventos de suas notas.

Segue o exemplo abaixo.

Espero ter ajudado.

abs.

  memoLog.Lines.Clear;
  ACBrNFe1.Configuracoes.Geral.ModeloDF := moNFe;
  ACBrNFe1.Configuracoes.Geral.VersaoDF := ve310;
  ACBrNFe1.WebServices.Consulta.procEventoNFe.Clear;
  ACBrNFe1.Configuracoes.WebServices.Ambiente := taProducao;
  ACBrNFe1.Configuracoes.WebServices.UF := cbUF.Text;

  ACBrNFe1.DistribuicaoDFe(35, '68960244000150', '0', '');

  memoLog.Lines.Add('Status: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat));
  memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
    memoLog.Lines.Add('Tem mais? Sim')
  else
    memoLog.Lines.Add('Tem mais? Não');
  memoLog.Lines.Add('Último NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 138 then
  begin
    memoLog.Lines.Add(' Documento Localizado para o Destinatário');
    memoLog.Lines.Add(' ');

    for i := 0 to ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count - 1  do
    begin
      memoLog.Lines.Add('************************');
      memoLog.Lines.Add(' ');

      memoLog.Lines.Add('NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.NSU);      

      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id <> '' then
      begin
        memoLog.Lines.Add('ProcEvento');
        memoLog.Lines.Add('ID : ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id);
        memoLog.Lines.Add('Tipo Ambiente: ' + TpAmbToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpAmb));
        memoLog.Lines.Add('CNPJ: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.CNPJ);
        memoLog.Lines.Add('Chave: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.chNFe);
        memoLog.Lines.Add('Data Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.dhEvento));
        memoLog.Lines.Add('Tipo: ' + TpEventoToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpEvento));
        memoLog.Lines.Add('Seq: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.nSeqEvento));
        memoLog.Lines.Add('Versão: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.verEvento);
        memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xMotivo);
        memoLog.Lines.Add('Evento: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xEvento);
        memoLog.Lines.Add('Seq2: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nSeqEvento));
        memoLog.Lines.Add('CNPJ Dest: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.CNPJDest);
        memoLog.Lines.Add('Data Reg. Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.dhRegEvento));
        memoLog.Lines.Add('Prot: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nProt);
        memoLog.Lines.Add('Prot. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.nProt);
        memoLog.Lines.Add('Just. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.xJust);
      end;

    end;
  end
  else
  begin
   // Nenhum Documento Localizado para o Destinatário
    if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137
    then begin
      memoLog.Lines.Add(' Nenhum Documento Localizado para o Destinatário');
      memoLog.Lines.Add(' Utilizar o número que esta no campo: Último NSU');
      memoLog.Lines.Add(' Para uma nova pesquisa ('+ ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU +').');
      memoLog.Lines.Add(' ');
    end
    else begin
      memoLog.Lines.Add(' Falha ao realizar a consulta.');
      memoLog.Lines.Add('  ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat) + ' - ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
      memoLog.Lines.Add(' ');
    end;
  end;

Boa tarde, colega...
E quando esta nota tiver mais de um evento ?? Como fazer ?
Pelo que vi, esse código pega só 1 evento. E quando tem mais de um ?

 

Em 23/03/2017 at 15:20, Luis Fernando Ravanelli disse:

Boa tarde Rodrigo,

Pelo DistribuicaoDFe, nele você visualiza todos os eventos de suas notas.

Segue o exemplo abaixo.

Espero ter ajudado.

abs.

  memoLog.Lines.Clear;
  ACBrNFe1.Configuracoes.Geral.ModeloDF := moNFe;
  ACBrNFe1.Configuracoes.Geral.VersaoDF := ve310;
  ACBrNFe1.WebServices.Consulta.procEventoNFe.Clear;
  ACBrNFe1.Configuracoes.WebServices.Ambiente := taProducao;
  ACBrNFe1.Configuracoes.WebServices.UF := cbUF.Text;

  ACBrNFe1.DistribuicaoDFe(35, '68960244000150', '0', '');

  memoLog.Lines.Add('Status: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat));
  memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
    memoLog.Lines.Add('Tem mais? Sim')
  else
    memoLog.Lines.Add('Tem mais? Não');
  memoLog.Lines.Add('Último NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU);
  if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 138 then
  begin
    memoLog.Lines.Add(' Documento Localizado para o Destinatário');
    memoLog.Lines.Add(' ');

    for i := 0 to ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count - 1  do
    begin
      memoLog.Lines.Add('************************');
      memoLog.Lines.Add(' ');

      memoLog.Lines.Add('NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.NSU);      

      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id <> '' then
      begin
        memoLog.Lines.Add('ProcEvento');
        memoLog.Lines.Add('ID : ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id);
        memoLog.Lines.Add('Tipo Ambiente: ' + TpAmbToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpAmb));
        memoLog.Lines.Add('CNPJ: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.CNPJ);
        memoLog.Lines.Add('Chave: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.chNFe);
        memoLog.Lines.Add('Data Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.dhEvento));
        memoLog.Lines.Add('Tipo: ' + TpEventoToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpEvento));
        memoLog.Lines.Add('Seq: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.nSeqEvento));
        memoLog.Lines.Add('Versão: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.verEvento);
        memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xMotivo);
        memoLog.Lines.Add('Evento: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xEvento);
        memoLog.Lines.Add('Seq2: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nSeqEvento));
        memoLog.Lines.Add('CNPJ Dest: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.CNPJDest);
        memoLog.Lines.Add('Data Reg. Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.dhRegEvento));
        memoLog.Lines.Add('Prot: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nProt);
        memoLog.Lines.Add('Prot. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.nProt);
        memoLog.Lines.Add('Just. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.xJust);
      end;

    end;
  end
  else
  begin
   // Nenhum Documento Localizado para o Destinatário
    if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137
    then begin
      memoLog.Lines.Add(' Nenhum Documento Localizado para o Destinatário');
      memoLog.Lines.Add(' Utilizar o número que esta no campo: Último NSU');
      memoLog.Lines.Add(' Para uma nova pesquisa ('+ ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU +').');
      memoLog.Lines.Add(' ');
    end
    else begin
      memoLog.Lines.Add(' Falha ao realizar a consulta.');
      memoLog.Lines.Add('  ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat) + ' - ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
      memoLog.Lines.Add(' ');
    end;
  end;

Boa tarde, colega...
E quando esta nota tiver mais de um evento ?? Como fazer ?
Pelo que vi, esse código pega só 1 evento. E quando tem mais de um ?

 

Link para o comentário
Compartilhar em outros sites

  • Moderadores
47 minutos atrás, João Marcos_14485 disse:

Boa tarde, colega...
E quando esta nota tiver mais de um evento ?? Como fazer ?
Pelo que vi, esse código pega só 1 evento. E quando tem mais de um ?

Você já perguntou aqui:

 

Equipe ACBr BigWings
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

 

 

Link para o comentário
Compartilhar em outros sites

  • Este tópico foi criado há 2485 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.