-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #407 from robertorp/master
Implementado método que faz uma tentativa de envio para o Recepção e …
- Loading branch information
Showing
6 changed files
with
324 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using CTe.Classes; | ||
using CTe.Classes.Servicos.Recepcao; | ||
using CTe.Classes.Servicos.Recepcao.Retorno; | ||
|
||
namespace CTe.Servicos.EnviarCte | ||
{ | ||
public class RetornoEnviarCte | ||
{ | ||
public retEnviCte RetEnviCte { get; private set; } | ||
public retConsReciCTe RetConsReciCTe { get; private set; } | ||
public cteProc CteProc { get; private set; } | ||
|
||
public RetornoEnviarCte(retEnviCte retEnviCte, retConsReciCTe retConsReciCTe, cteProc cteProc) | ||
{ | ||
RetEnviCte = retEnviCte; | ||
RetConsReciCTe = retConsReciCTe; | ||
CteProc = cteProc; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections.Generic; | ||
using CTe.Classes; | ||
using CTe.Classes.Servicos.Recepcao; | ||
using CTe.Classes.Servicos.Recepcao.Retorno; | ||
using CTe.Servicos.ConsultaRecibo; | ||
using CTe.Servicos.Recepcao; | ||
|
||
namespace CTe.Servicos.EnviarCte | ||
{ | ||
public class ServicoEnviarCte | ||
{ | ||
public RetornoEnviarCte Enviar(int lote, Classes.CTe cte) | ||
{ | ||
ServicoCTeRecepcao servicoRecepcao = new ServicoCTeRecepcao(); | ||
|
||
retEnviCte retEnviCte = servicoRecepcao.CTeRecepcao(lote, new List<Classes.CTe> {cte}); | ||
|
||
if (retEnviCte.cStat != 103) | ||
{ | ||
return new RetornoEnviarCte(retEnviCte, null, null); | ||
} | ||
|
||
ConsultaReciboServico servicoConsultaRecibo = new ConsultaReciboServico(retEnviCte.infRec.nRec); | ||
|
||
retConsReciCTe retConsReciCTe = servicoConsultaRecibo.Consultar(); | ||
|
||
|
||
cteProc cteProc = null; | ||
if (retConsReciCTe.cStat == 104) | ||
{ | ||
|
||
if (retConsReciCTe.protCTe[0].infProt.cStat != 100) | ||
{ | ||
return new RetornoEnviarCte(retEnviCte, retConsReciCTe, null); | ||
} | ||
|
||
cteProc = new cteProc | ||
{ | ||
CTe = cte, | ||
versao = ConfiguracaoServico.Instancia.VersaoLayout, | ||
protCTe = retConsReciCTe.protCTe[0] | ||
}; | ||
} | ||
|
||
return new RetornoEnviarCte(retEnviCte, retConsReciCTe, cteProc); | ||
} | ||
} | ||
} |