Rev 509 | Rev 543 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 507 | blopes | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | import java.util.Date; |
||
| 4 | |||
| 508 | blopes | 5 | import br.com.ec.core.util.VerificadorUtil; |
| 507 | blopes | 6 | import br.com.ec.domain.model.Loja; |
| 7 | import br.com.ec.domain.model.Produto; |
||
| 8 | import br.com.ec.domain.model.ProdutoLojaId; |
||
| 9 | import br.com.ec.domain.model.Usuario; |
||
| 10 | |||
| 11 | public class ProdutoLojaDTO { |
||
| 12 | |||
| 516 | blopes | 13 | private ProdutoDTO produtoDTO; |
| 508 | blopes | 14 | private LojaDTO lojaDTO; |
| 15 | private Integer quantidadeEstoque; |
||
| 507 | blopes | 16 | |
| 17 | /* |
||
| 18 | private ProdutoLojaId produtoLojaId; |
||
| 19 | private Produto produto; |
||
| 20 | private Loja loja; |
||
| 21 | private Integer quantidadeEstoque; |
||
| 22 | private Integer quantidadeEstoqueContagem; |
||
| 23 | // private Integer quantidadeEstoqueUltimaContagem; |
||
| 24 | private Date dataContagem; |
||
| 25 | private Date dataContagemPreparacao; |
||
| 26 | private Usuario usuarioUltimaContagem; |
||
| 27 | private Usuario usuarioUltimaContagemPreparacao; |
||
| 28 | private String localizacao; |
||
| 29 | private Boolean indicadorContagemSolicitada = false; |
||
| 30 | */ |
||
| 31 | |||
| 508 | blopes | 32 | private Integer quantidadeMinimaTransferir; |
| 33 | private Integer quantidadeVendida; |
||
| 34 | private Integer quantidadeParaTransferir; |
||
| 516 | blopes | 35 | private Integer quantidadeEstoqueAnterior; |
| 508 | blopes | 36 | private Boolean indicadorSolicitarTransferencia = false; |
| 37 | |||
| 507 | blopes | 38 | public ProdutoLojaDTO() { |
| 39 | } |
||
| 40 | |||
| 516 | blopes | 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); |
||
| 508 | blopes | 44 | this.lojaDTO = new LojaDTO(sequencialLoja); |
| 45 | this.quantidadeEstoque = quantidadeEstoque; |
||
| 46 | if (VerificadorUtil.naoEstaNulo(quantidadeVendida)) { |
||
| 47 | this.quantidadeVendida = quantidadeVendida.intValue(); |
||
| 48 | } else { |
||
| 49 | this.quantidadeVendida = 0; |
||
| 50 | } |
||
| 51 | } |
||
| 507 | blopes | 52 | |
| 516 | blopes | 53 | public ProdutoDTO getProdutoDTO() { |
| 54 | return produtoDTO; |
||
| 508 | blopes | 55 | } |
| 516 | blopes | 56 | public void setProdutoDTO(ProdutoDTO produtoDTO) { |
| 57 | this.produtoDTO = produtoDTO; |
||
| 508 | blopes | 58 | } |
| 59 | |||
| 60 | public LojaDTO getLojaDTO() { |
||
| 61 | return lojaDTO; |
||
| 62 | } |
||
| 63 | public void setLojaDTO(LojaDTO lojaDTO) { |
||
| 64 | this.lojaDTO = lojaDTO; |
||
| 65 | } |
||
| 66 | |||
| 67 | public Integer getQuantidadeEstoque() { |
||
| 68 | return quantidadeEstoque; |
||
| 69 | } |
||
| 70 | public void setQuantidadeEstoque(Integer quantidadeEstoque) { |
||
| 71 | this.quantidadeEstoque = quantidadeEstoque; |
||
| 72 | } |
||
| 73 | |||
| 74 | public Integer getQuantidadeMinimaTransferir() { |
||
| 75 | return quantidadeMinimaTransferir; |
||
| 76 | } |
||
| 77 | public void setQuantidadeMinimaTransferir(Integer quantidadeMinimaTransferir) { |
||
| 78 | this.quantidadeMinimaTransferir = quantidadeMinimaTransferir; |
||
| 79 | } |
||
| 80 | |||
| 81 | public Integer getQuantidadeVendida() { |
||
| 82 | return quantidadeVendida; |
||
| 83 | } |
||
| 84 | public void setQuantidadeVendida(Integer quantidadeVendida) { |
||
| 85 | this.quantidadeVendida = quantidadeVendida; |
||
| 86 | } |
||
| 87 | |||
| 88 | public Integer getQuantidadeParaTransferir() { |
||
| 89 | return quantidadeParaTransferir; |
||
| 90 | } |
||
| 91 | public void setQuantidadeParaTransferir(Integer quantidadeParaTransferir) { |
||
| 92 | this.quantidadeParaTransferir = quantidadeParaTransferir; |
||
| 93 | } |
||
| 94 | |||
| 516 | blopes | 95 | public Integer getQuantidadeEstoqueAnterior() { |
| 96 | return quantidadeEstoqueAnterior; |
||
| 97 | } |
||
| 98 | public void setQuantidadeEstoqueAnterior(Integer quantidadeEstoqueAnterior) { |
||
| 99 | this.quantidadeEstoqueAnterior = quantidadeEstoqueAnterior; |
||
| 100 | } |
||
| 101 | |||
| 508 | blopes | 102 | public Boolean getIndicadorSolicitarTransferencia() { |
| 103 | return indicadorSolicitarTransferencia; |
||
| 104 | } |
||
| 105 | public void setIndicadorSolicitarTransferencia(Boolean indicadorSolicitarTransferencia) { |
||
| 106 | this.indicadorSolicitarTransferencia = indicadorSolicitarTransferencia; |
||
| 107 | } |
||
| 108 | |||
| 516 | blopes | 109 | public Long getSequencialDoProduto() { |
| 110 | return VerificadorUtil.naoEstaNulo(getProdutoDTO())? getProdutoDTO().getSequencial() : null; |
||
| 111 | } |
||
| 112 | |||
| 507 | blopes | 113 | /*******************************************/ |
| 114 | |||
| 508 | blopes | 115 | public Integer quantidadeParaComprar(Integer quantidadeVendas, Integer quantidadeEstoque) { |
| 116 | return (getQuantidadeMinimaTransferir() * quantidadeVendas) - quantidadeEstoque; |
||
| 117 | } |
||
| 118 | |||
| 119 | public Integer quantidadeParaTransferir() { |
||
| 120 | if (VerificadorUtil.estaNulo(getQuantidadeVendida())) { |
||
| 121 | setQuantidadeVendida(0); |
||
| 122 | } |
||
| 123 | if (VerificadorUtil.estaNulo(getQuantidadeEstoque())) { |
||
| 124 | setQuantidadeEstoque(0); |
||
| 125 | } |
||
| 126 | if (VerificadorUtil.estaNulo(getQuantidadeMinimaTransferir())) { |
||
| 127 | setQuantidadeMinimaTransferir(1); |
||
| 128 | } |
||
| 509 | blopes | 129 | return (getQuantidadeMinimaTransferir() * getQuantidadeVendida()) - getQuantidadeEstoque(); |
| 130 | // return (getQuantidadeEstoque() - getQuantidadeVendida()) * getQuantidadeMinimaTransferir() * -1; |
||
| 508 | blopes | 131 | } |
| 516 | blopes | 132 | |
| 507 | blopes | 133 | } |