Subversion Repositories Integrator Subversion

Rev

Rev 515 | Rev 517 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 515 Rev 516
Line 6... Line 6...
6
import java.util.Iterator;
6
import java.util.Iterator;
7
import java.util.List;
7
import java.util.List;
8
import java.util.ListIterator;
8
import java.util.ListIterator;
9
9
10
import br.com.ec.core.util.DataUtils;
10
import br.com.ec.core.util.DataUtils;
-
 
11
import br.com.ec.core.util.VerificadorUtil;
-
 
12
import br.com.ec.domain.model.ProdutoLoja;
11
import br.com.ec.domain.model.tipos.TipoPeriodoConsulta;
13
import br.com.ec.domain.model.tipos.TipoPeriodoConsulta;
12
14
13
public class LogisticaDTO {
15
public class LogisticaDTO {
14
       
16
       
15
        private String tipoPeriodoConsulta;
17
        private String tipoPeriodoConsulta;
Line 17... Line 19...
17
        private Long sequencialLojaSaida;
19
        private Long sequencialLojaSaida;
18
       
20
       
19
        private Date dataInicial;
21
        private Date dataInicial;
20
        private Date dataFinal;
22
        private Date dataFinal;
21
        private List<ProdutoLojaDTO> produtosParaVerificar;
23
        private List<ProdutoLojaDTO> produtosParaVerificar;
-
 
24
        private List<ProdutoLojaDTO> ProdutosAntesDistribuir;
-
 
25
       
22
        private List<TransferenciaDTO> transferencias;
26
        private List<TransferenciaDTO> transferencias;
23
       
27
       
24
        private List<LojaDTO> lojasPorMaiorPrioridade;
28
        private List<LojaDTO> lojasPorMaiorPrioridade;
25
        private List<LojaDTO> lojasPorMenorPrioridade;
29
        private List<LojaDTO> lojasPorMenorPrioridade;
26
        /*
30
        /*
Line 32... Line 36...
32
        private Integer notasFiscaisRemessas = 0;
36
        private Integer notasFiscaisRemessas = 0;
33
        */
37
        */
34
       
38
       
35
        public LogisticaDTO() {
39
        public LogisticaDTO() {
36
                setProdutosParaVerificar(new ArrayList<ProdutoLojaDTO>());
40
                setProdutosParaVerificar(new ArrayList<ProdutoLojaDTO>());
-
 
41
                setProdutosAntesDistribuir(new ArrayList<ProdutoLojaDTO>());
37
                setTransferencias(new ArrayList<TransferenciaDTO>());
42
                setTransferencias(new ArrayList<TransferenciaDTO>());
38
                setTipoPeriodoConsulta(TipoPeriodoConsulta.ULTIMOS_15_DIAS.getValor());
43
                setTipoPeriodoConsulta(TipoPeriodoConsulta.ULTIMOS_15_DIAS.getValor());
39
                atualizarPeriodo();
44
                atualizarPeriodo();
40
        }
45
        }
41
       
46
       
Line 77... Line 82...
77
        public List<ProdutoLojaDTO> getProdutosParaVerificar() {
82
        public List<ProdutoLojaDTO> getProdutosParaVerificar() {
78
                return produtosParaVerificar;
83
                return produtosParaVerificar;
79
        }
84
        }
80
        public void setProdutosParaVerificar(List<ProdutoLojaDTO> produtosParaVerificar) {
85
        public void setProdutosParaVerificar(List<ProdutoLojaDTO> produtosParaVerificar) {
81
                this.produtosParaVerificar = produtosParaVerificar;
86
                this.produtosParaVerificar = produtosParaVerificar;
-
 
87
        }
-
 
88
       
-
 
89
        public List<ProdutoLojaDTO> getProdutosAntesDistribuir() {
-
 
90
                return ProdutosAntesDistribuir;
-
 
91
        }
-
 
92
        public void setProdutosAntesDistribuir(List<ProdutoLojaDTO> produtosAntesDistribuir) {
-
 
93
                ProdutosAntesDistribuir = produtosAntesDistribuir;
82
        }
94
        }
83
       
95
       
84
        public List<TransferenciaDTO> getTransferencias() {
96
        public List<TransferenciaDTO> getTransferencias() {
85
                return transferencias;
97
                return transferencias;
86
        }
98
        }
Line 127... Line 139...
127
                }
139
                }
