Bom dia a todos!
Tive problema no GINFES de São Caetano do Sul - SP em relação a busca automática após o envio da NFSE, tem horas que ele retorna a busca do lote sem apresentar qualquer erro e dá o resultado como falso. Eu modifiquei essa função adicionando um loop que ficar até ele trazer um erro ou dar OK. Até o presente momento funcionou certinho, se puderem avaliar a função e verificar se tem como deixar fixo no componente para posteriores atualizações ou então propor uma solução melhor, desde já agradeço. Segue abaixo a copia da rotina de envio alterada :
function TWebServices.Envia(ALote: String): Boolean;
begin
self.Enviar.FNumeroLote := ALote;
Result := Self.Enviar.Executar;
if not (Result)
then begin
if Assigned(TACBrNFSe( FACBrNFSe ).OnGerarLog)
then TACBrNFSe( FACBrNFSe ).OnGerarLog(Self.Enviar.Msg);
if Self.Enviar.Msg <> ''
then raise Exception.Create(Self.Enviar.Msg)
else raise Exception.Create('Erro Desconhecido!')
end;
if (TACBrNFSe( FACBrNFSe ).Configuracoes.WebServices.ConsultaLoteAposEnvio) and (Result) then
begin
Self.ConsSitLote.Cnpj := TACBrNFSe( FACBrNFSe ).NotasFiscais.Items[0].NFSe.Prestador.Cnpj;
Self.ConsSitLote.InscricaoMunicipal := TACBrNFSe( FACBrNFSe ).NotasFiscais.Items[0].NFSe.Prestador.InscricaoMunicipal;
Self.ConsSitLote.Protocolo := Self.Enviar.Protocolo;
Self.ConsLote.Protocolo := Self.Enviar.Protocolo;
if not (TACBrNFSe( FACBrNFSe ).Configuracoes.WebServices.Provedor in [profintelISS, proSaatri, proISSDigital, proFiorilli]) then
begin
Result := Self.ConsSitLote.Executar;
while (not Result) and (Self.ConsSitLote.Msg = '') do
begin
Sleep(1000);
Result := Self.ConsSitLote.Executar;
end;
if not (Result)
then begin
if Assigned(TACBrNFSe( FACBrNFSe ).OnGerarLog)
then TACBrNFSe( FACBrNFSe ).OnGerarLog(Self.ConsSitLote.Msg);
raise Exception.Create(Self.ConsSitLote.Msg);
end;
end;
Result := Self.ConsLote.Executar;
while (not Result) and (Self.ConsLote.Msg = '') do
begin
Sleep(1000);
Result := Self.ConsLote.Executar;
end;
if not (Result)
then begin
if Assigned(TACBrNFSe( FACBrNFSe ).OnGerarLog)
then TACBrNFSe( FACBrNFSe ).OnGerarLog(Self.ConsLote.Msg);
raise Exception.Create(Self.ConsLote.Msg);
end;
end;
end;