Ir para conteúdo
  • Cadastre-se

dev botao

Cte.distribuicaodfeporultnsu


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

Recommended Posts

Ola bom dia
na unit DoACBRCteUnit eu inclui um metodo para consultar a distribuicaodfe, seguindo os mesmos passos utilizado pela nfe
porem ele fica me retornando uma rejeicao ao executar o metodo:
Erro:RejeicaoCabecalho - A versao do arquivo xml nao e suportada
Rejeicao: Cabecalho - A Versao do arquivo xml nao e suportada

porem quando eu executo os demais metodos todos dao o retorno OK
esta configurado para usar a versao 3.00 do cte
pastas de schemas atualizadas

 

        else if (Cmd.Metodo = 'distribuicaodfepornsu') or      //NFe.DistribuicaoDFePorNSU(cUF, cCNPJ, nNSU)
                (Cmd.Metodo = 'distribuicaodfeporultnsu')then  //NFe.DistribuicaoDFePorUltNSU(cUF, cCNPJ, nUltNSU)
         begin
           if not ValidarCNPJ(Cmd.Params(1)) then
              raise Exception.Create('CNPJ '+Cmd.Params(1)+' inválido.');

           try
              if Cmd.Metodo = 'distribuicaodfepornsu' then
                ACBrCTe1.DistribuicaoDFePorNSU(StrToIntDef(Cmd.Params(0),0),Cmd.Params(1),Cmd.Params(2))
              else
                ACBrCTe1.DistribuicaoDFePorUltNSU(StrToIntDef(Cmd.Params(0),0),Cmd.Params(1),Cmd.Params(2));

              if ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
                sTemMais := '1'
             else
                sTemMais := '0'; //pog para facilitar a indicacao de continuidade

             Cmd.Resposta:= Cmd.Resposta+sLineBreak+
                            '[DISTRIBUICAODFE]'+sLineBreak+
                            'versao='  +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.versao+sLineBreak+
                            'tpAmb='   +TpAmbToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.tpAmb)+sLineBreak+
                            'verAplic='+ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.verAplic+sLineBreak+
                            'cStat='   +IntToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat)+sLineBreak+
                            'xMotivo=' +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo+sLineBreak+
                            'dhResp='  +DateTimeToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.dhResp)+sLineBreak+
                            'indCont=' +sTemMais+sLineBreak+
                            'ultNSU='  +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU+sLineBreak+
                            'maxNSU='  +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.maxNSU+sLineBreak+
                            'XML='     +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.XML+sLineBreak;
                            //'NomeArq=' +ACBrCTe1.WebServices.DistribuicaoDFe.NomeArq;
             J := 1;
             for i:= 0 to ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count-1 do
             begin
              if Trim(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.chCTe) <> '' then
                 begin
                      Cmd.Resposta := Cmd.Resposta+sLineBreak+
                       '[RESCTE'+Trim(IntToStrZero(J,3))+']'+sLineBreak+
                       'NSU='     +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].NSU+sLineBreak+
                       'chNFe='   +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.chCTe+sLineBreak+
                       'CNPJ='    +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.CNPJCPF+sLineBreak+
                       'xNome='   +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.xNome+sLineBreak+
                       'IE='      +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.IE+sLineBreak+
                       'dEmi='    +DateTimeToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.dhEmi)+sLineBreak+
//                       'tpNF='    +tpCTToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.tpNF)+sLineBreak+
                       'vNF='     +FloatToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.vNF)+sLineBreak+
                       'digVal='  +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.digVal+sLineBreak+
                       'dhRecbto='+DateTimeToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.dhRecbto)+sLineBreak+
                       'cSitNFe=' +SituacaoDFeToStr(ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.cSitCTe)+sLineBreak+
                       'nProt='   +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].resCTe.nProt+sLineBreak+
                       'XML='     +ACBrCTe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip[i].XML;
                       J := J + 1;
                    end;
                 end;
           except
             on E: Exception do
              begin
                raise Exception.Create(ACBrCTe1.WebServices.DistribuicaoDFe.Msg+sLineBreak+E.Message);
              end;
           end;
         end

 

Editado por Alberto.Leal
tags de codigo

Alberto Leal

www.tecwebcg.com

 

Link para o comentário
Compartilhar em outros sites

  • Consultores

Boa tarde Alberto,

Os Schemas do CT-e não podem ficar na mesma pasta que tem os Schemas da NFe, isso pode trazer problemas, pois alguns Schemas tem exatamente o mesmo nome, mas com versões diferentes.

No caso do CT-e a versão do schema refere a DistribuicaoDFe é 1.00, já na NF-e a versão do schema é 1.01 

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

  • 3 semanas depois ...
Em 15/01/2018 at 16:23, Italo Jurisato Junior disse:

Boa tarde Alberto,

Os Schemas do CT-e não podem ficar na mesma pasta que tem os Schemas da NFe, isso pode trazer problemas, pois alguns Schemas tem exatamente o mesmo nome, mas com versões diferentes.

No caso do CT-e a versão do schema refere a DistribuicaoDFe é 1.00, já na NF-e a versão do schema é 1.01 

Bom dia
entao pelo monitor acbrplus nao seria possivel ter as 2 opções.. 
ou eu teria que alterar o projeto para separar as pastas por documento versao 

Alberto Leal

www.tecwebcg.com

 

Link para o comentário
Compartilhar em outros sites

eu fiz uma alteracao no monitor para setar o path dos schemas do cte manualmente 
porem agora a resposta que me da é
cte.distribuicaodfeporultnsu(MS,MEuCNPJ,0)
ERRO: Rejeicao: Falha no esquema xml
Rejeicao: Falha no esquema xml

eu já copiei os schemas para a pasta

SchemaCte.png

A alteracao foi essa no AcbrMonitor1

SetComumConfig(ACBrNFe1.Configuracoes);
    SetComumConfig(ACBrCTe1.Configuracoes);
    SetComumConfig(ACBrMDFe1.Configuracoes);
    SetComumConfig(ACBrGNRE1.Configuracoes);
    SetComumConfig(ACBrBlocoX1.Configuracoes);

    AtualizaSSLLibsCombo;
    ACBrCTE1.Configuracoes.Arquivos.PathSchemas := 'C:\Acbr\Schema\Cte';  <==essa eh a linha nova

Editado por Alberto.Leal

Alberto Leal

www.tecwebcg.com

 

Link para o comentário
Compartilhar em outros sites

  • Este tópico foi criado há 2248 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.