Rev 509 | Rev 543 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 509 | Rev 516 | ||
|---|---|---|---|
| Line 8... | Line 8... | ||
| 8 | import br.com.ec.domain.model.ProdutoLojaId; |
8 | import br.com.ec.domain.model.ProdutoLojaId; |
| 9 | import br.com.ec.domain.model.Usuario; |
9 | import br.com.ec.domain.model.Usuario; |
| 10 | 10 | ||
| 11 | public class ProdutoLojaDTO { |
11 | public class ProdutoLojaDTO { |
| 12 | 12 | ||
| 13 | private Long sequencialProduto; |
- | |
| - | 13 | private ProdutoDTO produtoDTO; |
|
| 14 | private LojaDTO lojaDTO; |
14 | private LojaDTO lojaDTO; |
| 15 | private Integer quantidadeEstoque; |
15 | private Integer quantidadeEstoque; |
| 16 | 16 | ||
| 17 | /*
|
17 | /*
|
| 18 | private ProdutoLojaId produtoLojaId;
|
18 | private ProdutoLojaId produtoLojaId;
|
| Line 30... | Line 30... | ||
| 30 | */
|
30 | */
|
| 31 | 31 | ||
| 32 | private Integer quantidadeMinimaTransferir; |
32 | private Integer quantidadeMinimaTransferir; |
| 33 | private Integer quantidadeVendida; |
33 | private Integer quantidadeVendida; |
| 34 | private Integer quantidadeParaTransferir; |
34 | private Integer quantidadeParaTransferir; |
| - | 35 | private Integer quantidadeEstoqueAnterior; |
|
| 35 | private Boolean indicadorSolicitarTransferencia = false; |
36 | private Boolean indicadorSolicitarTransferencia = false; |
| 36 | 37 | ||
| 37 | public ProdutoLojaDTO() { |
38 | public ProdutoLojaDTO() { |
| 38 | }
|
39 | }
|
| 39 | 40 | ||
| 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; |
- | |
| - | 41 | public static String CONSULTA_DTO_COMPLETA_QUANTIDADE_VENDAS = "e.produto.sequencial, e.produto.codigo, e.produto.descricao, e.loja.sequencial, e.quantidadeEstoque"; // + QUANTIDADE_VENDIDA |
|
| - | 42 | public ProdutoLojaDTO(Long sequencialProduto, String codigoProduto, String descricaoProduto, Long sequencialLoja, Integer quantidadeEstoque, Long quantidadeVendida) { |
|
| - | 43 | this.produtoDTO = new ProdutoDTO(sequencialProduto, codigoProduto, descricaoProduto); |
|
| 43 | this.lojaDTO = new LojaDTO(sequencialLoja); |
44 | this.lojaDTO = new LojaDTO(sequencialLoja); |
| 44 | this.quantidadeEstoque = quantidadeEstoque; |
45 | this.quantidadeEstoque = quantidadeEstoque; |
| 45 | if (VerificadorUtil.naoEstaNulo(quantidadeVendida)) { |
46 | if (VerificadorUtil.naoEstaNulo(quantidadeVendida)) { |
| 46 | this.quantidadeVendida = quantidadeVendida.intValue(); |
47 | this.quantidadeVendida = quantidadeVendida.intValue(); |
| 47 | } else { |
48 | } else { |
| 48 | this.quantidadeVendida = 0; |
49 | this.quantidadeVendida = 0; |
| 49 | }
|
50 | }
|
| 50 | }
|
51 | }
|
| 51 | 52 | ||
| 52 | public Long getSequencialProduto() { |
- | |
| 53 | return sequencialProduto; |
- | |
| - | 53 | public ProdutoDTO getProdutoDTO() { |
|
| - | 54 | return produtoDTO; |
|
| 54 | }
|
55 | }
|
| 55 | public void setSequencialProduto(Long sequencialProduto) { |
- | |
| 56 | this.sequencialProduto = sequencialProduto; |
- | |
| - | 56 | public void setProdutoDTO(ProdutoDTO produtoDTO) { |
|
| - | 57 | this.produtoDTO = produtoDTO; |
|
| 57 | }
|
58 | }
|
| 58 | 59 | ||
| 59 | public LojaDTO getLojaDTO() { |
60 | public LojaDTO getLojaDTO() { |
| 60 | return lojaDTO; |
61 | return lojaDTO; |
| 61 | }
|
62 | }
|
| Line 87... | Line 88... | ||
| 87 | public Integer getQuantidadeParaTransferir() { |
88 | public Integer getQuantidadeParaTransferir() { |
| 88 | return quantidadeParaTransferir; |
89 | return quantidadeParaTransferir; |
| 89 | }
|
90 | }
|
| 90 | public void setQuantidadeParaTransferir(Integer quantidadeParaTransferir) { |
91 | public void setQuantidadeParaTransferir(Integer quantidadeParaTransferir) { |
| 91 | this.quantidadeParaTransferir = quantidadeParaTransferir; |
92 | this.quantidadeParaTransferir = quantidadeParaTransferir; |
| - | 93 | }
|
|
| - | 94 | ||
| - | 95 | public Integer getQuantidadeEstoqueAnterior() { |
|
| - | 96 | return quantidadeEstoqueAnterior; |
|
| - | 97 | }
|
|
| - | 98 | public void setQuantidadeEstoqueAnterior(Integer quantidadeEstoqueAnterior) { |
|
| - | 99 | this.quantidadeEstoqueAnterior = quantidadeEstoqueAnterior; |
|
| 92 | }
|
100 | }
|
| 93 | 101 | ||
| 94 | public Boolean getIndicadorSolicitarTransferencia() { |
102 | public Boolean getIndicadorSolicitarTransferencia() { |
| 95 | return indicadorSolicitarTransferencia; |
103 | return indicadorSolicitarTransferencia; |
| 96 | }
|
104 | }
|
| 97 | public void setIndicadorSolicitarTransferencia(Boolean indicadorSolicitarTransferencia) { |
105 | public void setIndicadorSolicitarTransferencia(Boolean indicadorSolicitarTransferencia) { |
| 98 | this.indicadorSolicitarTransferencia = indicadorSolicitarTransferencia; |
106 | this.indicadorSolicitarTransferencia = indicadorSolicitarTransferencia; |
| - | 107 | }
|
|
| - | 108 | ||
| - | 109 | public Long getSequencialDoProduto() { |
|
| - | 110 | return VerificadorUtil.naoEstaNulo(getProdutoDTO())? getProdutoDTO().getSequencial() : null; |
|
| 99 | }
|
111 | }
|
| 100 | 112 | ||
| 101 | /*******************************************/
|
113 | /*******************************************/
|
| 102 | 114 | ||
| 103 | public Integer quantidadeParaComprar(Integer quantidadeVendas, Integer quantidadeEstoque) { |
115 | public Integer quantidadeParaComprar(Integer quantidadeVendas, Integer quantidadeEstoque) { |
| Line 115... | Line 127... | ||
| 115 | setQuantidadeMinimaTransferir(1); |
127 | setQuantidadeMinimaTransferir(1); |
| 116 | }
|
128 | }
|
| 117 | return (getQuantidadeMinimaTransferir() * getQuantidadeVendida()) - getQuantidadeEstoque(); |
129 | return (getQuantidadeMinimaTransferir() * getQuantidadeVendida()) - getQuantidadeEstoque(); |
| 118 | // return (getQuantidadeEstoque() - getQuantidadeVendida()) * getQuantidadeMinimaTransferir() * -1;
|
130 | // return (getQuantidadeEstoque() - getQuantidadeVendida()) * getQuantidadeMinimaTransferir() * -1;
|
| 119 | }
|
131 | }
|
| 120 | - | ||
| - | 132 | ||
| 121 | }
|
133 | }
|