
TimeB256
Membros Pro-
Total de ítens
75 -
Registro em
-
Última visita
Sobre TimeB256

Últimos Visitantes
O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.
TimeB256's Achievements
-
Obrigado, pode fechar o post.
-
Obrigado pelo retorno. Mas em se tratando de dacte cancelada, toda nota será sempre com final 001 ?
-
TimeB256 started following Componentes da NFCom utilizando o VB6 , Dúvida , Exemplo de código para CTE_ImprimirEventoPDF e 3 outros
-
Prezados, estou usando o servico de vocês, chamando o método "ImprimirEventoPDF" para gerar o relatório pdf da Dacte, tanto dacte normal, quanto a cancelada. Notei que quando chega uma dacte cancelada, e vou gerar, vocês criam o arquivo físico com esse nome: Ex: 110111 + Chave Cte + 001 + -procEventoCTe 110111 >> corresponde ao tpEvento de cancelamento O que é esse 001 que vocês concatenam no arquivo ? Desde já agradeço.
-
Exemplo de código para CTE_ImprimirEventoPDF
TimeB256 replied to TimeB256's tópico in DFe - Documentos Fiscais Eletrônicos
Pode por favor fechar o topico, já consegui aqui. -
Exemplo de código para CTE_ImprimirEventoPDF
um tópico no fórum postou TimeB256 DFe - Documentos Fiscais Eletrônicos
Prezados, gostaria de um exemplo, se possível em c#, de como implementar o método de impressão de DACTE cancelada. O de DACTE NORMAL eu fiz e deu certinho. Desde já agradeço. Exemplo: public IActionResult GerarArquivoDacteAutorizado([FromBody] Danfe danfe) { try { if (string.IsNullOrEmpty(danfe.xml)) return BadRequest("Informe o xml da nota"); else if (string.IsNullOrEmpty(danfe.nomeArquivo)) return BadRequest("Informe o nome do arquivo"); else { using ACBrCTe ACBrCTe = new ACBrCTe("[Memory]"); string diretorio = KeevoDiretorio.AppPath(); string caminhoArquivo = Path.Combine(diretorio, $"{KeevoFormatacao.ExtrairNumeros(danfe.nomeArquivo)}-cte"); ACBrCTe.Config.DACTe.PathPDF = diretorio; ACBrCTe.LimparLista(); ACBrCTe.CarregarXML(danfe.xml); ACBrCTe.ImprimirPDF(); byte[] dactebytes = System.IO.File.ReadAllBytes($"{caminhoArquivo}.pdf"); System.IO.File.Delete(caminhoArquivo); HttpContext.Response.Headers["Content-Length"] = dactebytes.Length.ToString(); return File(dactebytes, "application/pdf", danfe.nomeArquivo); } } catch (Exception e) { return BadRequest(e.Message); } } -
Configuração captura notas com certificado A3
TimeB256 replied to TimeB256's tópico in DFe - Documentos Fiscais Eletrônicos
O erro não é relacionado a isso, conseguimos usar o certificado A3 normalmente para outras comunicações, inclusive mTLS com outros serviços, como um do Itaú. O erro se apresenta apenas quando fazendo a comunicação com a receita, e aquele fix na registry conserta esse problema especificamente, mas cria outros, mencionados no post original. Existe alguma solução alternativa conhecida que não causa efeitos colaterais? -
Configuração captura notas com certificado A3
um tópico no fórum postou TimeB256 DFe - Documentos Fiscais Eletrônicos
Bom dia, Vamos implementar um programa, que fará a captura das notas fiscais com certificado A3. No teste com Acbr, vimos um problema que está muito relacionado ao tópico abaixo: 7- Execute o FixCrypto_TLS1_2_Windows.reg. Fizemos os procedimentos, e realmente resolve o problema, mas identificamos que ao rodar, algumas coisas param de funcionar, como: - a conexão remota via RDP para de funcionar; - não conseguimos conectar no Marketplace do Visual Studio. - O SDK do Aws deixou de comunicar com os serviços Aws. Para desfazer, restauramos um backup das chaves alteradas, e os itens mencionados acima voltaram a funcionar, mas o erro de SSL voltou a acontecer. Vocês têm conhecimento disso ? Fizemos os testes em várias máquinas e realmente ocorreu. Segue parte do log paranoico. 16/01/25 08:50:12:991 - TLibNFeConfig.AplicarConfiguracoes - Feito 16/01/25 08:50:12:996 - Destravar 16/01/25 08:50:13:000 - SetRetorno(0, ) 16/01/25 08:50:13:008 - TACBrLibNFe.PrecisaCriptografar(DFe,SSLHttpLib) 16/01/25 08:50:13:014 - TACBrLibNFe.PrecisaCriptografar - Feito Result: False 16/01/25 08:50:13:018 - LIB_ConfigGravarValor(DFe, SSLHttpLib, 2) 16/01/25 08:50:13:023 - TACBrLibNFe.PrecisaCriptografar(DFe,SSLHttpLib) 16/01/25 08:50:13:030 - TACBrLibNFe.PrecisaCriptografar - Feito Result: False 16/01/25 08:50:13:034 - TLibNFeConfig.AjustarValor(tfGravar,DFe,SSLHttpLib,2) 16/01/25 08:50:13:038 - TLibNFeConfig.AjustarValor - Feito 16/01/25 08:50:13:043 - TLibNFeConfig.AplicarConfiguracoes: C:\Users\luis.felippe\source\keevo\acbr-rust\target\debug\ACBrLib.ini 16/01/25 08:50:13:049 - Travar 16/01/25 08:50:13:057 - TLibNFeConfig.AplicarConfiguracoes - Feito 16/01/25 08:50:13:062 - Destravar 16/01/25 08:50:13:067 - SetRetorno(0, ) 16/01/25 08:50:13:072 - TACBrLibNFe.PrecisaCriptografar(DFe,SSLXmlSignLib) 16/01/25 08:50:13:077 - TACBrLibNFe.PrecisaCriptografar - Feito Result: False 16/01/25 08:50:13:081 - LIB_ConfigGravarValor(DFe, SSLXmlSignLib, 4) 16/01/25 08:50:13:085 - TACBrLibNFe.PrecisaCriptografar(DFe,SSLXmlSignLib) 16/01/25 08:50:13:091 - TACBrLibNFe.PrecisaCriptografar - Feito Result: False 16/01/25 08:50:13:096 - TLibNFeConfig.AjustarValor(tfGravar,DFe,SSLXmlSignLib,4) 16/01/25 08:50:13:104 - TLibNFeConfig.AjustarValor - Feito 16/01/25 08:50:13:108 - TLibNFeConfig.AplicarConfiguracoes: C:\Users\luis.felippe\source\keevo\acbr-rust\target\debug\ACBrLib.ini 16/01/25 08:50:13:112 - Travar 16/01/25 08:50:13:116 - TLibNFeConfig.AplicarConfiguracoes - Feito 16/01/25 08:50:13:121 - Destravar 16/01/25 08:50:13:126 - SetRetorno(0, ) 16/01/25 08:50:13:130 - NFe_DistribuicaoDFePorUltNSU(31,33600491000160,0) 16/01/25 08:50:13:134 - Travar 16/01/25 08:50:13:139 - NFe_DistribuicaoDFePorUltNSU, Executar 16/01/25 08:50:23:994 - Destravar 16/01/25 08:50:23:994 - SetRetorno(-16, WebService Distribuição de DFe: - Inativo ou Inoperante tente novamente. Erro Interno: -2146893815 Erro HTTP: 0 URL: https://hom1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx Erro: 2148073481 - MotivoRetornadoDoWebService: "") -
Dúvidas sobre configuração Acbr para Cte
TimeB256 replied to TimeB256's tópico in DFe - Documentos Fiscais Eletrônicos
Muito obrigado, muito esclarecedor. Pode fechar o post. -
Dúvidas sobre configuração Acbr para Cte
um tópico no fórum postou TimeB256 DFe - Documentos Fiscais Eletrônicos
Prezados, bom dia !! Eu gostaria de tirar algumas dúvidas acerca da configuração acbr. Eu tenho um projeto para captura de CTE. Toda vez que eu mudo de empresa, para realizar a captura, eu faço o seguinte código: Instancio a classe de serviço... acbrcteservico = new AcbrCTeServico(empresacteselecaomodel, certificadodigitalkeevo); E chamo o método de distribuicaoDfe var resposta = acbrcteservico.DistribuicaoDFe(); A minha dúvida é a seguinte... qdo instancio a classe, chamo o método ConfigurarCertificado. Esse método está todo descrito abaixo. 1) Gostaria de saber se está faltando alguma configuração que não foi passada.. 2) Ao final do método, eu chamo o acbrCTe.ConfigGravar(); É necessário ? 3) A propriedade acbrCTe.Config.Principal.LogPath é apenas caso eu queria gravar log ? 4) Eu preciso preencher a prop PathCTe ? Desde já agradeço a atenção !!! CÓDIGO DA CLASSE DE SERVICO (AcbrCTeServico) using Dfe.Pacotes.Infra.IntegracaoApi.Models.Passaporte; using Keevo.Pacotes.Infra.ACBrLib.Core.DFe; using Keevo.Pacotes.Infra.ACBrLib.CTe; using Keevo.Pacotes.Infra.ACBrLib.CTe.Models; using Keevo.Pacotes.Infra.Utils.Conversao; using Keevo.Pacotes.Infra.Utils.Criptografia; using Keevo.Pacotes.Infra.Utils.Diretorio; using Keevocenter.Pacotes.Infra.IntegracaoApi.Models.Certificado; namespace Dfe.Monitor.CapturaCte.Servicos { public class AcbrCTeServico : IDisposable { public ACBrCTe acbrcte { get; set; } public EmpresaParametrosCteSelecaoModel empresacte { get; set; } public CertificadoPorParametrosModel certificadodigitalkeevo { get; set; } public AcbrCTeServico(EmpresaParametrosCteSelecaoModel empresacte, CertificadoPorParametrosModel certificadodigitalkeevo) { try { acbrcte = new(); this.empresacte = empresacte; this.certificadodigitalkeevo = certificadodigitalkeevo; ConfigurarCertificado(acbrcte, certificadodigitalkeevo); } catch (Exception e) { Console.WriteLine($"AcbrCTeServico - Schemas: {acbrcte?.Config.PathSchemas} - StackTrace - {e.StackTrace}"); } } public DistribuicaoDFeResposta<TipoCTe> DistribuicaoDFe() { Console.WriteLine($"Código NFE: {empresacte.codigonfe.ToInt()} - CNPJ: {empresacte.cnpj} - NSU: {empresacte.ultimonsu ?? ("0").PadLeft(15, '0')} Schemas: {acbrcte.Config.PathSchemas}"); return TratarDfeResposta(acbrcte.DistribuicaoDFe(empresacte.codigonfe.ToInt(), empresacte.cnpj, empresacte.ultimonsu ?? ("0").PadLeft(15, '0'), "")); } public DistribuicaoDFeResposta<TipoCTe> DistribuicaoDFe(long ultimonsu) => DistribuicaoDFe(ultimonsu.ToString().PadLeft(15, '0')); public DistribuicaoDFeResposta<TipoCTe> DistribuicaoDFe(string ultimonsu) => TratarDfeResposta(acbrcte.DistribuicaoDFe(empresacte.codigonfe.ToInt(), empresacte.cnpj, ultimonsu, "")); public DistribuicaoDFeResposta<TipoCTe> DistribuicaoCtePorNSU(long nsu) => DistribuicaoCtePorNSU(nsu.ToString().PadLeft(15, '0')); public DistribuicaoDFeResposta<TipoCTe> DistribuicaoCtePorNSU(string nsu) => TratarDfeResposta(acbrcte.DistribuicaoDFePorNSU(empresacte.codigonfe.ToInt(), empresacte.cnpj, nsu)); public DistribuicaoDFeResposta<TipoCTe> DistribuicaoCtePorChave(string chave) => DistribuicaoCtePorChave(empresacte, chave); public DistribuicaoDFeResposta<TipoCTe> DistribuicaoCtePorChave(EmpresaParametrosCteSelecaoModel empresacte, string chave) => TratarDfeResposta(acbrcte.DistribuicaoDFePorChave(empresacte.codigonfe.ToInt(), empresacte.cnpj, chave)); public DistribuicaoDFeResposta<TipoCTe> TratarDfeResposta(string resposta) => DistribuicaoDFeResposta<TipoCTe>.LerResposta(resposta); public void ConfigurarCertificado() { ConfigurarCertificado(acbrcte, certificadodigitalkeevo); } public static void ConfigurarCertificado(ACBrCTe acbrCTe, CertificadoPorParametrosModel certificadodigitalkeevo) { acbrCTe.Config.DFe.SSLCryptLib = GetSSLCryptLib(); acbrCTe.Config.DFe.SSLHttpLib = GetSSLHttpLib(); acbrCTe.Config.DFe.SSLXmlSignLib = SSLXmlSignLib.xsLibXml2; acbrCTe.Config.DFe.DadosPFX = certificadodigitalkeevo.arquivocertificado; acbrCTe.Config.DFe.Senha = KeevoCrypto.Decrypt(certificadodigitalkeevo.senha); acbrCTe.Config.Ambiente = TipoAmbiente.taProducao; //acbrCTe.Config.SalvarArq = false; //acbrCTe.Config.SalvarGer = false; //Configurações para processamento acbrCTe.Config.SSLType = SSLType.LT_TLSv1_2; acbrCTe.Config.Timeout = 25000; acbrCTe.Config.AguardarConsultaRet = 0; acbrCTe.Config.Tentativas = 5; acbrCTe.Config.IntervaloTentativas = 1000; acbrCTe.Config.DFe.TimeZoneModo = TimezoneMode.tzManual; acbrCTe.Config.DFe.TimeZoneStr = "-03:00"; //acbrCTe.Config.PathSchemas = KeevoDiretorio.AppPath() + @"/Schemas/CTe"; acbrCTe.Config.PathSchemas = Path.Combine(KeevoDiretorio.AppPath(), "Schemas", "CTe"); //acbrCTe.Config.Principal.LogNivel = Keevo.Pacotes.Infra.ACBrLib.Core.NivelLog.logParanoico; //acbrCTe.Config.Principal.LogPath = KeevoDiretorio.AppPath(); acbrCTe.ConfigGravar(); } private static SSLCryptLib GetSSLCryptLib() => ACBrCTe.IsWindows ? SSLCryptLib.cryWinCrypt : SSLCryptLib.cryOpenSSL; private static SSLHttpLib GetSSLHttpLib() => ACBrCTe.IsWindows ? SSLHttpLib.httpWinHttp : SSLHttpLib.httpOpenSSL; public void Dispose() { acbrcte.Dispose(); } } } -
Bom dia a todos! Então, estou fazendo a captura de Ctes para uma determinada empresa, e apenas nela ocorre o erro abaixo: Estou passando como param para o DistribuicaoDFe os seguintes dados: codigonfe = 31 cnpjempresa = 34048121000125 ultimonse = 000000000000000 ArquivoOuXml= "" public string DistribuicaoDFe(int acUFAutor, string eCnpjcpf, string eultNsu, string ArquivoOuXml) System.ApplicationException: 'WebService Distribuição de DFe: - Inativo ou Inoperante tente novamente. Erro Interno: 0 Erro HTTP: 403 URL: https://www1.cte.fazenda.gov.br/CTeDistribuicaoDFe/CTeDistribuicaoDFe.asmx <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>403 - Forbidden: Access is denied.</title> <style type="text/css"> <!-- body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF; background-color:#555555;} #content{margin:0 0 0 2%;position:relative;} .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} --> </style> </head> <body> <div id="header"><h1>Server Error</h1></div> <div id="content"> <div class="content-container"><fieldset> <h2>403 - Forbidden: Access is denied.</h2> <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3> </fieldset></div> </div> </body> </html> Trechos do código: public DistribuicaoDFeResposta<TipoCTe> DistribuicaoDFe() => TratarDfeResposta(acbrcte.DistribuicaoDFe(empresacte.codigonfe.ToInt(), empresacte.cnpj, empresacte.ultimonsu ?? ("0").PadLeft(15, '0'), "")); public string DistribuicaoDFe(int acUFAutor, string eCnpjcpf, string eultNsu, string ArquivoOuXml) { int bufferLen = 256; StringBuilder buffer = new StringBuilder(bufferLen); CTE_DistribuicaoDFe method = GetMethod<CTE_DistribuicaoDFe>(); int ret = ExecuteMethod(() => method(libHandle, acUFAutor, ACBrLibHandle.ToUTF8(eCnpjcpf), ACBrLibHandle.ToUTF8(eultNsu), ACBrLibHandle.ToUTF8(ArquivoOuXml), buffer, ref bufferLen)); CheckResult(ret); return ProcessResult(buffer, bufferLen); } Desde já agradeço !
-
Bom dia a todos; Gostaria de saber onde consigo baixar o ACBrNFCom? E se já esta adaptado para utilizarmos no VB6?
-
Consegui capturar o mesmo erro, mas ele agora deu uma mensagem que não havia percebido: Notem o último erro. AcbrCTeServico - antes de instanciar acbrcte (dotnet:28): GLib-GObject-WARNING **: 16:38:30.221: cannot register existing type 'GdkDisplayManager' (dotnet:28): GLib-CRITICAL **: 16:38:30.221: g_once_init_leave: assertion 'result != 0' failed (dotnet:28): GLib-GObject-CRITICAL **: 16:38:30.221: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed (dotnet:28): GLib-GObject-WARNING **: 16:38:30.221: invalid (NULL) pointer instance (dotnet:28): GLib-GObject-CRITICAL **: 16:38:30.221: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed (dotnet:28): GLib-GObject-WARNING **: 16:38:30.221: invalid (NULL) pointer instance (dotnet:28): GLib-GObject-CRITICAL **: 16:38:30.222: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed (dotnet:28): GLib-GObject-WARNING **: 16:38:30.222: cannot register existing type 'GdkDisplay' (dotnet:28): GLib-CRITICAL **: 16:38:30.222: g_once_init_leave: assertion 'result != 0' failed (dotnet:28): GLib-GObject-CRITICAL **: 16:38:30.222: g_type_register_static: assertion 'parent_type > 0' failed (dotnet:28): GLib-CRITICAL **: 16:38:30.223: g_once_init_leave: assertion 'result != 0' failed (dotnet:28): GLib-GObject-CRITICAL **: 16:38:30.223: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed Segmentation fault (core dumped) xvfb-run: error: problem while cleaning up temporary directory
-
O meu arquivo dockerfile está configurado da seguinte forma: Está faltando alguma instalação? Vi que no post do Julio Cavalcanti, temos instalação de itens a mais. #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base RUN apt update && apt-get install -y libxml2 libxslt-dev libgtk2.0-0 xvfb WORKDIR /app EXPOSE 80 EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY src/WebApis/Api.Dfe/*.csproj ./ COPY src/nuget.config ./ RUN dotnet restore "Api.Dfe.csproj" /p:Configuration="Release" --configfile "./nuget.config" COPY src/WebApis/Api.Dfe/ ./ WORKDIR "/src" RUN dotnet build "Api.Dfe.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "Api.Dfe.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . #https://stackoverflow.com/questions/60934639/install-fonts-in-linux-container-for-asp-net-core # RUN echo "deb http://deb.debian.org/debian/ bookworm main contrib" > /etc/apt/sources.list && \ # echo "deb-src http://deb.debian.org/debian/ bookworm main contrib" >> /etc/apt/sources.list && \ # echo "deb http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list && \ # echo "deb-src http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig # ENV DISPLAY :99 # RUN chmod 0755 /app/start.sh # ENTRYPOINT ["bash", "start.sh"] # ENTRYPOINT ["xvfb-run", "dotnet", "Api.Dfe.dll"] ENTRYPOINT ["/bin/sh", "-c", "/usr/bin/xvfb-run -a $@", ""] CMD ["dotnet", "Api.Dfe.dll"]
-
Atualizei as dlls agora, vou testar e reporto.