Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.controller.managedbean; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | import java.util.List; |
||
| 5 | |||
| 6 | import javax.inject.Inject; |
||
| 7 | import javax.inject.Named; |
||
| 8 | |||
| 9 | import org.springframework.context.annotation.Scope; |
||
| 10 | |||
| 11 | import br.com.ec.domain.model.EstoqueAuditoria; |
||
| 12 | import br.com.ec.domain.model.Loja; |
||
| 13 | import br.com.ec.domain.service.estoqueauditoria.EstoqueAuditoriaService; |
||
| 14 | import br.com.ec.domain.service.loja.LojaService; |
||
| 15 | import br.edu.cesmac.core.consulta.ParametrosConsulta; |
||
| 16 | import br.edu.cesmac.core.generic.GenericService; |
||
| 17 | import br.edu.cesmac.core.util.VerificadorUtil; |
||
| 18 | import br.edu.cesmac.web.generic.AbstractBean; |
||
| 19 | |||
| 20 | @Named |
||
| 21 | @Scope("view") |
||
| 22 | public class InformarAvariaBean extends AbstractBean<EstoqueAuditoria> implements Serializable { |
||
| 23 | |||
| 24 | private static final long serialVersionUID = 1L; |
||
| 25 | |||
| 26 | private Loja lojaSelecionada; |
||
| 27 | private Integer quantidadeParaAvaria; |
||
| 28 | |||
| 29 | private List<EstoqueAuditoria> listaAvariasDoDia; |
||
| 30 | |||
| 31 | private EstoqueAuditoriaService estoqueAuditoriaService; |
||
| 32 | private LojaService lojaService; |
||
| 33 | |||
| 34 | @Inject |
||
| 35 | public InformarAvariaBean(EstoqueAuditoriaService estoqueAuditoriaService, LojaService lojaService) { |
||
| 36 | this.estoqueAuditoriaService = estoqueAuditoriaService; |
||
| 37 | this.lojaService = lojaService; |
||
| 38 | } |
||
| 39 | |||
| 40 | @Override |
||
| 41 | public void preCarregamento() { |
||
| 42 | if (VerificadorUtil.estaNulo(parametrosConsulta)) { |
||
| 43 | entidade = new EstoqueAuditoria(); |
||
| 44 | parametrosConsulta = new ParametrosConsulta<EstoqueAuditoria>(); |
||
| 45 | parametrosConsulta.setEntidade(entidade); |
||
| 46 | setListaAvariasDoDia(estoqueAuditoriaService.consultarAvariasDoDia(getLojaSelecionada())); |
||
| 47 | } |
||
| 48 | setQuantidadeParaAvaria(1); |
||
| 49 | } |
||
| 50 | |||
| 51 | @Override |
||
| 52 | public void limparEntidade() { |
||
| 53 | setEntidade(new EstoqueAuditoria()); |
||
| 54 | } |
||
| 55 | |||
| 56 | @Override |
||
| 57 | public GenericService<EstoqueAuditoria> getService() { |
||
| 58 | return estoqueAuditoriaService; |
||
| 59 | } |
||
| 60 | |||
| 61 | @Override |
||
| 62 | public EstoqueAuditoria getEntidade() { |
||
| 63 | return entidade; |
||
| 64 | } |
||
| 65 | |||
| 66 | @Override |
||
| 67 | public EstoqueAuditoria getId() { |
||
| 68 | return getEntidade(); |
||
| 69 | } |
||
| 70 | |||
| 71 | public Loja getLojaSelecionada() { |
||
| 72 | if (VerificadorUtil.estaNulo(lojaSelecionada)) { |
||
| 73 | Loja loja = new Loja(); |
||
| 74 | loja.setSequencial(new Long(getParametro("sequencialLoja").toString())); |
||
| 75 | lojaSelecionada = lojaService.consultarPorId(loja); |
||
| 76 | } |
||
| 77 | return lojaSelecionada; |
||
| 78 | } |
||
| 79 | public void setLojaSelecionada(Loja lojaSelecionada) { |
||
| 80 | this.lojaSelecionada = lojaSelecionada; |
||
| 81 | } |
||
| 82 | |||
| 83 | public Integer getQuantidadeParaAvaria() { |
||
| 84 | return quantidadeParaAvaria; |
||
| 85 | } |
||
| 86 | public void setQuantidadeParaAvaria(Integer quantidadeParaAvaria) { |
||
| 87 | this.quantidadeParaAvaria = quantidadeParaAvaria; |
||
| 88 | } |
||
| 89 | |||
| 90 | public List<EstoqueAuditoria> getListaAvariasDoDia() { |
||
| 91 | return listaAvariasDoDia; |
||
| 92 | } |
||
| 93 | public void setListaAvariasDoDia(List<EstoqueAuditoria> listaAvariasDoDia) { |
||
| 94 | this.listaAvariasDoDia = listaAvariasDoDia; |
||
| 95 | } |
||
| 96 | |||
| 97 | } |