Rev 507 | Rev 509 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 507 | Rev 508 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | 4 | ||
| - | 5 | import br.com.ec.core.util.VerificadorUtil; |
|
| 5 | import br.com.ec.domain.model.Loja; |
6 | import br.com.ec.domain.model.Loja; |
| 6 | import br.com.ec.domain.model.Produto; |
7 | import br.com.ec.domain.model.Produto; |
| 7 | import br.com.ec.domain.model.ProdutoLojaId; |
8 | import br.com.ec.domain.model.ProdutoLojaId; |
| 8 | import br.com.ec.domain.model.Usuario; |
9 | import br.com.ec.domain.model.Usuario; |
| 9 | 10 | ||
| 10 | public class ProdutoLojaDTO { |
11 | public class ProdutoLojaDTO { |
| 11 | 12 | ||
| 12 | private Long sequencialProduto; |
13 | private Long sequencialProduto; |
| - | 14 | private LojaDTO lojaDTO; |
|
| - | 15 | private Integer quantidadeEstoque; |
|
| 13 | 16 | ||
| 14 | /*
|
17 | /*
|
| 15 | private ProdutoLojaId produtoLojaId;
|
18 | private ProdutoLojaId produtoLojaId;
|
| 16 | private Produto produto;
|
19 | private Produto produto;
|
| 17 | private Loja loja;
|
20 | private Loja loja;
|
| Line 23... | Line 26... | ||
| 23 | private Usuario usuarioUltimaContagem;
|
26 | private Usuario usuarioUltimaContagem;
|
| 24 | private Usuario usuarioUltimaContagemPreparacao;
|
27 | private Usuario usuarioUltimaContagemPreparacao;
|
| 25 | private String localizacao;
|
28 | private String localizacao;
|
| 26 | private Boolean indicadorContagemSolicitada = false;
|
29 | private Boolean indicadorContagemSolicitada = false;
|
| 27 | */
|
30 | */
|
| - | 31 | ||
| - | 32 | private Integer quantidadeMinimaTransferir; |
|
| - | 33 | private Integer quantidadeVendida; |
|
| - | 34 | private Integer quantidadeParaTransferir; |
|
| - | 35 | private Boolean indicadorSolicitarTransferencia = false; |
|
| 28 | 36 | ||
| 29 | public ProdutoLojaDTO() { |
37 | public ProdutoLojaDTO() { |
| 30 | }
|
38 | }
|
| 31 | 39 | ||
| - | 40 | public static String CONSULTA_DTO_COMPLETA_QUANTIDADE_VENDAS = "e.produto.sequencial, e.loja.sequencial, e.quantidadeEstoque"; // + QUANTIDADE_VENDIDA |
|
| - | 41 | public ProdutoLojaDTO(Long sequencialProduto, Long sequencialLoja, Integer quantidadeEstoque, Long quantidadeVendida) { |
|
| - | 42 | this.sequencialProduto = sequencialProduto; |
|
| - | 43 | this.lojaDTO = new LojaDTO(sequencialLoja); |
|
| - | 44 | this.quantidadeEstoque = quantidadeEstoque; |
|
| - | 45 | if (VerificadorUtil.naoEstaNulo(quantidadeVendida)) { |
|
| - | 46 | this.quantidadeVendida = quantidadeVendida.intValue(); |
|
| - | 47 | } else { |
|
| - | 48 | this.quantidadeVendida = 0; |
|
| - | 49 | }
|
|
| - | 50 | }
|
|
| - | 51 | ||
| - | 52 | public Long getSequencialProduto() { |
|
| - | 53 | return sequencialProduto; |
|
| - | 54 | }
|
|
| - | 55 | public void setSequencialProduto(Long sequencialProduto) { |
|
| - | 56 | this.sequencialProduto = sequencialProduto; |
|
| - | 57 | }
|
|
| - | 58 | ||
| - | 59 | public LojaDTO getLojaDTO() { |
|
| - | 60 | return lojaDTO; |
|
| - | 61 | }
|
|
| - | 62 | public void setLojaDTO(LojaDTO lojaDTO) { |
|
| - | 63 | this.lojaDTO = lojaDTO; |
|
| - | 64 | }
|
|
| - | 65 | ||
| - | 66 | public Integer getQuantidadeEstoque() { |
|
| - | 67 | return quantidadeEstoque; |
|
| - | 68 | }
|
|
| - | 69 | public void setQuantidadeEstoque(Integer quantidadeEstoque) { |
|
| - | 70 | this.quantidadeEstoque = quantidadeEstoque; |
|
| - | 71 | }
|
|
| - | 72 | ||
| - | 73 | public Integer getQuantidadeMinimaTransferir() { |
|
| - | 74 | return quantidadeMinimaTransferir; |
|
| - | 75 | }
|
|
| - | 76 | public void setQuantidadeMinimaTransferir(Integer quantidadeMinimaTransferir) { |
|
| - | 77 | this.quantidadeMinimaTransferir = quantidadeMinimaTransferir; |
|
| - | 78 | }
|
|
| - | 79 | ||
| - | 80 | public Integer getQuantidadeVendida() { |
|
| - | 81 | return quantidadeVendida; |
|
| - | 82 | }
|
|
| - | 83 | public void setQuantidadeVendida(Integer quantidadeVendida) { |
|
| - | 84 | this.quantidadeVendida = quantidadeVendida; |
|
| - | 85 | }
|
|
| - | 86 | ||
| - | 87 | public Integer getQuantidadeParaTransferir() { |
|
| - | 88 | return quantidadeParaTransferir; |
|
| - | 89 | }
|
|
| - | 90 | public void setQuantidadeParaTransferir(Integer quantidadeParaTransferir) { |
|
| - | 91 | this.quantidadeParaTransferir = quantidadeParaTransferir; |
|
| - | 92 | }
|
|
| - | 93 | ||
| - | 94 | public Boolean getIndicadorSolicitarTransferencia() { |
|
| - | 95 | return indicadorSolicitarTransferencia; |
|
| - | 96 | }
|
|
| - | 97 | public void setIndicadorSolicitarTransferencia(Boolean indicadorSolicitarTransferencia) { |
|
| - | 98 | this.indicadorSolicitarTransferencia = indicadorSolicitarTransferencia; |
|
| - | 99 | }
|
|
| 32 | 100 | ||
| 33 | /*******************************************/
|
101 | /*******************************************/
|
| - | 102 | ||
| - | 103 | public Integer quantidadeParaComprar(Integer quantidadeVendas, Integer quantidadeEstoque) { |
|
| - | 104 | return (getQuantidadeMinimaTransferir() * quantidadeVendas) - quantidadeEstoque; |
|
| - | 105 | }
|
|
| - | 106 | ||
| - | 107 | public Integer quantidadeParaTransferir() { |
|
| - | 108 | if (VerificadorUtil.estaNulo(getQuantidadeVendida())) { |
|
| - | 109 | setQuantidadeVendida(0); |
|
| - | 110 | }
|
|
| - | 111 | if (VerificadorUtil.estaNulo(getQuantidadeEstoque())) { |
|
| - | 112 | setQuantidadeEstoque(0); |
|
| - | 113 | }
|
|
| - | 114 | if (VerificadorUtil.estaNulo(getQuantidadeMinimaTransferir())) { |
|
| - | 115 | setQuantidadeMinimaTransferir(1); |
|
| - | 116 | }
|
|
| - | 117 | return (getQuantidadeEstoque() - getQuantidadeVendida()) * getQuantidadeMinimaTransferir() * -1; |
|
| - | 118 | }
|
|
| 34 | 119 | ||
| 35 | }
|
120 | }
|