Commit 67b3da65d61d616a2387475b03ee3deaed3ec315
1 parent
9a2e187f
Exists in
master
Redmine #4679 Terminando reestruturação básica do modelo
Showing
21 changed files
with
161 additions
and
136 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/MovimentoEstoqueDao.java
... | ... | @@ -2,6 +2,7 @@ package br.com.centralit.api.dao; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.Calendar; |
5 | +import java.util.Collection; | |
5 | 6 | import java.util.List; |
6 | 7 | import java.util.Map; |
7 | 8 | |
... | ... | @@ -9,6 +10,7 @@ import br.com.centralit.api.model.EstruturaOrganizacional; |
9 | 10 | import br.com.centralit.api.model.MaterialConsumo; |
10 | 11 | import br.com.centralit.api.model.MovimentoEstoque; |
11 | 12 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; |
13 | +import br.com.centralit.framework.model.Dominio; | |
12 | 14 | import br.com.centralit.framework.model.Organizacao; |
13 | 15 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; |
14 | 16 | |
... | ... | @@ -131,4 +133,19 @@ public interface MovimentoEstoqueDao extends CitGenericDAO { |
131 | 133 | * @return |
132 | 134 | */ |
133 | 135 | public BigDecimal buscaQuantidadeMovimentadaMaterialPorReferencia(Long materialId, Calendar dataReferencia, Long organizacaoId); |
136 | + | |
137 | + /** | |
138 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
139 | + * | |
140 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
141 | + * | |
142 | + * Método responsável por buscar todos os movimentos por classe de referencia e ID da referencia | |
143 | + * | |
144 | + * @author geovane.filho | |
145 | + * | |
146 | + * @param classeReferencia | |
147 | + * @param idReferencia | |
148 | + * @return | |
149 | + */ | |
150 | + public Collection<MovimentoEstoque> findAllByClasseReferencia(Dominio classeReferencia, Long idReferencia); | |
134 | 151 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/impl/MovimentoEstoqueDaoHibernate.java
... | ... | @@ -2,6 +2,7 @@ package br.com.centralit.api.dao.impl; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.Calendar; |
5 | +import java.util.Collection; | |
5 | 6 | import java.util.List; |
6 | 7 | import java.util.Map; |
7 | 8 | |
... | ... | @@ -17,6 +18,7 @@ import br.com.centralit.api.model.MaterialConsumo; |
17 | 18 | import br.com.centralit.api.model.MovimentoEstoque; |
18 | 19 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
19 | 20 | import br.com.centralit.framework.dao.arquitetura.SearchSeven; |
21 | +import br.com.centralit.framework.model.Dominio; | |
20 | 22 | import br.com.centralit.framework.model.Organizacao; |
21 | 23 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; |
22 | 24 | import br.com.centralit.framework.util.UtilColecao; |
... | ... | @@ -243,4 +245,17 @@ public class MovimentoEstoqueDaoHibernate extends CitGenericDAOImpl implements M |
243 | 245 | |
244 | 246 | return qnt; |
245 | 247 | } |
248 | + | |
249 | + /** | |
250 | + * {@inheritDoc} | |
251 | + */ | |
252 | + @Override | |
253 | + public Collection<MovimentoEstoque> findAllByClasseReferencia(Dominio classeReferencia, Long idReferencia) { | |
254 | + SearchSeven search = new SearchSeven(); | |
255 | + | |
256 | + search.addFilterEqual("dominioClasseReferencia.id", classeReferencia.getId()); | |
257 | + search.addFilterEqual("idClasseReferencia", idReferencia); | |
258 | + | |
259 | + return search(search); | |
260 | + } | |
246 | 261 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/BaixaAlmoxarifadoItem.java
... | ... | @@ -2,9 +2,7 @@ package br.com.centralit.api.model; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.Calendar; |
5 | -import java.util.Collection; | |
6 | 5 | |
7 | -import javax.persistence.CascadeType; | |
8 | 6 | import javax.persistence.Column; |
9 | 7 | import javax.persistence.Entity; |
10 | 8 | import javax.persistence.FetchType; |
... | ... | @@ -12,7 +10,6 @@ import javax.persistence.GeneratedValue; |
12 | 10 | import javax.persistence.GenerationType; |
13 | 11 | import javax.persistence.Id; |
14 | 12 | import javax.persistence.ManyToOne; |
15 | -import javax.persistence.OneToMany; | |
16 | 13 | import javax.persistence.Temporal; |
17 | 14 | import javax.persistence.TemporalType; |
18 | 15 | import javax.persistence.Transient; |
... | ... | @@ -104,10 +101,6 @@ public class BaixaAlmoxarifadoItem extends PersistentObjectAudit { |
104 | 101 | @JsonView({ ViewsAdmMateriais.BaixaAlmoxarifadoEditView.class }) |
105 | 102 | private Calendar dataEstorno; |
106 | 103 | |
107 | - /** Atributo movimentos. */ | |
108 | - @OneToMany(fetch = FetchType.LAZY, mappedBy = "baixaAlmoxarifadoItem", cascade = CascadeType.ALL) | |
109 | - private Collection<MovimentoEstoque> movimentos; | |
110 | - | |
111 | 104 | @Transient |
112 | 105 | @JsonView({ ViewsAdmMateriais.BaixaAlmoxarifadoEditView.class }) |
113 | 106 | private BigDecimal qtdEstoque; |
... | ... | @@ -254,26 +247,6 @@ public class BaixaAlmoxarifadoItem extends PersistentObjectAudit { |
254 | 247 | } |
255 | 248 | |
256 | 249 | /** |
257 | - * Retorna o valor do atributo <code>movimentos</code> | |
258 | - * | |
259 | - * @return <code>Collection<MovimentoEstoque></code> | |
260 | - */ | |
261 | - public Collection<MovimentoEstoque> getMovimentos() { | |
262 | - | |
263 | - return movimentos; | |
264 | - } | |
265 | - | |
266 | - /** | |
267 | - * Define o valor do atributo <code>movimentos</code>. | |
268 | - * | |
269 | - * @param movimentos | |
270 | - */ | |
271 | - public void setMovimentos(Collection<MovimentoEstoque> movimentos) { | |
272 | - | |
273 | - this.movimentos = movimentos; | |
274 | - } | |
275 | - | |
276 | - /** | |
277 | 250 | * Retorna o valor do atributo <code>baixaRemocao</code> |
278 | 251 | * |
279 | 252 | * @return <code>BaixaAlmoxarifado</code> | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/ConfiguracaoNotificacaoRessuprimento.java
... | ... | @@ -53,7 +53,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
53 | 53 | * |
54 | 54 | */ |
55 | 55 | @Entity |
56 | -@Table(name="ConfigNotificacaoRessuprimento") | |
56 | +@Table(name="alm_not_ressuprimento") | |
57 | 57 | public class ConfiguracaoNotificacaoRessuprimento extends PersistentObjectAuditOrganizacao { |
58 | 58 | |
59 | 59 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EnderecoEstoque.java
... | ... | @@ -12,6 +12,8 @@ import javax.persistence.ManyToOne; |
12 | 12 | import javax.persistence.OneToMany; |
13 | 13 | import javax.persistence.Table; |
14 | 14 | |
15 | +import org.hibernate.envers.Audited; | |
16 | + | |
15 | 17 | import br.com.centralit.framework.json.Views; |
16 | 18 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
17 | 19 | |
... | ... | @@ -38,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
38 | 40 | * @author geovane.filho |
39 | 41 | * |
40 | 42 | */ |
43 | +@Audited | |
41 | 44 | @Entity |
42 | 45 | @Table(name = "alm_es_enderecoestoque") |
43 | 46 | public class EnderecoEstoque extends PersistentObjectAuditOrganizacao { | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifado.java
... | ... | @@ -14,6 +14,7 @@ import javax.persistence.GenerationType; |
14 | 14 | import javax.persistence.Id; |
15 | 15 | import javax.persistence.ManyToOne; |
16 | 16 | import javax.persistence.OneToMany; |
17 | +import javax.persistence.Table; | |
17 | 18 | import javax.persistence.Temporal; |
18 | 19 | import javax.persistence.TemporalType; |
19 | 20 | |
... | ... | @@ -69,6 +70,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
69 | 70 | */ |
70 | 71 | @Audited |
71 | 72 | @Entity |
73 | +@Table(name = "alm_entrada") | |
72 | 74 | @JsonIgnoreProperties({ "$checked", "$selected" }) |
73 | 75 | public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implements Cloneable { |
74 | 76 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifadoDocumento.java
... | ... | @@ -3,6 +3,7 @@ package br.com.centralit.api.model; |
3 | 3 | import javax.persistence.Entity; |
4 | 4 | import javax.persistence.FetchType; |
5 | 5 | import javax.persistence.ManyToOne; |
6 | +import javax.persistence.Table; | |
6 | 7 | |
7 | 8 | import org.hibernate.envers.Audited; |
8 | 9 | |
... | ... | @@ -31,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
31 | 32 | */ |
32 | 33 | @Audited |
33 | 34 | @Entity |
35 | +@Table(name = "alm_en_documento") | |
34 | 36 | @JsonIgnoreProperties({ "uploadsDocumento", "$uuid", "$checked", "$index", "size", "name", "$error" }) |
35 | 37 | public class EntradaAlmoxarifadoDocumento extends Documento { |
36 | 38 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifadoItem.java
... | ... | @@ -13,6 +13,7 @@ import javax.persistence.GenerationType; |
13 | 13 | import javax.persistence.Id; |
14 | 14 | import javax.persistence.ManyToOne; |
15 | 15 | import javax.persistence.OneToMany; |
16 | +import javax.persistence.Table; | |
16 | 17 | import javax.persistence.Temporal; |
17 | 18 | import javax.persistence.TemporalType; |
18 | 19 | |
... | ... | @@ -64,6 +65,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
64 | 65 | */ |
65 | 66 | @Audited |
66 | 67 | @Entity |
68 | +@Table(name = "alm_en_entradaitem") | |
67 | 69 | @JsonIgnoreProperties({ "$quantidadeEntrada", "uuid", "$validarPrecoMedio" }) |
68 | 70 | public class EntradaAlmoxarifadoItem extends PersistentObjectAudit { |
69 | 71 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifadoObservacao.java
... | ... | @@ -3,6 +3,7 @@ package br.com.centralit.api.model; |
3 | 3 | import javax.persistence.Entity; |
4 | 4 | import javax.persistence.FetchType; |
5 | 5 | import javax.persistence.ManyToOne; |
6 | +import javax.persistence.Table; | |
6 | 7 | |
7 | 8 | /** |
8 | 9 | * |
... | ... | @@ -26,6 +27,7 @@ import javax.persistence.ManyToOne; |
26 | 27 | * |
27 | 28 | */ |
28 | 29 | @Entity |
30 | +@Table(name = "alm_en_observacao") | |
29 | 31 | public class EntradaAlmoxarifadoObservacao extends Observacao { |
30 | 32 | |
31 | 33 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/Estoque.java
... | ... | @@ -12,6 +12,8 @@ import javax.persistence.OneToMany; |
12 | 12 | import javax.persistence.OneToOne; |
13 | 13 | import javax.persistence.Table; |
14 | 14 | |
15 | +import org.hibernate.envers.Audited; | |
16 | + | |
15 | 17 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
16 | 18 | import br.com.centralit.api.framework.json.ViewsAlmoxarifado; |
17 | 19 | import br.com.centralit.framework.json.Views; |
... | ... | @@ -40,6 +42,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
40 | 42 | * @author geovane.filho |
41 | 43 | * |
42 | 44 | */ |
45 | +@Audited | |
43 | 46 | @Entity |
44 | 47 | @Table(name = "alm_estoque") |
45 | 48 | public class Estoque extends PersistentObjectAuditOrganizacao { |
... | ... | @@ -61,10 +64,6 @@ public class Estoque extends PersistentObjectAuditOrganizacao { |
61 | 64 | /** Atributo locais. */ |
62 | 65 | @OneToMany(fetch = FetchType.LAZY, mappedBy = "estoque", cascade = CascadeType.ALL) |
63 | 66 | private Collection<EnderecoEstoque> locais; |
64 | - | |
65 | - /** Atributo historicoSaldo. */ | |
66 | - @OneToMany(fetch = FetchType.LAZY, mappedBy = "localEstoque", cascade = CascadeType.ALL) | |
67 | - private Collection<MaterialEstoqueSaldo> historicoSaldo; | |
68 | 67 | |
69 | 68 | /** |
70 | 69 | * Retorna o valor do atributo <code>id</code> |
... | ... | @@ -106,24 +105,4 @@ public class Estoque extends PersistentObjectAuditOrganizacao { |
106 | 105 | this.almoxarifado = almoxarifado; |
107 | 106 | } |
108 | 107 | |
109 | - /** | |
110 | - * Retorna o valor do atributo <code>historicoSaldo</code> | |
111 | - * | |
112 | - * @return <code>Collection<LocalEstoqueSaldo></code> | |
113 | - */ | |
114 | - public Collection<MaterialEstoqueSaldo> getHistoricoSaldo() { | |
115 | - | |
116 | - return historicoSaldo; | |
117 | - } | |
118 | - | |
119 | - /** | |
120 | - * Define o valor do atributo <code>historicoSaldo</code>. | |
121 | - * | |
122 | - * @param historicoSaldo | |
123 | - */ | |
124 | - public void setHistoricoSaldo(Collection<MaterialEstoqueSaldo> historicoSaldo) { | |
125 | - | |
126 | - this.historicoSaldo = historicoSaldo; | |
127 | - } | |
128 | - | |
129 | 108 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoque.java
... | ... | @@ -14,6 +14,8 @@ import javax.persistence.OneToMany; |
14 | 14 | import javax.persistence.OneToOne; |
15 | 15 | import javax.persistence.Table; |
16 | 16 | |
17 | +import org.hibernate.envers.Audited; | |
18 | + | |
17 | 19 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
18 | 20 | |
19 | 21 | /** |
... | ... | @@ -37,6 +39,7 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganiz |
37 | 39 | * @author geovane.filho |
38 | 40 | * |
39 | 41 | */ |
42 | +@Audited | |
40 | 43 | @Entity |
41 | 44 | @Table(name = "alm_materialestoque") |
42 | 45 | public class MaterialEstoque extends PersistentObjectAuditOrganizacao { | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoqueFIFOItem.java
... | ... | @@ -12,6 +12,8 @@ import javax.persistence.ManyToOne; |
12 | 12 | import javax.persistence.OneToOne; |
13 | 13 | import javax.persistence.Table; |
14 | 14 | |
15 | +import org.hibernate.envers.Audited; | |
16 | + | |
15 | 17 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
16 | 18 | |
17 | 19 | /** |
... | ... | @@ -35,6 +37,7 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganiz |
35 | 37 | * @author geovane.filho |
36 | 38 | * |
37 | 39 | */ |
40 | +@Audited | |
38 | 41 | @Entity |
39 | 42 | @Table(name = "alm_me_fifoitem") |
40 | 43 | public class MaterialEstoqueFIFOItem extends PersistentObjectAuditOrganizacao { | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoqueSaldo.java
... | ... | @@ -2,9 +2,7 @@ package br.com.centralit.api.model; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.Calendar; |
5 | -import java.util.Collection; | |
6 | 5 | |
7 | -import javax.persistence.CascadeType; | |
8 | 6 | import javax.persistence.Column; |
9 | 7 | import javax.persistence.Entity; |
10 | 8 | import javax.persistence.FetchType; |
... | ... | @@ -12,7 +10,7 @@ import javax.persistence.GeneratedValue; |
12 | 10 | import javax.persistence.GenerationType; |
13 | 11 | import javax.persistence.Id; |
14 | 12 | import javax.persistence.ManyToOne; |
15 | -import javax.persistence.OneToMany; | |
13 | +import javax.persistence.Table; | |
16 | 14 | import javax.persistence.Temporal; |
17 | 15 | import javax.persistence.TemporalType; |
18 | 16 | |
... | ... | @@ -59,6 +57,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
59 | 57 | * |
60 | 58 | */ |
61 | 59 | @Entity |
60 | +@Table(name = "alm_me_saldo") | |
62 | 61 | public class MaterialEstoqueSaldo extends PersistentObjectAuditOrganizacao { |
63 | 62 | |
64 | 63 | /** Atributo serialVersionUID. */ |
... | ... | @@ -103,11 +102,6 @@ public class MaterialEstoqueSaldo extends PersistentObjectAuditOrganizacao { |
103 | 102 | @JsonView({ Views.MaterialConsultaInfo.class }) |
104 | 103 | private UnidadeMedida unidadeMedidaMaterial; |
105 | 104 | |
106 | - /** Atributo historicoSaldo. */ | |
107 | - @OneToMany(fetch = FetchType.LAZY, mappedBy = "materialEstoqueSaldo", cascade = CascadeType.ALL) | |
108 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
109 | - private Collection<MovimentoEstoque> movimentos; | |
110 | - | |
111 | 105 | /** |
112 | 106 | * Retorna o valor do atributo <code>id</code> |
113 | 107 | * |
... | ... | @@ -209,26 +203,6 @@ public class MaterialEstoqueSaldo extends PersistentObjectAuditOrganizacao { |
209 | 203 | } |
210 | 204 | |
211 | 205 | /** |
212 | - * Retorna o valor do atributo <code>movimentos</code> | |
213 | - * | |
214 | - * @return <code>Collection<MovimentoEstoque></code> | |
215 | - */ | |
216 | - public Collection<MovimentoEstoque> getMovimentos() { | |
217 | - | |
218 | - return movimentos; | |
219 | - } | |
220 | - | |
221 | - /** | |
222 | - * Define o valor do atributo <code>movimentos</code>. | |
223 | - * | |
224 | - * @param movimentos | |
225 | - */ | |
226 | - public void setMovimentos(Collection<MovimentoEstoque> movimentos) { | |
227 | - | |
228 | - this.movimentos = movimentos; | |
229 | - } | |
230 | - | |
231 | - /** | |
232 | 206 | * Retorna o valor do atributo <code>tipoFechamento</code> |
233 | 207 | * |
234 | 208 | * @return <code>Dominio</code> | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoqueSaldoMedio.java
... | ... | @@ -46,7 +46,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
46 | 46 | * @author geovane.filho |
47 | 47 | * |
48 | 48 | */ |
49 | -@Entity //Deletar | |
49 | +@Entity //TODO Deletar | |
50 | 50 | public class MaterialEstoqueSaldoMedio extends PersistentObjectAuditOrganizacao { |
51 | 51 | |
52 | 52 | private static final long serialVersionUID = -9108177938688790640L; | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialLocalEstoque.java
... | ... | @@ -11,6 +11,8 @@ import javax.persistence.ManyToOne; |
11 | 11 | import javax.persistence.OneToOne; |
12 | 12 | import javax.persistence.Table; |
13 | 13 | |
14 | +import org.hibernate.envers.Audited; | |
15 | + | |
14 | 16 | import br.com.centralit.framework.json.Views; |
15 | 17 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
16 | 18 | |
... | ... | @@ -37,6 +39,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
37 | 39 | * @author geovane.filho |
38 | 40 | * |
39 | 41 | */ |
42 | +@Audited | |
40 | 43 | @Entity |
41 | 44 | @Table(name = "alm_me_localestoque") |
42 | 45 | public class MaterialLocalEstoque extends PersistentObjectAuditOrganizacao { | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MovimentoEstoque.java
... | ... | @@ -14,6 +14,8 @@ import javax.persistence.Table; |
14 | 14 | import javax.persistence.Temporal; |
15 | 15 | import javax.persistence.TemporalType; |
16 | 16 | |
17 | +import org.hibernate.envers.Audited; | |
18 | + | |
17 | 19 | import br.com.centralit.framework.json.JsonCalendarSimpleDateDeserializer; |
18 | 20 | import br.com.centralit.framework.json.JsonCalendarSimpleDateSerializer; |
19 | 21 | import br.com.centralit.framework.json.Views; |
... | ... | @@ -45,6 +47,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
45 | 47 | * @author geovane.filho |
46 | 48 | * |
47 | 49 | */ |
50 | +@Audited | |
48 | 51 | @Entity |
49 | 52 | @Table(name = "alm_me_movimentoestoque") |
50 | 53 | public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/MovimentoEstoqueService.java
... | ... | @@ -2,6 +2,7 @@ package br.com.centralit.api.service; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.Calendar; |
5 | +import java.util.Collection; | |
5 | 6 | import java.util.List; |
6 | 7 | |
7 | 8 | import br.com.centralit.api.model.AtendimentoRequisicaoConsumo; |
... | ... | @@ -13,6 +14,7 @@ import br.com.centralit.api.model.EntradaAlmoxarifado; |
13 | 14 | import br.com.centralit.api.model.EstruturaOrganizacional; |
14 | 15 | import br.com.centralit.api.model.MaterialConsumo; |
15 | 16 | import br.com.centralit.api.model.MovimentoEstoque; |
17 | +import br.com.centralit.framework.model.Dominio; | |
16 | 18 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAudit; |
17 | 19 | import br.com.centralit.framework.service.arquitetura.GenericService; |
18 | 20 | |
... | ... | @@ -192,4 +194,19 @@ public interface MovimentoEstoqueService extends GenericService<MovimentoEstoque |
192 | 194 | */ |
193 | 195 | public void removerMovimentosDevolucao(DevolucaoItem entity); |
194 | 196 | |
197 | + /** | |
198 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
199 | + * | |
200 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
201 | + * | |
202 | + * Método responsável por buscar todos os movimentos por classe de referencia e ID | |
203 | + * | |
204 | + * @author geovane.filho | |
205 | + * | |
206 | + * @param classeReferencia | |
207 | + * @param idReferencia | |
208 | + * @return | |
209 | + */ | |
210 | + public Collection<MovimentoEstoque> findAllByClasseReferencia(Dominio classeReferencia, Long idReferencia); | |
211 | + | |
195 | 212 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/BaixaAlmoxarifadoItemServiceImpl.java
... | ... | @@ -12,7 +12,7 @@ import org.springframework.validation.Validator; |
12 | 12 | import br.com.centralit.api.dao.BaixaAlmoxarifadoItemDao; |
13 | 13 | import br.com.centralit.api.model.BaixaAlmoxarifado; |
14 | 14 | import br.com.centralit.api.model.BaixaAlmoxarifadoItem; |
15 | -import br.com.centralit.api.model.DominioAlmoxarifado; | |
15 | +import br.com.centralit.api.model.DominioMaterial; | |
16 | 16 | import br.com.centralit.api.model.MovimentoEstoque; |
17 | 17 | import br.com.centralit.api.service.BaixaAlmoxarifadoItemService; |
18 | 18 | import br.com.centralit.api.service.BaixaAlmoxarifadoService; |
... | ... | @@ -122,10 +122,13 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
122 | 122 | baixaAlmoxarifadoItem = this.getReference(baixaAlmoxarifadoItem.getId()); |
123 | 123 | |
124 | 124 | baixaAlmoxarifadoItem.setDataEstorno(dataEstorno); |
125 | + | |
126 | + Dominio classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA_ALMOXARIFADO_ITEM); | |
127 | + Collection<MovimentoEstoque> movimentos = this.movimentoEstoqueService.findAllByClasseReferencia(classeReferencia, baixaAlmoxarifadoItem.getId()); | |
125 | 128 | |
126 | - if (!UtilColecao.isVazio(baixaAlmoxarifadoItem.getMovimentos())) { | |
129 | + if (!UtilColecao.isVazio(movimentos)) { | |
127 | 130 | |
128 | - this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) baixaAlmoxarifadoItem.getMovimentos()); | |
131 | + this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) movimentos); | |
129 | 132 | |
130 | 133 | } |
131 | 134 | this.contaContabilMovimentoService.removerMovimentosBaixa(baixaAlmoxarifadoItem.getId()); |
... | ... | @@ -197,12 +200,16 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
197 | 200 | |
198 | 201 | @Override |
199 | 202 | public void removeList(List<BaixaAlmoxarifadoItem> listEntity) { |
203 | + | |
204 | + Dominio classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA_ALMOXARIFADO_ITEM); | |
200 | 205 | |
201 | 206 | for (BaixaAlmoxarifadoItem baixaAlmoxarifadoItem : listEntity) { |
207 | + | |
208 | + Collection<MovimentoEstoque> movimentos = this.movimentoEstoqueService.findAllByClasseReferencia(classeReferencia, baixaAlmoxarifadoItem.getId()); | |
202 | 209 | |
203 | - if (!UtilColecao.isVazio(baixaAlmoxarifadoItem.getMovimentos())) { | |
210 | + if (!UtilColecao.isVazio(movimentos)) { | |
204 | 211 | |
205 | - this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) baixaAlmoxarifadoItem.getMovimentos()); | |
212 | + this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) movimentos); | |
206 | 213 | } |
207 | 214 | this.contaContabilMovimentoService.removerMovimentosBaixa(baixaAlmoxarifadoItem.getId()); |
208 | 215 | } |
... | ... | @@ -212,12 +219,16 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
212 | 219 | |
213 | 220 | @Override |
214 | 221 | public boolean removeById(Long id) { |
222 | + | |
223 | + Dominio classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA_ALMOXARIFADO_ITEM); | |
215 | 224 | |
216 | 225 | BaixaAlmoxarifadoItem baixaAlmoxarifadoItem = this.find(id); |
226 | + | |
227 | + Collection<MovimentoEstoque> movimentos = this.movimentoEstoqueService.findAllByClasseReferencia(classeReferencia, baixaAlmoxarifadoItem.getId()); | |
217 | 228 | |
218 | - if (!UtilColecao.isVazio(baixaAlmoxarifadoItem.getMovimentos())) { | |
229 | + if (!UtilColecao.isVazio(movimentos)) { | |
219 | 230 | |
220 | - this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) baixaAlmoxarifadoItem.getMovimentos()); | |
231 | + this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) movimentos); | |
221 | 232 | } |
222 | 233 | |
223 | 234 | this.contaContabilMovimentoService.removerMovimentosBaixa(id); | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/MovimentoEstoqueServiceImpl.java
... | ... | @@ -3,6 +3,7 @@ package br.com.centralit.api.service.impl; |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.ArrayList; |
5 | 5 | import java.util.Calendar; |
6 | +import java.util.Collection; | |
6 | 7 | import java.util.HashMap; |
7 | 8 | import java.util.List; |
8 | 9 | import java.util.Map; |
... | ... | @@ -27,7 +28,6 @@ import br.com.centralit.api.model.EntradaAlmoxarifado; |
27 | 28 | import br.com.centralit.api.model.EntradaAlmoxarifadoItem; |
28 | 29 | import br.com.centralit.api.model.EstruturaOrganizacional; |
29 | 30 | import br.com.centralit.api.model.MaterialConsumo; |
30 | -import br.com.centralit.api.model.MaterialEstoque; | |
31 | 31 | import br.com.centralit.api.model.MaterialLocalEstoque; |
32 | 32 | import br.com.centralit.api.model.MovimentoEstoque; |
33 | 33 | import br.com.centralit.api.service.BaixaAlmoxarifadoItemService; |
... | ... | @@ -156,6 +156,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
156 | 156 | |
157 | 157 | movimentos.add(movimentoEstoque); |
158 | 158 | |
159 | + //TODO Corrigir com nova versão | |
159 | 160 | this.materialEstoqueSaldoMedioService.atualizaMaterialEstoque(movimentoEstoque.getMaterial(), movimentoEstoque.getQuantidade(), movimentoEstoque.getValorFIFO()); |
160 | 161 | Dominio tipoSaldoEntrada = new Dominio(); |
161 | 162 | if (UtilObjeto.isReferencia(entradaAlmoxarifado.getDominioTipoEntrada())){ |
... | ... | @@ -231,12 +232,21 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
231 | 232 | |
232 | 233 | BigDecimal valorMovimentoFIFO = this.entradaAlmoxarifadoItemService.realizaMovimentoDevolucao(devolucaoItem.getMaterialConsumo(), devolucaoItem.getQuantidade()); |
233 | 234 | BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoDevolucao(devolucaoItem.getMaterialConsumo(), devolucaoItem.getQuantidade()); |
235 | + | |
236 | + | |
237 | + | |
238 | + MovimentoEstoque movimentoEstoque = new MovimentoEstoque(devolucaoItem.getDevolucao().getDataDevolucao(), devolucaoItem.getQuantidade(), valorMovimentoFIFO, valorMovimentoMediaMovel, | |
239 | + tipoMovimentoDevolucao); | |
240 | + | |
241 | + movimentoEstoque.setDominioClasseReferencia(classeReferenciaDevolucao); | |
242 | + movimentoEstoque.setIdClasseReferencia(devolucaoItem.getId()); | |
234 | 243 | |
235 | - MovimentoEstoque movimentoEstoque = new MovimentoEstoque(devolucaoItem.getDevolucao().getDataDevolucao(), devolucaoItem.getQuantidade(), valorMovimentoFIFO, valorMovimentoMediaMovel, tipoMovimentoDevolucao); | |
236 | - | |
237 | - movimentoEstoque.setDevolucaoItem(devolucaoItem); | |
238 | - | |
239 | - movimentoEstoque.setLocalEstoque(this.materialLocalEstoqueService.buscarLocalEstoque(devolucao.getRequisicao().getAlmoxarifado())); | |
244 | + //TODO corrigir movimentação de devolução com versão nova | |
245 | + | |
246 | + /*movimentoEstoque.setLocalEstoque(this.materialLocalEstoqueService.buscarLocalEstoque(devolucao.getRequisicao().getAlmoxarifado())); | |
247 | + movimentoEstoque.setMaterialLocalEstoque(entradaAlmoxarifadoItem.getMaterialLocalEstoque()); | |
248 | + movimentoEstoque.setMaterial(entradaAlmoxarifadoItem.getMaterial()); | |
249 | + movimentoEstoque.setMaterialEstoque(entradaAlmoxarifadoItem.getMaterialLocalEstoque().getMaterialEstoque());*/ | |
240 | 250 | |
241 | 251 | movimentoEstoque.setMaterial(devolucaoItem.getMaterialConsumo()); |
242 | 252 | |
... | ... | @@ -284,9 +294,12 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
284 | 294 | |
285 | 295 | MovimentoEstoque movimentoEstoque = new MovimentoEstoque(baixaAlmoxarifadoItem.getBaixaAlmoxarifado().getDataBaixa(), baixaAlmoxarifadoItem.getQuantidade().multiply(BigDecimal.valueOf(-1)), |
286 | 296 | valorMovimentoFIFO.multiply(BigDecimal.valueOf(-1)), valorMovimentoMediaMovel.multiply(BigDecimal.valueOf(-1)), tipoMovimentoBaixa); |
287 | - movimentoEstoque.setBaixaAlmoxarifadoItem(baixaAlmoxarifadoItem); | |
297 | + | |
298 | + //TODO Corrigir movimento de baixa com versão nova | |
299 | + | |
300 | + /*movimentoEstoque.setBaixaAlmoxarifadoItem(baixaAlmoxarifadoItem); | |
288 | 301 | movimentoEstoque.setLocalEstoque(localEstoque); |
289 | - movimentoEstoque.setMaterial(baixaAlmoxarifadoItem.getMaterialConsumo()); | |
302 | + movimentoEstoque.setMaterial(baixaAlmoxarifadoItem.getMaterialConsumo());*/ | |
290 | 303 | |
291 | 304 | movimentos.add(movimentoEstoque); |
292 | 305 | |
... | ... | @@ -318,6 +331,9 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
318 | 331 | |
319 | 332 | Dominio classeReferencia = null; |
320 | 333 | Long idClasseReferencia = null; |
334 | + | |
335 | + //TODO corrigir remoção com nova versão de dominios | |
336 | + /* | |
321 | 337 | if (movimentoEstoque.getAtendimentoRequisicaoConsumoItem() != null) { |
322 | 338 | classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ATENDIMENTO_ALMOXARIFADO_ITEM); |
323 | 339 | idClasseReferencia = movimentoEstoque.getAtendimentoRequisicaoConsumoItem().getId(); |
... | ... | @@ -330,7 +346,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
330 | 346 | } else if (movimentoEstoque.getEntradaAlmoxarifadoItem() != null) { |
331 | 347 | classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ENTRADA_ALMOXARIFADO_ITEM); |
332 | 348 | idClasseReferencia = movimentoEstoque.getEntradaAlmoxarifadoItem().getId(); |
333 | - } | |
349 | + }*/ | |
334 | 350 | |
335 | 351 | ContaContabilMovimento movimento = this.contaContabilMovimentoService.findByContaAndClasseReferencia(material.getContaContabil(), classeReferencia, idClasseReferencia); |
336 | 352 | |
... | ... | @@ -379,9 +395,11 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
379 | 395 | MovimentoEstoque movimentoEstoque = new MovimentoEstoque(atendimento.getDataAtendimento(), atendimentoRequisicaoConsumoItem.getQuantidade().multiply(BigDecimal.valueOf(-1)), |
380 | 396 | valorMovimentoFIFO.multiply(BigDecimal.valueOf(-1)), valorMovimentoMediaMovel.multiply(BigDecimal.valueOf(-1)), tipoMovimento); //Movimentos negativos pois o valor esta saindo do estoque. |
381 | 397 | |
382 | - movimentoEstoque.setAtendimentoRequisicaoConsumoItem(atendimentoRequisicaoConsumoItem); | |
398 | + //TODO Corrigir movimento de atendimento com versão nova | |
399 | + | |
400 | + /*movimentoEstoque.setAtendimentoRequisicaoConsumoItem(atendimentoRequisicaoConsumoItem); | |
383 | 401 | movimentoEstoque.setLocalEstoque(this.materialLocalEstoqueService.find(getUsuario().getOrganizacao().getId())); |
384 | - movimentoEstoque.setMaterial(atendimentoRequisicaoConsumoItem.getMaterial()); | |
402 | + movimentoEstoque.setMaterial(atendimentoRequisicaoConsumoItem.getMaterial());*/ | |
385 | 403 | |
386 | 404 | movimentos.add(movimentoEstoque); |
387 | 405 | |
... | ... | @@ -555,4 +573,12 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
555 | 573 | return this.movimentoEstoqueDao.buscaQuantidadeMovimentadaMaterialPorReferencia(materialId, dataReferencia, organizacaoId); |
556 | 574 | } |
557 | 575 | |
576 | + /** | |
577 | + * {@inheritDoc} | |
578 | + */ | |
579 | + @Override | |
580 | + public Collection<MovimentoEstoque> findAllByClasseReferencia(Dominio classeReferencia, Long idReferencia) { | |
581 | + return this.movimentoEstoqueDao.findAllByClasseReferencia(classeReferencia, idReferencia); | |
582 | + } | |
583 | + | |
558 | 584 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/validation/MaterialEstoqueValidator.java
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +package br.com.centralit.api.service.validation; | |
2 | + | |
3 | +import org.springframework.stereotype.Component; | |
4 | +import org.springframework.validation.Errors; | |
5 | +import org.springframework.validation.ValidationUtils; | |
6 | +import org.springframework.validation.Validator; | |
7 | + | |
8 | +import br.com.centralit.api.model.MaterialEstoque; | |
9 | +import br.com.centralit.framework.exception.CodigoErro; | |
10 | + | |
11 | +@Component("materialEstoqueValidator") | |
12 | +public class MaterialEstoqueValidator implements Validator { | |
13 | + | |
14 | + @Override | |
15 | + public boolean supports(Class<?> clazz) { | |
16 | + | |
17 | + return MaterialEstoque.class.isAssignableFrom(clazz); | |
18 | + } | |
19 | + | |
20 | + @Override | |
21 | + public void validate(Object target, Errors errors) { | |
22 | + | |
23 | + ValidationUtils.rejectIfEmpty(errors, "material", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.MATERIAL"); | |
24 | + | |
25 | + } | |
26 | +} | |
27 | + | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/LocalEstoqueController.java
... | ... | @@ -36,41 +36,4 @@ public class LocalEstoqueController extends GenericController<MaterialLocalEstoq |
36 | 36 | |
37 | 37 | return ViewsAdmMateriais.LocalEstoqueAutoCompleteView.class; |
38 | 38 | } |
39 | - | |
40 | - /** | |
41 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
42 | - * | |
43 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
44 | - * | |
45 | - * Método responsável por salvar um local estoque com almoxarifado | |
46 | - * | |
47 | - * @author rogerio.cassimiro | |
48 | - * | |
49 | - * @param idAlmoxarifado | |
50 | - * @return ResponseBodyWrapper | |
51 | - */ | |
52 | - @RequestMapping(value = "/saveLocalEstoqueAlmoxarifado", method = RequestMethod.GET, produces = "application/json") | |
53 | - @ResponseBody | |
54 | - public ResponseBodyWrapper saveLocalEstoqueAlmoxarifado(@RequestParam(value = "idAlmoxarifado") String idAlmoxarifado) { | |
55 | - | |
56 | - MyRetornoStatus retorno = new MyRetornoStatus(); | |
57 | - | |
58 | - MaterialLocalEstoque localEstoque = this.localEstoqueService.saveLocalEstoqueAlmoxarifado(idAlmoxarifado); | |
59 | - | |
60 | - if (UtilObjeto.isReferencia(localEstoque)) { | |
61 | - | |
62 | - retorno = new MyRetornoStatus(localEstoque); | |
63 | - | |
64 | - } else { | |
65 | - | |
66 | - MyMensagemRetorno mensagem = new MyMensagemRetorno(MyMensagemRetorno.TipoMensagemRetorno.error, "VALIDACAO.ERRO_LOCAL_ESTOQUE"); | |
67 | - | |
68 | - retorno.mensagens.add(mensagem); | |
69 | - } | |
70 | - | |
71 | - ResponseBodyWrapper responseBody = new ResponseBodyWrapper(retorno, this.getEditView()); | |
72 | - | |
73 | - return responseBody; | |
74 | - | |
75 | - } | |
76 | 39 | } | ... | ... |