128
                if (getTipoPeriodoConsulta().equals(TipoPeriodoConsulta.MES_ATUAL.getValor())) {
140
                if (getTipoPeriodoConsulta().equals(TipoPeriodoConsulta.MES_ATUAL.getValor())) {
129
                        setDataInicial(new DataUtils().getDataComHorarioMinimo(DataUtils.getPrimeiroDiaDoMesAtual()));
141
                        setDataInicial(new DataUtils().getDataComHorarioMinimo(DataUtils.getPrimeiroDiaDoMesAtual()));
130
                        setDataFinal(new DataUtils().getDataComHorarioMaximo(DataUtils.getUltimoDiaDoMesAtual()));
142
                        setDataFinal(new DataUtils().getDataComHorarioMaximo(DataUtils.getUltimoDiaDoMesAtual()));
131
                }
143
                }
-
 
144
        }
-
 
145
       
-
 
146
        public List<ProdutoDTO> produtosEmTransferencia() {
-
 
147
                List<ProdutoDTO> produtosEmTransferencia = new ArrayList<ProdutoDTO>();
-
 
148
                for (TransferenciaDTO transferencia : getTransferencias()) {
-
 
149
                        if (VerificadorUtil.naoEstaNuloOuVazio(transferencia.getProdutosDTO())) {
-
 
150
                                for (TransferenciaProdutoDTO transferenciaProdutoDTO : transferencia.getProdutosDTO()) {
-
 
151
                                        if (!produtosEmTransferencia.contains(transferenciaProdutoDTO.getProdutoDTO())) {
-
 
152
                                                produtosEmTransferencia.add(transferenciaProdutoDTO.getProdutoDTO());
-
 
153
                                        }
-
 
154
                                }
-
 
155
                        }
-
 
156
                }
-
 
157
                return produtosEmTransferencia;
-
 
158
        }
-
 
159
       
-
 
160
        public Integer estoqueProduto(ProdutoDTO produtoDTO, LojaDTO lojaDTO) {
-
 
161
                for (ProdutoLojaDTO produtoLojaDTO : getProdutosAntesDistribuir()) {
-
 
162
                        if (produtoLojaDTO.getSequencialDoProduto().equals(produtoDTO.getSequencial()) &&
-
 
163
                                produtoLojaDTO.getLojaDTO().equals(lojaDTO)) {
-
 
164
                                return produtoLojaDTO.getQuantidadeEstoqueAnterior();
-
 
165
                        }
-
 
166
                }
-
 
167
                return null;
-
 
168
        }
-
 
169
       
-
 
170
        public Integer quantidadeTransferida(ProdutoDTO produtoDTO, LojaDTO lojaSaidaDTO, LojaDTO lojaEntradaDTO) {
-
 
171
                Integer quantidadeTransferida = 0;
-
 
172
                for (TransferenciaDTO transferenciaDTO : getTransferencias()) {
-
 
173
                        if (VerificadorUtil.naoEstaNuloOuVazio(transferenciaDTO.getProdutosDTO())) {
-
 
174
                                for (TransferenciaProdutoDTO transferenciaProdutoDTO : transferenciaDTO.getProdutosDTO()) {
-
 
175
                                        if (transferenciaProdutoDTO.getProdutoDTO().equals(produtoDTO)) {
-
 
176
                                                if (VerificadorUtil.naoEstaNulo(lojaSaidaDTO)) {
-
 
177
                                                        if (transferenciaDTO.getLojaSaidaDTO().equals(lojaSaidaDTO)) {
-
 
178
                                                                quantidadeTransferida = quantidadeTransferida - transferenciaProdutoDTO.getQuantidadeTransferir();
-
 
179
                                                        }
-
 
180
                                                } else if (VerificadorUtil.naoEstaNulo(lojaEntradaDTO)) {
-
 
181
                                                        if (transferenciaDTO.getLojaEntradaDTO().equals(lojaEntradaDTO)) {
-
 
182
                                                                quantidadeTransferida = quantidadeTransferida + transferenciaProdutoDTO.getQuantidadeTransferir();
-
 
183
                                                        }
-
 
184
                                                }
-
 
185
                                               
-
 
186
                                        }
-
 
187
                                }
-
 
188
                        }
-
 
189
                }
-
 
190
                if (quantidadeTransferida == 0) {return null;}
-
 
191
                return quantidadeTransferida;
132
        }
192
        }
133
       
193
       
134
        /*
194
        /*
135
        public VigenciaDTO getVigenciaDTO() {
195
        public VigenciaDTO getVigenciaDTO() {
136
                return vigenciaDTO;
196
                return vigenciaDTO;