Rev 508 | Rev 516 | 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 | |||
| 13 | private Long sequencialProduto; |
||
| 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; |
||
| 35 | private Boolean indicadorSolicitarTransferencia = false; |
||
| 36 | |||
| 507 | blopes | 37 | public ProdutoLojaDTO() { |
| 38 | } |
||
| 39 | |||
| 508 | blopes | 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 | } |
||
| 507 | blopes | 51 | |
| 508 | blopes | 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 | } |
||
| 100 | |||
| 507 | blopes | 101 | /*******************************************/ |
| 102 | |||
| 508 | blopes | 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 | } |
||
| 509 | blopes | 117 | return (getQuantidadeMinimaTransferir() * getQuantidadeVendida()) - getQuantidadeEstoque(); |
| 118 | // return (getQuantidadeEstoque() - getQuantidadeVendida()) * getQuantidadeMinimaTransferir() * -1; |
||
| 508 | blopes | 119 | } |
| 120 | |||
| 507 | blopes | 121 | } |