Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 574 | blopes | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | import java.util.Date; |
||
| 4 | |||
| 5 | import br.com.ec.domain.model.Fornecedor; |
||
| 6 | |||
| 7 | public class AnaliseVendaProdutoDTO { |
||
| 8 | |||
| 9 | private ProdutoDTO produtoDTO; |
||
| 10 | private Integer quantidadeEstoque; |
||
| 11 | private Integer quantidadeVendas; |
||
| 12 | private Date dataUltimaCompra; |
||
| 13 | private Date dataUltimaVenda; |
||
| 14 | private ProdutoPedidoCompraDTO produtoPedidoCompraDTO; |
||
| 15 | private FornecedorDTO fornecedorDTO; |
||
| 16 | |||
| 17 | // private RankingModeloDTO rankingModelo; |
||
| 18 | |||
| 19 | // private List<RankingComprasTransferenciasEstiloDTO> estilos; |
||
| 20 | // private List<RankingComprasTransferenciasAlertaDTO> alertas; |
||
| 21 | |||
| 22 | private Integer quantidadeAlertasPossiveis; |
||
| 23 | |||
| 24 | public AnaliseVendaProdutoDTO() { |
||
| 25 | // setEstilos(new ArrayList<RankingComprasTransferenciasEstiloDTO>()); |
||
| 26 | // setAlertas(new ArrayList<RankingComprasTransferenciasAlertaDTO>()); |
||
| 27 | setQuantidadeAlertasPossiveis(0); |
||
| 28 | } |
||
| 29 | |||
| 30 | public ProdutoDTO getProdutoDTO() { |
||
| 31 | return produtoDTO; |
||
| 32 | } |
||
| 33 | public void setProdutoDTO(ProdutoDTO produtoDTO) { |
||
| 34 | this.produtoDTO = produtoDTO; |
||
| 35 | } |
||
| 36 | |||
| 37 | public Integer getQuantidadeAlertasPossiveis() { |
||
| 38 | return quantidadeAlertasPossiveis; |
||
| 39 | } |
||
| 40 | public void setQuantidadeAlertasPossiveis(Integer quantidadeAlertasPossiveis) { |
||
| 41 | this.quantidadeAlertasPossiveis = quantidadeAlertasPossiveis; |
||
| 42 | } |
||
| 43 | |||
| 44 | public Integer getQuantidadeEstoque() { |
||
| 45 | return quantidadeEstoque; |
||
| 46 | } |
||
| 47 | public void setQuantidadeEstoque(Integer quantidadeEstoque) { |
||
| 48 | this.quantidadeEstoque = quantidadeEstoque; |
||
| 49 | } |
||
| 50 | |||
| 51 | public Integer getQuantidadeVendas() { |
||
| 52 | return quantidadeVendas; |
||
| 53 | } |
||
| 54 | public void setQuantidadeVendas(Integer quantidadeVendas) { |
||
| 55 | this.quantidadeVendas = quantidadeVendas; |
||
| 56 | } |
||
| 57 | |||
| 58 | public Date getDataUltimaCompra() { |
||
| 59 | return dataUltimaCompra; |
||
| 60 | } |
||
| 61 | public void setDataUltimaCompra(Date dataUltimaCompra) { |
||
| 62 | this.dataUltimaCompra = dataUltimaCompra; |
||
| 63 | } |
||
| 64 | |||
| 65 | public Date getDataUltimaVenda() { |
||
| 66 | return dataUltimaVenda; |
||
| 67 | } |
||
| 68 | public void setDataUltimaVenda(Date dataUltimaVenda) { |
||
| 69 | this.dataUltimaVenda = dataUltimaVenda; |
||
| 70 | } |
||
| 71 | |||
| 72 | public ProdutoPedidoCompraDTO getProdutoPedidoCompraDTO() { |
||
| 73 | return produtoPedidoCompraDTO; |
||
| 74 | } |
||
| 75 | public void setProdutoPedidoCompraDTO(ProdutoPedidoCompraDTO produtoPedidoCompraDTO) { |
||
| 76 | this.produtoPedidoCompraDTO = produtoPedidoCompraDTO; |
||
| 77 | } |
||
| 78 | |||
| 79 | public FornecedorDTO getFornecedorDTO() { |
||
| 80 | return fornecedorDTO; |
||
| 81 | } |
||
| 82 | public void setFornecedorDTO(FornecedorDTO fornecedorDTO) { |
||
| 83 | this.fornecedorDTO = fornecedorDTO; |
||
| 84 | } |
||
| 85 | |||
| 86 | /*********************************************/ |
||
| 87 | |||
| 88 | /* |
||
| 89 | public List<RankingComprasTransferenciasAlertaDTO> verificarAlertasLogistica(Double quantidadeMinimaParaTransferirOuComprar) { |
||
| 90 | List<RankingComprasTransferenciasAlertaDTO> alertas = new ArrayList<RankingComprasTransferenciasAlertaDTO>(); |
||
| 91 | |||
| 92 | for (RankingComprasTransferenciasEstiloDTO estilo : getEstilos()) { |
||
| 93 | Integer estoqueTotalMatriz = 0; |
||
| 94 | for (RankingComprasTransferenciasEstiloPorLojaDTO estiloPorLoja : estilo.getRankingsPorLoja()) { |
||
| 95 | if (estiloPorLoja.getLojaDTO().getSequencial().equals(ConstantesSEC.Loja.SEQUENCIAL_MATRIZ_ESTOQUE_9)) { |
||
| 96 | estoqueTotalMatriz = estiloPorLoja.getQuantidadeEstoqueGeral(); |
||
| 97 | break; |
||
| 98 | } |
||
| 99 | } |
||
| 100 | Integer estoqueMaiorLojaPrioridade = 0; |
||
| 101 | Integer quantidadeAlertasPossiveis = 0; |
||
| 102 | LojaDTO lojaMaiorPrioridade = null; |
||
| 103 | for (RankingComprasTransferenciasEstiloPorLojaDTO estiloPorLoja : estilo.getRankingsPorLoja()) { |
||
| 104 | if (!estiloPorLoja.getLojaDTO().getSequencial().equals(ConstantesSEC.Loja.SEQUENCIAL_MATRIZ_ESTOQUE_9)) { |
||
| 105 | |||
| 106 | estiloPorLoja.setQuantidadeMinimaTransferir(quantidadeMinimaParaTransferirOuComprar); |
||
| 107 | |||
| 108 | // VERIFICAR SE HÁ ESTOQUE NA MATRIZ E NÃO TEM EM ALGUMA LOJA |
||
| 109 | if (estoqueTotalMatriz > 0) { |
||
| 110 | if (estiloPorLoja.getQuantidadeEstoqueGeral() <= 0) { |
||
| 111 | adicionarAlertaLogistica(alertas, estiloPorLoja.getLojaDTO(), estilo.getEstilo(), TipoAlertaComprasTransferencias.SEM_ESTOQUE); |
||
| 112 | } else { |
||
| 113 | quantidadeAlertasPossiveis++; |
||
| 114 | } |
||
| 115 | } |
||
| 116 | |||
| 117 | // VERIFICAR SE TEM PARA TRANSFERIR |
||
| 118 | if (estiloPorLoja.quantidadeParaTransferirUnissex() > 0 || |
||
| 119 | estiloPorLoja.quantidadeParaTransferirMasculino() > 0 || |
||
| 120 | estiloPorLoja.quantidadeParaTransferirFeminino() > 0) { |
||
| 121 | adicionarAlertaLogistica(alertas, estiloPorLoja.getLojaDTO(), estilo.getEstilo(), TipoAlertaComprasTransferencias.TRANSFERIR); |
||
| 122 | } else { |
||
| 123 | quantidadeAlertasPossiveis++; |
||
| 124 | } |
||
| 125 | |||
| 126 | // VERIFICAR SE TEM ALGUMA LOJA DE MAIOR PRIORIDADE COM ESTOQUE MENOR |
||
| 127 | if (estoqueMaiorLojaPrioridade > 0) { |
||
| 128 | Integer estoqueTotalLoja = estiloPorLoja.getQuantidadeEstoqueGeral(); |
||
| 129 | if (estoqueMaiorLojaPrioridade < estoqueTotalLoja) { |
||
| 130 | adicionarAlertaLogistica(alertas, lojaMaiorPrioridade, estilo.getEstilo(), TipoAlertaComprasTransferencias.ESTOQUE_MENOR_PRIORIDADE); |
||
| 131 | } else { |
||
| 132 | quantidadeAlertasPossiveis++; |
||
| 133 | } |
||
| 134 | } |
||
| 135 | estoqueMaiorLojaPrioridade = estiloPorLoja.getQuantidadeEstoqueGeral(); |
||
| 136 | lojaMaiorPrioridade = estiloPorLoja.getLojaDTO(); |
||
| 137 | } |
||
| 138 | } |
||
| 139 | setQuantidadeAlertasPossiveis(quantidadeAlertasPossiveis); |
||
| 140 | } |
||
| 141 | return alertas; |
||
| 142 | } |
||
| 143 | |||
| 144 | private void adicionarAlertaLogistica(List<RankingComprasTransferenciasAlertaDTO> alertas, LojaDTO lojaDTO, TipoEstiloProduto estilo, TipoAlertaComprasTransferencias tipoAlerta) { |
||
| 145 | Boolean adicionarAlerta = true; |
||
| 146 | for (RankingComprasTransferenciasAlertaDTO alerta : alertas) { |
||
| 147 | if (alerta.getLoja().equals(lojaDTO) && alerta.getEstilo().equals(estilo)) { |
||
| 148 | adicionarAlerta = false; |
||
| 149 | } |
||
| 150 | } |
||
| 151 | if (adicionarAlerta) { |
||
| 152 | RankingComprasTransferenciasAlertaDTO alerta = new RankingComprasTransferenciasAlertaDTO(); |
||
| 153 | alerta.setLoja(lojaDTO); |
||
| 154 | alerta.setEstilo(estilo); |
||
| 155 | alerta.setTipoAlertaComprasTransferencias(tipoAlerta); |
||
| 156 | alertas.add(alerta); |
||
| 157 | } |
||
| 158 | } |
||
| 159 | |||
| 160 | public List<RankingComprasTransferenciasAlertaDTO> verificarAlertasCompras(Double quantidadeMinimaParaComprar) { |
||
| 161 | List<RankingComprasTransferenciasAlertaDTO> alertas = new ArrayList<RankingComprasTransferenciasAlertaDTO>(); |
||
| 162 | for (RankingComprasTransferenciasEstiloDTO estilo : getEstilos()) { |
||
| 163 | estilo.setQuantidadeMinimaComprar(quantidadeMinimaParaComprar); |
||
| 164 | if (estilo.quantidadeParaComprarUnissex() > 0) { |
||
| 165 | adicionarAlertaCompras(alertas, estilo.getEstilo(), TipoAlertaComprasTransferencias.COMPRAR, TipoGenero.UNISSEX); |
||
| 166 | } else { |
||
| 167 | quantidadeAlertasPossiveis++; |
||
| 168 | } |
||
| 169 | if (estilo.quantidadeParaComprarMasculino() > 0) { |
||
| 170 | adicionarAlertaCompras(alertas, estilo.getEstilo(), TipoAlertaComprasTransferencias.COMPRAR, TipoGenero.MASCULINO); |
||
| 171 | } else { |
||
| 172 | quantidadeAlertasPossiveis++; |
||
| 173 | } |
||
| 174 | if (estilo.quantidadeParaComprarFeminino() > 0) { |
||
| 175 | adicionarAlertaCompras(alertas, estilo.getEstilo(), TipoAlertaComprasTransferencias.COMPRAR, TipoGenero.FEMININO); |
||
| 176 | } else { |
||
| 177 | quantidadeAlertasPossiveis++; |
||
| 178 | } |
||
| 179 | } |
||
| 180 | return alertas; |
||
| 181 | } |
||
| 182 | |||
| 183 | private void adicionarAlertaCompras(List<RankingComprasTransferenciasAlertaDTO> alertas, TipoEstiloProduto estilo, TipoAlertaComprasTransferencias tipoAlerta, TipoGenero genero) { |
||
| 184 | Boolean adicionarAlerta = true; |
||
| 185 | for (RankingComprasTransferenciasAlertaDTO alerta : alertas) { |
||
| 186 | if (alerta.getEstilo().equals(estilo)) { |
||
| 187 | adicionarAlerta = false; |
||
| 188 | } |
||
| 189 | } |
||
| 190 | if (adicionarAlerta) { |
||
| 191 | RankingComprasTransferenciasAlertaDTO alerta = new RankingComprasTransferenciasAlertaDTO(); |
||
| 192 | alerta.setEstilo(estilo); |
||
| 193 | alerta.setTipoAlertaComprasTransferencias(tipoAlerta); |
||
| 194 | alerta.setGenero(genero); |
||
| 195 | alertas.add(alerta); |
||
| 196 | } |
||
| 197 | } |
||
| 198 | */ |
||
| 199 | } |