Ir para conteúdo
  • Cadastre-se

dev botao

Temanifdestopernaorealizada


Ver Solução Respondido por André Ferreira de Moraes,
  • Este tópico foi criado há 3312 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

  • Membros Pro

       if tipo=1 then
          infEvento.tpEvento := teManifDestConfirmacao else
       if tipo=2 then
          infEvento.tpEvento := teManifDestDesconhecimento else
       if tipo=3 then
          infEvento.tpEvento := teManifDestOperNaoRealizada else
       if tipo=4 then
          infEvento.tpEvento := teManifDestCiencia;
 

 

todos funciona , mais o teManifDestOperNaoRealizada ta dando este erro

 

 

//////////////////////////////////////////////

 

function TForm_Manifesto.Manifestar(tipo: Integer): Boolean;
var
 Chave, idLote, CNPJ, vXMotivo: string;
 lMsg: string;
begin

 try

    Chave:=DM11.Client_ManifestoCHAVE_NFE.Text;

    CNPJ:=Form_NFe.edtEmitCNPJ.Text;


    Chave := Trim(OnlyNumber(Chave));
    idLote := '1';


    //Form_NFe.ACBrNFe1.NotasFiscais.Clear;
    Form_NFe.ACBrNFe1.EventoNFe.Evento.Clear;
    Form_NFe.ACBrNFe1.EventoNFe.idLote := StrToInt(IDLote);


    with Form_NFe.ACBrNFe1.EventoNFe.Evento.Add do
     begin
       infEvento.chNFe := Chave;
       infEvento.CNPJ   := CNPJ;
       infEvento.dhEvento := now;


       if tipo=1 then
          infEvento.tpEvento := teManifDestConfirmacao else
       if tipo=2 then
          infEvento.tpEvento := teManifDestDesconhecimento else
       if tipo=3 then
          infEvento.tpEvento := teManifDestOperNaoRealizada else
       if tipo=4 then
          infEvento.tpEvento := teManifDestCiencia;

     end;
    //Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote));


     if DM11.Client_ManifestoCIDADE.Text='MATO GROSSO - MT' then
     Form_NFe.ACBrNFe1.EventoNFe.Evento.Items[0].InfEvento.cOrgao := 91;


        if Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote)) then
        begin

          if Form_NFe.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].RetInfEvento.cStat = 657 then
          begin
            Form_NFe.ACBrNFe1.EventoNFe.Evento.Items[0].InfEvento.cOrgao := Form_NFe.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.cOrgao;
            if not Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote)) then
            begin
             { with Form_NFe.ACBrNFe1.WebServices.EnvEvento do
              begin
                raise Exception.Create('Ocorreram erros ao tentar efetuar a manifestação:' + sLineBreak +
                                       'Lote: ' + IntToStr(EventoRetorno.idLote) + sLineBreak +
                                       'Ambiente: ' + TpAmbToStr(EventoRetorno.tpAmb) + sLineBreak +
                                       'Orgao: ' + IntToStr(EventoRetorno.cOrgao) + sLineBreak +
                                       'Status: ' + IntToStr(EventoRetorno.cStat) + sLineBreak +
                                       'Motivo: ' + EventoRetorno.xMotivo);
              end; }
            end;
          end;

        end;


        with Form_NFe.AcbrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].RetInfEvento do
        begin
          vXMotivo:=xMotivo;
          lMsg:=
          'Id: '+Id+#13+
          'tpAmb: '+TpAmbToStr(tpAmb)+#13+
          'verAplic: '+verAplic+#13+
          'cOrgao: '+IntToStr(cOrgao)+#13+
          'cStat: '+IntToStr(cStat)+#13+
          'xMotivo: '+xMotivo+#13+
          'chNFe: '+chNFe+#13+
          'tpEvento: '+TpEventoToStr(tpEvento)+#13+
          'xEvento: '+xEvento+#13+
          'nSeqEvento: '+IntToStr(nSeqEvento)+#13+
          'CNPJDest: '+CNPJDest+#13+
          'emailDest: '+emailDest+#13+
          'dhRegEvento: '+DateTimeToStr(dhRegEvento)+#13+
          'nProt: '+nProt;
        end;


        if Pos('registrado e vinculado', vXMotivo )>0 then
        begin

          try

          DM.SQL_PRATUDO.Close;
          DM.SQL_PRATUDO.CommandText:=
          'UPDATE N_MANIFESTO SET DATAMANIFESTO=:A, TIPOMANIFESTO='+IntToStr(tipo)+' '+
          'WHERE ID='+DM11.Client_ManifestoID.Text+' ';
          DM.SQL_PRATUDO.ParamByName('A').AsDate:= StrToDate(  FormatDateTime('dd/mm/yyyy',Now)  );
          DM.SQL_PRATUDO.ExecSQL;

          Commit( DM.SQL_PRATUDO );

          except
             MessagemH(1,'Erro ao salvar o evento do manifesto !');
          end;

        end else
        begin
           if tipo=1 then
              NFEM_CancelarProcesso:=1;

           ShowMessage(lMsg);
        end;




    Form_NFe.MemoResp.Lines.Text := UTF8Encode(Form_NFe.ACBrNFe1.WebServices.EnvEvento.RetWS);
    Form_NFe.memoRespWS.Lines.Text := UTF8Encode(Form_NFe.ACBrNFe1.WebServices.EnvEvento.RetornoWS);
  //  ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].XXXX
    Form_NFe.LoadXML(Form_NFe.MemoResp, Form_NFe.WBResposta);

 except

          on E: Exception do
          begin

            if tipo=1 then
               NFEM_CancelarProcesso:=1;

             MessagemH(2,'Erro ao enviar evento de manifesto !'+#13+
             E.Message);

          end;

 end;






end;

post-4970-0-93372600-1429104447_thumb.pn

Editado por hetoandrade
Link para o comentário
Compartilhar em outros sites

×
×
  • 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.