Rev 106 | Rev 195 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 106 | Rev 170 | ||
|---|---|---|---|
| Line 22... | Line 22... | ||
| 22 | import br.com.ec.domain.model.NotaFiscal; |
22 | import br.com.ec.domain.model.NotaFiscal; |
| 23 | import br.com.ec.domain.model.NotaFiscalProduto; |
23 | import br.com.ec.domain.model.NotaFiscalProduto; |
| 24 | import br.com.ec.domain.model.Pessoa; |
24 | import br.com.ec.domain.model.Pessoa; |
| 25 | import br.com.ec.domain.model.Produto; |
25 | import br.com.ec.domain.model.Produto; |
| 26 | import br.com.ec.domain.model.ProdutoLoja; |
26 | import br.com.ec.domain.model.ProdutoLoja; |
| 27 | import br.com.ec.domain.model.tipos.TipoModeloNotaFiscal; |
- | |
| 28 | import br.com.ec.domain.model.tipos.TipoNotaFiscal; |
- | |
| 29 | import br.com.ec.domain.model.tipos.TipoRelatorio; |
27 | import br.com.ec.domain.model.tipos.TipoRelatorio; |
| - | 28 | import br.com.ec.domain.model.tipos.nfe.TipoModeloNotaFiscal; |
|
| - | 29 | import br.com.ec.domain.model.tipos.nfe.TipoNotaFiscal; |
|
| 30 | import br.com.ec.domain.service.emissor.notafiscal.EmissorNotaFiscalEletronicaService; |
30 | import br.com.ec.domain.service.emissor.notafiscal.EmissorNotaFiscalEletronicaService; |
| 31 | import br.com.ec.domain.service.notafiscal.NotaFiscalProdutoService; |
31 | import br.com.ec.domain.service.notafiscal.NotaFiscalProdutoService; |
| 32 | import br.com.ec.domain.service.notafiscal.NotaFiscalService; |
32 | import br.com.ec.domain.service.notafiscal.NotaFiscalService; |
| 33 | import br.com.ec.domain.service.pessoa.PessoaService; |
33 | import br.com.ec.domain.service.pessoa.PessoaService; |
| 34 | import br.com.ec.domain.service.produto.ProdutoService; |
34 | import br.com.ec.domain.service.produto.ProdutoService; |
| Line 171... | Line 171... | ||
| 171 | @Override |
171 | @Override |
| 172 | public void cadastrar(final NotaFiscal notaFiscal) { |
172 | public void cadastrar(final NotaFiscal notaFiscal) { |
| 173 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
173 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 174 | public void execute() { |
174 | public void execute() { |
| 175 | notaFiscal.setDataHoraEmissao(DataUtils.getDataAtual()); |
175 | notaFiscal.setDataHoraEmissao(DataUtils.getDataAtual()); |
| 176 | notaFiscal.setTipoNotaFiscal(TipoNotaFiscal.NFCE_EMITIDA.getValor()); |
- | |
| - | 176 | notaFiscal.setTipoNotaFiscal(TipoNotaFiscal.NFCE_SAIDA.getValor()); |
|
| 177 | notaFiscal.setTipoModeloNotaFiscal(TipoModeloNotaFiscal.MODELO_NFCE_65.getValor()); |
177 | notaFiscal.setTipoModeloNotaFiscal(TipoModeloNotaFiscal.MODELO_NFCE_65.getValor()); |
| 178 | getService().cadastrar(notaFiscal); |
178 | getService().cadastrar(notaFiscal); |
| 179 | limparEntidade(); |
179 | limparEntidade(); |
| 180 | LancadorMensagem.lancarSucesso(getMensagens().get(IDENTIFICADOR_MENSAGEM_CADASTRADO_COM_SUCESSO)); |
180 | LancadorMensagem.lancarSucesso(getMensagens().get(IDENTIFICADOR_MENSAGEM_CADASTRADO_COM_SUCESSO)); |
| 181 | }
|
181 | }
|
| Line 214... | Line 214... | ||
| 214 | NotaFiscal notaFiscal = new NotaFiscal(); |
214 | NotaFiscal notaFiscal = new NotaFiscal(); |
| 215 | notaFiscal.setTipoModeloNotaFiscal(TipoModeloNotaFiscal.MODELO_NFE_55.getValor()); |
215 | notaFiscal.setTipoModeloNotaFiscal(TipoModeloNotaFiscal.MODELO_NFE_55.getValor()); |
| 216 | notaFiscal.setTipoNotaFiscal(TipoNotaFiscal.NFE_REMESSA.getValor()); |
216 | notaFiscal.setTipoNotaFiscal(TipoNotaFiscal.NFE_REMESSA.getValor()); |
| 217 | notaFiscal.setSerie(TipoNotaFiscal.NFE_REMESSA.getSerie()); |
217 | notaFiscal.setSerie(TipoNotaFiscal.NFE_REMESSA.getSerie()); |
| 218 | notaFiscal.setDataHoraEmissao(DataUtils.getDataAtual()); |
218 | notaFiscal.setDataHoraEmissao(DataUtils.getDataAtual()); |
| 219 | notaFiscal.setPessoaJuridicaEmitente(getNotaFiscalRemessa().getLojaEmitente().getPessoaJuridica()); |
- | |
| 220 | notaFiscal.setPessoaJuridicaDestinatario(getNotaFiscalRemessa().getLojaDestino().getPessoaJuridica()); |
- | |
| - | 219 | notaFiscal.setPessoaEmitente(getNotaFiscalRemessa().getLojaEmitente().getPessoaJuridica()); |
|
| - | 220 | notaFiscal.setPessoaDestinatario(getNotaFiscalRemessa().getLojaDestino().getPessoaJuridica()); |
|
| 221 | notaFiscalService.alterar(notaFiscal); |
221 | notaFiscalService.alterar(notaFiscal); |
| 222 | getNotaFiscalRemessa().preencherDadosNotaFiscal(notaFiscal); |
222 | getNotaFiscalRemessa().preencherDadosNotaFiscal(notaFiscal); |
| 223 | getNotaFiscalRemessa().setPessoaJuridicaEmitente(getNotaFiscalRemessa().getLojaEmitente().getPessoaJuridica()); |
- | |
| 224 | getNotaFiscalRemessa().setPessoaJuridicaDestinatario(getNotaFiscalRemessa().getLojaDestino().getPessoaJuridica()); |
- | |
| - | 223 | getNotaFiscalRemessa().setPessoaEmitente(getNotaFiscalRemessa().getLojaEmitente().getPessoaJuridica()); |
|
| - | 224 | getNotaFiscalRemessa().setPessoaDestinatario(getNotaFiscalRemessa().getLojaDestino().getPessoaJuridica()); |
|
| 225 | setCodigoProdutoRemessa(null); |
225 | setCodigoProdutoRemessa(null); |
| 226 | LancadorMensagem.lancarSucesso("REMESSA INICIADA COM SUCESSO"); |
226 | LancadorMensagem.lancarSucesso("REMESSA INICIADA COM SUCESSO"); |
| 227 | }
|
227 | }
|
| 228 | }); |
228 | }); |
| 229 | }
|
229 | }
|
| Line 288... | Line 288... | ||
| 288 | 288 | ||
| 289 | public void emitirNfeRemessa() { |
289 | public void emitirNfeRemessa() { |
| 290 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
290 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 291 | public void execute() { |
291 | public void execute() { |
| 292 | NotaFiscal notaFiscal = notaFiscalService.detalhar(getEntidade()); |
292 | NotaFiscal notaFiscal = notaFiscalService.detalhar(getEntidade()); |
| 293 | notaFiscal.setPessoaJuridicaEmitente(pessoaService.detalharPessoa(notaFiscal.getPessoaJuridicaEmitente())); |
- | |
| 294 | notaFiscal.setPessoaJuridicaDestinatario(pessoaService.detalharPessoa(notaFiscal.getPessoaJuridicaDestinatario())); |
- | |
| - | 293 | notaFiscal.setPessoaEmitente(pessoaService.detalharPessoa(notaFiscal.getPessoaEmitente())); |
|
| - | 294 | notaFiscal.setPessoaDestinatario(pessoaService.detalharPessoa(notaFiscal.getPessoaDestinatario())); |
|
| 295 | notaFiscal.setListaNFRemessaProdutos(notaFiscalProdutoService.consultarProdutosDaNotaFiscal(getEntidade())); |
295 | notaFiscal.setListaNFRemessaProdutos(notaFiscalProdutoService.consultarProdutosDaNotaFiscal(getEntidade())); |
| 296 | emissorNotaFiscalEletronicaService.enviarNotaFiscalEletronicaRemessa(notaFiscal); |
296 | emissorNotaFiscalEletronicaService.enviarNotaFiscalEletronicaRemessa(notaFiscal); |
| 297 | LancadorMensagem.lancarSucesso("NOTA FISCAL DE REMESSA: EMITIDA COM SUCESSO"); |
297 | LancadorMensagem.lancarSucesso("NOTA FISCAL DE REMESSA: EMITIDA COM SUCESSO"); |
| 298 | }
|
298 | }
|
| 299 | }); |
299 | }); |
| - | 300 | }
|
|
| - | 301 | ||
| - | 302 | // TODO: MÉTODO PROVISÓRIO
|
|
| - | 303 | public void emitirNfeDevolucao() { |
|
| - | 304 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 305 | public void execute() { |
|
| - | 306 | emissorNotaFiscalEletronicaService.emitirNotaFiscalEletronicaDireta(); |
|
| - | 307 | LancadorMensagem.lancarSucesso("NOTA FISCAL: EMITIDA COM SUCESSO"); |
|
| - | 308 | }
|
|
| - | 309 | }); |
|
| - | 310 | }
|
|
| - | 311 | ||
| - | 312 | public void selecionarEmitente(final Pessoa pessoa) { |
|
| - | 313 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 314 | public void execute() { |
|
| - | 315 | getEntidade().setPessoaEmitente(pessoa); |
|
| - | 316 | adicionandoParametroArgsConfirmandoAcao(true); |
|
| - | 317 | }
|
|
| - | 318 | }); |
|
| - | 319 | }
|
|
| - | 320 | ||
| - | 321 | public void retirarEmitente() { |
|
| - | 322 | getEntidade().setPessoaEmitente(null); |
|
| - | 323 | }
|
|
| - | 324 | ||
| - | 325 | public void selecionarDestinatario(final Pessoa pessoa) { |
|
| - | 326 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 327 | public void execute() { |
|
| - | 328 | getEntidade().setPessoaDestinatario(pessoa); |
|
| - | 329 | adicionandoParametroArgsConfirmandoAcao(true); |
|
| - | 330 | }
|
|
| - | 331 | }); |
|
| - | 332 | }
|
|
| - | 333 | ||
| - | 334 | public void retirarDestinatario() { |
|
| - | 335 | getEntidade().setPessoaDestinatario(null); |
|
| 300 | }
|
336 | }
|
| 301 | 337 | ||
| 302 | /*
|
338 | /*
|
| 303 | private void verificarParametros(TransferenciaProduto transferenciaProduto) {
|
339 | private void verificarParametros(TransferenciaProduto transferenciaProduto) {
|
| 304 | if (VerificadorUtil.estaNulo(transferenciaProduto.getQuantidadeTransferir()) || transferenciaProduto.getQuantidadeTransferir().equals(0)) {
|
340 | if (VerificadorUtil.estaNulo(transferenciaProduto.getQuantidadeTransferir()) || transferenciaProduto.getQuantidadeTransferir().equals(0)) {
|
| Line 311... | Line 347... | ||
| 311 | if (getEntidade().verificarSeProdutoJaConstaNaLista(sequencialProduto)) {
|
347 | if (getEntidade().verificarSeProdutoJaConstaNaLista(sequencialProduto)) {
|
| 312 | throw new NegocioException("Produto já foi adicionando anteriormente!");
|
348 | throw new NegocioException("Produto já foi adicionando anteriormente!");
|
| 313 | }
|
349 | }
|
| 314 | }
|
350 | }
|
| 315 | */
|
351 | */
|
| 316 | - | ||
| 317 | public void selecionarPessoaJuridica(final Pessoa pessoa) { |
- | |
| 318 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
- | |
| 319 | public void execute() { |
- | |
| 320 | getEntidade().setPessoaJuridicaEmitente(pessoa); |
- | |
| 321 | adicionandoParametroArgsConfirmandoAcao(true); |
- | |
| 322 | }
|
- | |
| 323 | }); |
- | |
| 324 | }
|
- | |
| 325 | - | ||
| 326 | public void retirarPessoaJuridica() { |
- | |
| 327 | getEntidade().setPessoaJuridicaEmitente(null); |
- | |
| 328 | }
|
- | |
| 329 | 352 | ||
| 330 | // MÉTODO PARCIAL
|
353 | // MÉTODO PARCIAL
|
| 331 | public void adicionarEstoqueProdutos() { |
354 | public void adicionarEstoqueProdutos() { |
| 332 | // FORNECEDORES: "MULTILASER" 29, "VIVONA25" 25, "JBL HARMAN" 38, "HUSKY" 40, "BHX ENERGY" 37, "KINGO" 30, "GBMAX" 70,
|
355 | // FORNECEDORES: "MULTILASER" 29, "VIVONA25" 25, "JBL HARMAN" 38, "HUSKY" 40, "BHX ENERGY" 37, "KINGO" 30, "GBMAX" 70,
|
| 333 | // "GIFFY" 32, "RCELL" 34, "TTNT" 60, "YASIN" 68, "DL COMERCIO" 71
|
356 | // "GIFFY" 32, "RCELL" 34, "TTNT" 60, "YASIN" 68, "DL COMERCIO" 71
|