Rev 413 | Rev 425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 413 | Rev 414 | ||
|---|---|---|---|
| Line 3... | Line 3... | ||
| 3 | import java.io.Serializable; |
3 | import java.io.Serializable; |
| 4 | 4 | ||
| 5 | import javax.inject.Inject; |
5 | import javax.inject.Inject; |
| 6 | import javax.inject.Named; |
6 | import javax.inject.Named; |
| 7 | 7 | ||
| - | 8 | import org.primefaces.model.StreamedContent; |
|
| 8 | import org.springframework.context.annotation.Scope; |
9 | import org.springframework.context.annotation.Scope; |
| 9 | 10 | ||
| 10 | import br.com.ec.controller.consultademanda.NotaFiscalConsultaPorDemanda; |
11 | import br.com.ec.controller.consultademanda.NotaFiscalConsultaPorDemanda; |
| 11 | import br.com.ec.core.generic.GenericService; |
12 | import br.com.ec.core.generic.GenericService; |
| 12 | import br.com.ec.domain.dto.consulta.ParametrosConsultaNotaFiscal; |
13 | import br.com.ec.domain.dto.consulta.ParametrosConsultaNotaFiscal; |
| 13 | import br.com.ec.domain.model.NotaFiscal; |
14 | import br.com.ec.domain.model.NotaFiscal; |
| 14 | import br.com.ec.domain.model.Venda; |
15 | import br.com.ec.domain.model.Venda; |
| 15 | import br.com.ec.domain.model.nfe.TipoNotaFiscal; |
16 | import br.com.ec.domain.model.nfe.TipoNotaFiscal; |
| - | 17 | import br.com.ec.domain.service.EmissorRelatorioService; |
|
| 16 | import br.com.ec.domain.service.NotaFiscalService; |
18 | import br.com.ec.domain.service.NotaFiscalService; |
| 17 | import br.com.ec.web.exception.VerificadorLancamentoException; |
19 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 18 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
20 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 19 | import br.com.ec.web.generic.AbstractBean; |
21 | import br.com.ec.web.generic.AbstractBean; |
| 20 | import br.com.ec.web.message.LancadorMensagem; |
22 | import br.com.ec.web.message.LancadorMensagem; |
| Line 25... | Line 27... | ||
| 25 | public class NotaFiscalBean extends AbstractBean<NotaFiscal> implements Serializable { |
27 | public class NotaFiscalBean extends AbstractBean<NotaFiscal> implements Serializable { |
| 26 | 28 | ||
| 27 | private static final long serialVersionUID = 1L; |
29 | private static final long serialVersionUID = 1L; |
| 28 | 30 | ||
| 29 | private NotaFiscalService notaFiscalService; |
31 | private NotaFiscalService notaFiscalService; |
| - | 32 | private EmissorRelatorioService emissorRelatorioService; |
|
| 30 | 33 | ||
| 31 | private ParametrosConsultaNotaFiscal parametrosConsultaNotaFiscal; |
34 | private ParametrosConsultaNotaFiscal parametrosConsultaNotaFiscal; |
| 32 | private NotaFiscalConsultaPorDemanda lazy; |
35 | private NotaFiscalConsultaPorDemanda lazy; |
| 33 | 36 | ||
| 34 | private Long sequencialVendaParaVinculo; |
37 | private Long sequencialVendaParaVinculo; |
| - | 38 | private StreamedContent danfeNfe; |
|
| 35 | 39 | ||
| 36 | @Inject |
40 | @Inject |
| 37 | public NotaFiscalBean(NotaFiscalConsultaPorDemanda lazy, NotaFiscalService notaFiscalService) { |
- | |
| - | 41 | public NotaFiscalBean(NotaFiscalConsultaPorDemanda lazy, NotaFiscalService notaFiscalService, EmissorRelatorioService emissorRelatorioService) { |
|
| 38 | this.lazy = lazy; |
42 | this.lazy = lazy; |
| 39 | this.notaFiscalService = notaFiscalService; |
43 | this.notaFiscalService = notaFiscalService; |
| - | 44 | this.emissorRelatorioService = emissorRelatorioService; |
|
| 40 | }
|
45 | }
|
| 41 | 46 | ||
| 42 | @Override |
47 | @Override |
| 43 | public void preCarregamento() { |
48 | public void preCarregamento() { |
| 44 | parametrosConsultaNotaFiscal = new ParametrosConsultaNotaFiscal(); |
49 | parametrosConsultaNotaFiscal = new ParametrosConsultaNotaFiscal(); |
| Line 95... | Line 100... | ||
| 95 | public Long getSequencialVendaParaVinculo() { |
100 | public Long getSequencialVendaParaVinculo() { |
| 96 | return sequencialVendaParaVinculo; |
101 | return sequencialVendaParaVinculo; |
| 97 | }
|
102 | }
|
| 98 | public void setSequencialVendaParaVinculo(Long sequencialVendaParaVinculo) { |
103 | public void setSequencialVendaParaVinculo(Long sequencialVendaParaVinculo) { |
| 99 | this.sequencialVendaParaVinculo = sequencialVendaParaVinculo; |
104 | this.sequencialVendaParaVinculo = sequencialVendaParaVinculo; |
| - | 105 | }
|
|
| - | 106 | ||
| - | 107 | public StreamedContent getDanfeNfe() { |
|
| - | 108 | return danfeNfe; |
|
| - | 109 | }
|
|
| - | 110 | public void setDanfeNfe(StreamedContent danfeNfe) { |
|
| - | 111 | this.danfeNfe = danfeNfe; |
|
| 100 | }
|
112 | }
|
| 101 | 113 | ||
| 102 | /**************************************************/
|
114 | /**************************************************/
|
| 103 | 115 | ||
| 104 | public void desvincularVenda() { |
116 | public void desvincularVenda() { |
| Line 117... | Line 129... | ||
| 117 | Venda vendaVinculada = notaFiscalService.vincularVenda(getEntidade().getSequencial(), getSequencialVendaParaVinculo()); |
129 | Venda vendaVinculada = notaFiscalService.vincularVenda(getEntidade().getSequencial(), getSequencialVendaParaVinculo()); |
| 118 | getEntidade().setVenda(vendaVinculada); |
130 | getEntidade().setVenda(vendaVinculada); |
| 119 | LancadorMensagem.lancarSucesso("VENDA VINCULADA COM SUCESSO"); |
131 | LancadorMensagem.lancarSucesso("VENDA VINCULADA COM SUCESSO"); |
| 120 | }
|
132 | }
|
| 121 | }); |
133 | }); |
| - | 134 | }
|
|
| - | 135 | ||
| - | 136 | public void emitirDanfeNfe(Long sequencialNotaFiscal) { |
|
| - | 137 | setDanfeNfe(notaFiscalService.gerarDanfeNfe(sequencialNotaFiscal)); |
|
| - | 138 | /*
|
|
| - | 139 | return new VerificadorLancamentoException().verificarLancamentoException(new CommandRelatorioStreamedContent() {
|
|
| - | 140 | @Override
|
|
| - | 141 | public StreamedContent execute() {
|
|
| - | 142 | return notaFiscalService.gerarDanfeNfe(getEntidade().getSequencial());
|
|
| - | 143 | }
|
|
| - | 144 | });
|
|
| - | 145 | */
|
|
| 122 | }
|
146 | }
|
| 123 | 147 | ||
| 124 | /*
|
148 | /*
|
| 125 | private StreamedContent chart;
|
149 | private StreamedContent chart;
|
| 126 | public StreamedContent getChart() {
|
150 | public StreamedContent getChart() {
|