Commit 6b2a36df05bd0be80e388d5509aa16f776fe6f6a
Exists in
master
Merge branch 'adm-1.15.0' of http://ferramentasgo.centralit.com.br:8080/scm/git/…
…cit-grp-almoxarifado into adm-1.15.0 # Conflicts: # cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EnderecoEstoque.java # cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoque.java # cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoqueFIFOItem.java # cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialLocalEstoque.java # cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MovimentoEstoque.java
Showing
64 changed files
with
1639 additions
and
2063 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/LocalEstoqueDao.java
1 | 1 | package br.com.centralit.api.dao; |
2 | 2 | |
3 | 3 | import br.com.centralit.api.model.EstruturaOrganizacional; |
4 | -import br.com.centralit.api.model.LocalEstoque; | |
4 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
5 | 5 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; |
6 | 6 | |
7 | 7 | public interface LocalEstoqueDao extends CitGenericDAO { |
... | ... | @@ -14,5 +14,5 @@ public interface LocalEstoqueDao extends CitGenericDAO { |
14 | 14 | * @param almoxarifado |
15 | 15 | * @return |
16 | 16 | */ |
17 | - LocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado); | |
17 | + MaterialLocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado); | |
18 | 18 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/MaterialEstoqueDao.java
0 → 100644
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/MaterialEstoqueSaldoMedioDao.java
... | ... | @@ -1,47 +0,0 @@ |
1 | -package br.com.centralit.api.dao; | |
2 | - | |
3 | -import java.math.BigDecimal; | |
4 | - | |
5 | -import br.com.centralit.api.model.Material; | |
6 | -import br.com.centralit.api.model.MaterialEstoqueSaldoMedio; | |
7 | -import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; | |
8 | - | |
9 | -public interface MaterialEstoqueSaldoMedioDao extends CitGenericDAO { | |
10 | - | |
11 | - /** | |
12 | - * Recupera os dados do estoque e saldo de um material a partir da análise média | |
13 | - * | |
14 | - * @param material Material a se buscar os dados de estoque médio. | |
15 | - * @return | |
16 | - */ | |
17 | - public MaterialEstoqueSaldoMedio findByMaterial(Material material); | |
18 | - | |
19 | - /** | |
20 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">2485</a></p> | |
21 | - * | |
22 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
23 | - * | |
24 | - * Método responsável por buscar o valor unitario do material na quando o sistema esta configurado para trabalhar com a media movel | |
25 | - * | |
26 | - * @author juliana.barbosa | |
27 | - * | |
28 | - * @param materialId | |
29 | - * @return | |
30 | - */ | |
31 | - public BigDecimal buscaValorUnitario(Long materialId); | |
32 | - | |
33 | - /** | |
34 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">2485</a></p> | |
35 | - * | |
36 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
37 | - * | |
38 | - * Método responsável por buscar o resto do material na quando o sistema esta configurado para trabalhar com a media movel | |
39 | - * | |
40 | - * @author juliana.barbosa | |
41 | - * | |
42 | - * @param materialId | |
43 | - * @return | |
44 | - */ | |
45 | - public BigDecimal buscaValorResto(Long materialId); | |
46 | - | |
47 | -} |
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/LocalEstoqueDaoHibernate.java
... | ... | @@ -4,7 +4,7 @@ import org.springframework.stereotype.Repository; |
4 | 4 | |
5 | 5 | import br.com.centralit.api.dao.LocalEstoqueDao; |
6 | 6 | import br.com.centralit.api.model.EstruturaOrganizacional; |
7 | -import br.com.centralit.api.model.LocalEstoque; | |
7 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
8 | 8 | import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; |
9 | 9 | import br.com.centralit.framework.dao.arquitetura.SearchSeven; |
10 | 10 | |
... | ... | @@ -40,14 +40,14 @@ public class LocalEstoqueDaoHibernate extends CitGenericDAOImpl implements Local |
40 | 40 | */ |
41 | 41 | public LocalEstoqueDaoHibernate() { |
42 | 42 | |
43 | - super(LocalEstoque.class); | |
43 | + super(MaterialLocalEstoque.class); | |
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * {@inheritDoc} |
48 | 48 | */ |
49 | 49 | @Override |
50 | - public LocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado) { | |
50 | + public MaterialLocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado) { | |
51 | 51 | |
52 | 52 | SearchSeven search = new SearchSeven(); |
53 | 53 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/impl/MaterialEstoqueDaoHibernate.java
0 → 100644
... | ... | @@ -0,0 +1,16 @@ |
1 | +package br.com.centralit.api.dao.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Repository; | |
4 | + | |
5 | +import br.com.centralit.api.dao.MaterialEstoqueDao; | |
6 | +import br.com.centralit.api.model.MaterialEstoque; | |
7 | +import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | |
8 | + | |
9 | +@Repository("materialEstoqueDao") | |
10 | +public class MaterialEstoqueDaoHibernate extends CitGenericDAOImpl implements MaterialEstoqueDao { | |
11 | + | |
12 | + public MaterialEstoqueDaoHibernate() { | |
13 | + super(MaterialEstoque.class); | |
14 | + } | |
15 | + | |
16 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/impl/MaterialEstoqueSaldoMedioDaoHibernate.java
... | ... | @@ -1,97 +0,0 @@ |
1 | -package br.com.centralit.api.dao.impl; | |
2 | - | |
3 | -import java.math.BigDecimal; | |
4 | - | |
5 | -import javax.persistence.NoResultException; | |
6 | -import javax.persistence.Query; | |
7 | - | |
8 | -import org.springframework.stereotype.Repository; | |
9 | - | |
10 | -import br.com.centralit.api.dao.MaterialEstoqueSaldoMedioDao; | |
11 | -import br.com.centralit.api.model.Material; | |
12 | -import br.com.centralit.api.model.MaterialEstoqueSaldoMedio; | |
13 | -import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | |
14 | -import br.com.centralit.framework.dao.arquitetura.SearchSeven; | |
15 | - | |
16 | -@Repository("materialEstoqueSaldoMedioDao") | |
17 | -public class MaterialEstoqueSaldoMedioDaoHibernate extends CitGenericDAOImpl implements MaterialEstoqueSaldoMedioDao { | |
18 | - | |
19 | - public MaterialEstoqueSaldoMedioDaoHibernate() { | |
20 | - super(MaterialEstoqueSaldoMedio.class); | |
21 | - } | |
22 | - | |
23 | - @Override | |
24 | - public MaterialEstoqueSaldoMedio findByMaterial(Material material) { | |
25 | - SearchSeven search = new SearchSeven(); | |
26 | - | |
27 | - search.addFilterEqual("material.id", material.getId()); | |
28 | - | |
29 | - search.setMaxResults(1); | |
30 | - | |
31 | - return this.searchUnique(search, MaterialEstoqueSaldoMedio.class); | |
32 | - } | |
33 | - | |
34 | - /** | |
35 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">2485</a></p> | |
36 | - * | |
37 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
38 | - * | |
39 | - * Método responsável por buscar o valor unitario do material na quando o sistema esta configurado para trabalhar com a media movel | |
40 | - * | |
41 | - * @author juliana.barbosa | |
42 | - * | |
43 | - * @param materialId | |
44 | - * @return | |
45 | - */ | |
46 | - public BigDecimal buscaValorUnitario(Long materialId){ | |
47 | - Query queryQnt = em().createQuery("SELECT valorunitariomedio FROM MaterialEstoqueSaldoMedio where material.id = :materialId"); | |
48 | - queryQnt.setMaxResults(1); | |
49 | - | |
50 | - queryQnt.setParameter("materialId", materialId); | |
51 | - | |
52 | - BigDecimal valor = BigDecimal.ZERO; | |
53 | - | |
54 | - try { | |
55 | - valor = (BigDecimal) queryQnt.getSingleResult(); | |
56 | - if (valor == null) { | |
57 | - valor = BigDecimal.ZERO; | |
58 | - } | |
59 | - } catch (NoResultException e) { | |
60 | - valor = BigDecimal.ZERO; | |
61 | - } | |
62 | - | |
63 | - return valor; | |
64 | - } | |
65 | - | |
66 | - /** | |
67 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">2485</a></p> | |
68 | - * | |
69 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
70 | - * | |
71 | - * Método responsável por buscar o resto do material na quando o sistema esta configurado para trabalhar com a media movel | |
72 | - * | |
73 | - * @author juliana.barbosa | |
74 | - * | |
75 | - * @param materialId | |
76 | - * @return | |
77 | - */ | |
78 | - public BigDecimal buscaValorResto(Long materialId){ | |
79 | - Query queryQnt = em().createQuery("SELECT restomedio FROM MaterialEstoqueSaldoMedio where material.id = :materialId"); | |
80 | - queryQnt.setMaxResults(1); | |
81 | - | |
82 | - queryQnt.setParameter("materialId", materialId); | |
83 | - | |
84 | - BigDecimal resto = BigDecimal.ZERO; | |
85 | - | |
86 | - try { | |
87 | - resto = (BigDecimal) queryQnt.getSingleResult(); | |
88 | - if (resto == null) { | |
89 | - resto = BigDecimal.ZERO; | |
90 | - } | |
91 | - } catch (NoResultException e) { | |
92 | - resto = BigDecimal.ZERO; | |
93 | - } | |
94 | - | |
95 | - return resto; | |
96 | - } | |
97 | -} |
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/AtendimentoRequisicaoConsumo.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 | import javax.persistence.Transient; |
... | ... | @@ -61,6 +62,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
61 | 62 | * |
62 | 63 | */ |
63 | 64 | @Entity |
65 | +@Table(name="alm_rc_atendimento") | |
64 | 66 | @JsonIgnoreProperties({"$selecionarRequisicoes", "$dataFinalizacao"}) |
65 | 67 | public class AtendimentoRequisicaoConsumo extends PersistentObjectAuditOrganizacao { |
66 | 68 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/AtendimentoRequisicaoConsumoItem.java
... | ... | @@ -51,7 +51,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
51 | 51 | * |
52 | 52 | */ |
53 | 53 | @Entity |
54 | -@Table(name="AtendimentoReqConsumoItem") | |
54 | +@Table(name="alm_rc_atendimentoitem") | |
55 | 55 | @JsonIgnoreProperties({"$info", "$verInfo", "$quantidade"}) |
56 | 56 | public class AtendimentoRequisicaoConsumoItem extends PersistentObjectAuditOrganizacao { |
57 | 57 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/BaixaAlmoxarifado.java
... | ... | @@ -9,6 +9,7 @@ import javax.persistence.Entity; |
9 | 9 | import javax.persistence.FetchType; |
10 | 10 | import javax.persistence.ManyToOne; |
11 | 11 | import javax.persistence.OneToMany; |
12 | +import javax.persistence.Table; | |
12 | 13 | import javax.persistence.Temporal; |
13 | 14 | import javax.persistence.TemporalType; |
14 | 15 | |
... | ... | @@ -58,6 +59,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
58 | 59 | */ |
59 | 60 | @Audited |
60 | 61 | @Entity |
62 | +@Table(name="alm_baixa") | |
61 | 63 | public class BaixaAlmoxarifado extends Baixa { |
62 | 64 | |
63 | 65 | /** Atributo serialVersionUID. */ | ... | ... |
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,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 | import javax.persistence.Transient; |
... | ... | @@ -62,6 +60,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
62 | 60 | * |
63 | 61 | */ |
64 | 62 | @Entity |
63 | +@Table(name="alm_bx_item") | |
65 | 64 | @JsonIgnoreProperties({ "descricao", "unidadeArmazenamento", "$selected", "$index", "$checked" }) |
66 | 65 | public class BaixaAlmoxarifadoItem extends PersistentObjectAudit { |
67 | 66 | |
... | ... | @@ -104,10 +103,6 @@ public class BaixaAlmoxarifadoItem extends PersistentObjectAudit { |
104 | 103 | @JsonView({ ViewsAdmMateriais.BaixaAlmoxarifadoEditView.class }) |
105 | 104 | private Calendar dataEstorno; |
106 | 105 | |
107 | - /** Atributo movimentos. */ | |
108 | - @OneToMany(fetch = FetchType.LAZY, mappedBy = "baixaAlmoxarifadoItem", cascade = CascadeType.ALL) | |
109 | - private Collection<MovimentoEstoque> movimentos; | |
110 | - | |
111 | 106 | @Transient |
112 | 107 | @JsonView({ ViewsAdmMateriais.BaixaAlmoxarifadoEditView.class }) |
113 | 108 | private BigDecimal qtdEstoque; |
... | ... | @@ -254,26 +249,6 @@ public class BaixaAlmoxarifadoItem extends PersistentObjectAudit { |
254 | 249 | } |
255 | 250 | |
256 | 251 | /** |
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 | 252 | * Retorna o valor do atributo <code>baixaRemocao</code> |
278 | 253 | * |
279 | 254 | * @return <code>BaixaAlmoxarifado</code> | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/BemAlmoxarifadoCaracteristica.java
... | ... | @@ -6,16 +6,16 @@ import javax.persistence.GeneratedValue; |
6 | 6 | import javax.persistence.GenerationType; |
7 | 7 | import javax.persistence.Id; |
8 | 8 | import javax.persistence.ManyToOne; |
9 | +import javax.persistence.Table; | |
9 | 10 | |
10 | -import org.hibernate.envers.AuditTable; | |
11 | 11 | import org.hibernate.envers.Audited; |
12 | 12 | |
13 | -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
14 | -import com.fasterxml.jackson.annotation.JsonView; | |
15 | - | |
16 | 13 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
17 | 14 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
18 | 15 | |
16 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
17 | +import com.fasterxml.jackson.annotation.JsonView; | |
18 | + | |
19 | 19 | /** |
20 | 20 | * <p> |
21 | 21 | * <img src="http://centralit.com.br/images/logo_central.png"> |
... | ... | @@ -49,8 +49,8 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganiz |
49 | 49 | * |
50 | 50 | */ |
51 | 51 | @Audited |
52 | -@AuditTable(value = "BemAlmoxCaract_aud") | |
53 | 52 | @Entity |
53 | +@Table(name="alm_bem_caracteristica") | |
54 | 54 | @JsonIgnoreProperties({ "uploadAnexo", "listaDominios" }) |
55 | 55 | public class BemAlmoxarifadoCaracteristica extends PersistentObjectAuditOrganizacao { |
56 | 56 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/CatalogoMaterial.java
... | ... | @@ -11,6 +11,7 @@ import javax.persistence.GeneratedValue; |
11 | 11 | import javax.persistence.GenerationType; |
12 | 12 | import javax.persistence.Id; |
13 | 13 | import javax.persistence.OneToMany; |
14 | +import javax.persistence.Table; | |
14 | 15 | import javax.persistence.Temporal; |
15 | 16 | import javax.persistence.TemporalType; |
16 | 17 | |
... | ... | @@ -57,6 +58,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
57 | 58 | * |
58 | 59 | */ |
59 | 60 | @Entity |
61 | +@Table(name="alm_catalogomaterial") | |
60 | 62 | public class CatalogoMaterial extends PersistentObjectAuditOrganizacao { |
61 | 63 | |
62 | 64 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/CatalogoMaterialItem.java
... | ... | @@ -6,6 +6,7 @@ import javax.persistence.GeneratedValue; |
6 | 6 | import javax.persistence.GenerationType; |
7 | 7 | import javax.persistence.Id; |
8 | 8 | import javax.persistence.ManyToOne; |
9 | +import javax.persistence.Table; | |
9 | 10 | |
10 | 11 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
11 | 12 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
... | ... | @@ -46,6 +47,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
46 | 47 | * |
47 | 48 | */ |
48 | 49 | @Entity |
50 | +@Table(name="alm_cm_item") | |
49 | 51 | @JsonIgnoreProperties({ "$index" }) |
50 | 52 | public class CatalogoMaterialItem extends PersistentObjectAuditOrganizacao { |
51 | 53 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/CatalogoMaterialUnidadeConsumidoraRequisitanteItem.java
... | ... | @@ -47,7 +47,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
47 | 47 | * |
48 | 48 | */ |
49 | 49 | @Entity |
50 | -@Table(name="CatMaterialUnidadeConsReqItem") | |
50 | +@Table(name="alm_cm_undreqitem") | |
51 | 51 | @JsonIgnoreProperties({ "$index" }) |
52 | 52 | public class CatalogoMaterialUnidadeConsumidoraRequisitanteItem extends PersistentObjectAuditOrganizacao { |
53 | 53 | ... | ... |
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. */ |
... | ... | @@ -87,7 +87,7 @@ public class ConfiguracaoNotificacaoRessuprimento extends PersistentObjectAuditO |
87 | 87 | /** Atributo localEstoque. */ |
88 | 88 | @ManyToOne(fetch = FetchType.LAZY, optional = false) |
89 | 89 | @JsonView({ ViewsAlmoxarifado.ConfiguracaoRessuprimentoListView.class, ViewsAlmoxarifado.ConfiguracaoRessuprimentoEditView.class }) |
90 | - private LocalEstoque localEstoque; | |
90 | + private MaterialLocalEstoque localEstoque; | |
91 | 91 | |
92 | 92 | /** Atributo notificacao. */ |
93 | 93 | @ManyToOne(fetch = FetchType.EAGER, optional = false) |
... | ... | @@ -198,7 +198,7 @@ public class ConfiguracaoNotificacaoRessuprimento extends PersistentObjectAuditO |
198 | 198 | * |
199 | 199 | * @return <code>LocalEstoque</code> |
200 | 200 | */ |
201 | - public LocalEstoque getLocalEstoque() { | |
201 | + public MaterialLocalEstoque getLocalEstoque() { | |
202 | 202 | |
203 | 203 | return localEstoque; |
204 | 204 | } |
... | ... | @@ -208,7 +208,7 @@ public class ConfiguracaoNotificacaoRessuprimento extends PersistentObjectAuditO |
208 | 208 | * |
209 | 209 | * @param localEstoque |
210 | 210 | */ |
211 | - public void setLocalEstoque(LocalEstoque localEstoque) { | |
211 | + public void setLocalEstoque(MaterialLocalEstoque localEstoque) { | |
212 | 212 | |
213 | 213 | this.localEstoque = localEstoque; |
214 | 214 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/ConfiguracaoNotificacaoRessuprimentoGrupo.java
... | ... | @@ -50,7 +50,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
50 | 50 | * |
51 | 51 | */ |
52 | 52 | @Entity |
53 | -@Table(name="ConfigNotificacaoRessupGrupo") | |
53 | +@Table(name="alm_not_res_grupo") | |
54 | 54 | @JsonIgnoreProperties({ "$checked" }) |
55 | 55 | public class ConfiguracaoNotificacaoRessuprimentoGrupo extends PersistentObjectAuditOrganizacao { |
56 | 56 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/ConfiguracaoNotificacaoRessuprimentoUsuario.java
... | ... | @@ -50,7 +50,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
50 | 50 | * |
51 | 51 | */ |
52 | 52 | @Entity |
53 | -@Table(name="ConfigNotificacaoRessupUsuario") | |
53 | +@Table(name="alm_not_res_usuario") | |
54 | 54 | @JsonIgnoreProperties({ "$checked" }) |
55 | 55 | public class ConfiguracaoNotificacaoRessuprimentoUsuario extends PersistentObjectAuditOrganizacao { |
56 | 56 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/Devolucao.java
... | ... | @@ -12,6 +12,7 @@ import javax.persistence.GenerationType; |
12 | 12 | import javax.persistence.Id; |
13 | 13 | import javax.persistence.ManyToOne; |
14 | 14 | import javax.persistence.OneToMany; |
15 | +import javax.persistence.Table; | |
15 | 16 | import javax.persistence.Temporal; |
16 | 17 | import javax.persistence.TemporalType; |
17 | 18 | |
... | ... | @@ -58,6 +59,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
58 | 59 | * |
59 | 60 | */ |
60 | 61 | @Entity |
62 | +@Table(name="alm_devolucao") | |
61 | 63 | public class Devolucao extends PersistentObjectAuditOrganizacao { |
62 | 64 | |
63 | 65 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/DevolucaoDocumento.java
... | ... | @@ -3,10 +3,12 @@ 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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
8 | 9 | |
9 | 10 | @Entity |
11 | +@Table(name="alm_dev_documento") | |
10 | 12 | @JsonIgnoreProperties({ "uploadsDocumento", "$uuid", "$checked", "$index" }) |
11 | 13 | public class DevolucaoDocumento extends Documento { |
12 | 14 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/DevolucaoItem.java
... | ... | @@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue; |
8 | 8 | import javax.persistence.GenerationType; |
9 | 9 | import javax.persistence.Id; |
10 | 10 | import javax.persistence.ManyToOne; |
11 | +import javax.persistence.Table; | |
11 | 12 | |
12 | 13 | import com.fasterxml.jackson.annotation.JsonView; |
13 | 14 | |
... | ... | @@ -48,6 +49,7 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganiz |
48 | 49 | * |
49 | 50 | */ |
50 | 51 | @Entity |
52 | +@Table(name="alm_dev_item") | |
51 | 53 | public class DevolucaoItem extends PersistentObjectAuditOrganizacao { |
52 | 54 | |
53 | 55 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/DevolucaoObservacao.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 | * <p> |
... | ... | @@ -37,6 +38,7 @@ import javax.persistence.ManyToOne; |
37 | 38 | * |
38 | 39 | */ |
39 | 40 | @Entity |
41 | +@Table(name="alm_dev_observacao") | |
40 | 42 | public class DevolucaoObservacao extends Observacao { |
41 | 43 | |
42 | 44 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifado.java
1 | 1 | package br.com.centralit.api.model; |
2 | 2 | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.Calendar; | |
3 | 6 | import java.util.Collection; |
4 | 7 | |
5 | 8 | import javax.persistence.CascadeType; |
6 | 9 | import javax.persistence.Column; |
7 | 10 | import javax.persistence.Entity; |
8 | 11 | import javax.persistence.FetchType; |
12 | +import javax.persistence.GeneratedValue; | |
13 | +import javax.persistence.GenerationType; | |
14 | +import javax.persistence.Id; | |
9 | 15 | import javax.persistence.ManyToOne; |
10 | 16 | import javax.persistence.OneToMany; |
17 | +import javax.persistence.Table; | |
18 | +import javax.persistence.Temporal; | |
19 | +import javax.persistence.TemporalType; | |
11 | 20 | |
12 | 21 | import org.hibernate.envers.AuditJoinTable; |
13 | 22 | import org.hibernate.envers.Audited; |
23 | +import org.hibernate.envers.NotAudited; | |
14 | 24 | |
15 | 25 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
26 | +import br.com.centralit.framework.json.JsonCalendarSimpleDateDeserializer; | |
27 | +import br.com.centralit.framework.json.JsonCalendarSimpleDateSerializer; | |
28 | +import br.com.centralit.framework.json.MoneyDeserializer; | |
29 | +import br.com.centralit.framework.json.Views; | |
16 | 30 | import br.com.centralit.framework.model.Dominio; |
31 | +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
32 | +import br.com.centralit.framework.util.UtilObjeto; | |
17 | 33 | |
34 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
18 | 35 | import com.fasterxml.jackson.annotation.JsonView; |
36 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
37 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |
19 | 38 | |
20 | 39 | /** |
21 | 40 | * <p> |
... | ... | @@ -51,10 +70,96 @@ import com.fasterxml.jackson.annotation.JsonView; |
51 | 70 | */ |
52 | 71 | @Audited |
53 | 72 | @Entity |
54 | -public class EntradaAlmoxarifado extends Entrada { | |
73 | +@Table(name = "alm_entrada") | |
74 | +@JsonIgnoreProperties({ "$checked", "$selected" }) | |
75 | +public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implements Cloneable { | |
55 | 76 | |
56 | 77 | /** Atributo serialVersionUID. */ |
57 | 78 | private static final long serialVersionUID = 6267732497145774401L; |
79 | + | |
80 | + /** Atributo id. */ | |
81 | + @Id | |
82 | +// @SequenceGenerator(name = "entrada_id_seq", sequenceName = "entrada_id_seq") | |
83 | +// @GeneratedValue(strategy = GenerationType.AUTO, generator = "entrada_id_seq") | |
84 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
85 | + @JsonView({ Views.GenericView.class }) | |
86 | + private Long id; | |
87 | + | |
88 | + /** Atributo dataReferencia. */ | |
89 | + @Column(name = "dataReferencia", nullable = false, updatable = false) | |
90 | + @Temporal(TemporalType.TIMESTAMP) | |
91 | + @JsonSerialize(using = JsonCalendarSimpleDateSerializer.class) | |
92 | + @JsonDeserialize(using = JsonCalendarSimpleDateDeserializer.class) | |
93 | + @JsonView({ Views.EntradaListView.class }) | |
94 | + private Calendar dataReferencia; | |
95 | + | |
96 | + /** Atributo dataContabil. */ | |
97 | + @Column(name = "dataContabil", nullable = true) | |
98 | + @Temporal(TemporalType.TIMESTAMP) | |
99 | + @JsonSerialize(using = JsonCalendarSimpleDateSerializer.class) | |
100 | + @JsonDeserialize(using = JsonCalendarSimpleDateDeserializer.class) | |
101 | + @JsonView({ Views.EntradaListView.class, Views.BemPatrimonialEditView.class, Views.BemPatrimonialListView.class, Views.BemPatrimonialAutoCompleteView.class, Views.GenericView.class }) | |
102 | + private Calendar dataContabil; | |
103 | + | |
104 | + /** Atributo dataRecebimento. */ | |
105 | + @Column(name = "dataRecebimento", nullable = true) | |
106 | + @Temporal(TemporalType.TIMESTAMP) | |
107 | + @JsonSerialize(using = JsonCalendarSimpleDateSerializer.class) | |
108 | + @JsonDeserialize(using = JsonCalendarSimpleDateDeserializer.class) | |
109 | + @JsonView({ Views.EntradaListView.class, Views.BemPatrimonialEditView.class }) | |
110 | + private Calendar dataRecebimento; | |
111 | + | |
112 | + /** Atributo codigo. */ | |
113 | + @Column(length = 30) | |
114 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
115 | + @JsonView({ Views.EntradaAutoCompleteView.class }) | |
116 | + private String codigo; | |
117 | + | |
118 | + /** Atributo valorTotalNota. */ | |
119 | + @Column(precision = 20, scale = 2) | |
120 | + @JsonDeserialize(using = MoneyDeserializer.class) | |
121 | + @JsonView({ Views.EntradaListView.class }) | |
122 | + private BigDecimal valorTotalNota; | |
123 | + | |
124 | + /** Atributo dominioTipoEntrada. */ | |
125 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
126 | + @JsonView({ Views.EntradaAutoCompleteView.class }) | |
127 | + private Dominio dominioTipoEntrada; | |
128 | + | |
129 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
130 | + @JsonView({ Views.EntradaListView.class }) | |
131 | + private Dominio dominioTipoRecebimento; | |
132 | + | |
133 | + /** Atributo fornecedor. */ | |
134 | + @NotAudited | |
135 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
136 | + @JsonView({ Views.EntradaListView.class }) | |
137 | + private Parceiro fornecedor; | |
138 | + | |
139 | + /** Atributo observacoes. */ | |
140 | + @NotAudited | |
141 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "entrada", cascade = CascadeType.ALL, orphanRemoval = true) | |
142 | + @JsonView({ Views.EntradaEditView.class }) | |
143 | + private Collection<EntradaAlmoxarifadoObservacao> observacoes; | |
144 | + | |
145 | + /** Atributo documentos. */ | |
146 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "entrada", cascade = CascadeType.ALL, orphanRemoval = true) | |
147 | + @JsonView({ Views.EntradaEditView.class }) | |
148 | + private Collection<EntradaAlmoxarifadoDocumento> documentos; | |
149 | + | |
150 | + /** Atributo codigo. */ | |
151 | + @Column(length = 30) | |
152 | + private String codigoAsi; | |
153 | + | |
154 | + /** Atributo entrada concluida. */ | |
155 | + @Column(name = "isentradaconcluida") | |
156 | + @JsonView({ Views.EntradaListView.class }) | |
157 | + private Boolean isEntradaConcluida; | |
158 | + | |
159 | + /** Atributo entrada contabilizada. */ | |
160 | + @Column(name = "iscontabilizada") | |
161 | + @JsonView({ Views.EntradaListView.class }) | |
162 | + private Boolean isContabilizada; | |
58 | 163 | |
59 | 164 | /** Atributo estruturaOrganizacional. */ |
60 | 165 | @ManyToOne(fetch = FetchType.LAZY, optional = false) |
... | ... | @@ -69,7 +174,7 @@ public class EntradaAlmoxarifado extends Entrada { |
69 | 174 | @AuditJoinTable |
70 | 175 | @OneToMany(fetch = FetchType.LAZY, mappedBy = "entrada", cascade = CascadeType.ALL, orphanRemoval = true) |
71 | 176 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
72 | - private Collection<EntradaAlmoxarifadoItem> entradasIten; | |
177 | + private Collection<EntradaAlmoxarifadoItem> entradasItem; | |
73 | 178 | |
74 | 179 | @ManyToOne(fetch = FetchType.LAZY, optional = false) |
75 | 180 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
... | ... | @@ -80,6 +185,312 @@ public class EntradaAlmoxarifado extends Entrada { |
80 | 185 | private EstruturaOrganizacional unidadeRequisitante; |
81 | 186 | |
82 | 187 | /** |
188 | + * Retorna o valor do atributo <code>id</code> | |
189 | + * | |
190 | + * @return <code>Long</code> | |
191 | + */ | |
192 | + public Long getId() { | |
193 | + | |
194 | + return id; | |
195 | + } | |
196 | + | |
197 | + /** | |
198 | + * Define o valor do atributo <code>id</code>. | |
199 | + * | |
200 | + * @param id | |
201 | + */ | |
202 | + public void setId(Long id) { | |
203 | + | |
204 | + this.id = id; | |
205 | + } | |
206 | + | |
207 | + /** | |
208 | + * Retorna o valor do atributo <code>observacoes</code> | |
209 | + * | |
210 | + * @return <code>Collection<EntradaObservacao></code> | |
211 | + */ | |
212 | + public Collection<EntradaAlmoxarifadoObservacao> getObservacoes() { | |
213 | + | |
214 | + if (!UtilObjeto.isReferencia(observacoes)) { | |
215 | + | |
216 | + this.observacoes = new ArrayList<EntradaAlmoxarifadoObservacao>(); | |
217 | + } | |
218 | + | |
219 | + return observacoes; | |
220 | + } | |
221 | + | |
222 | + /** | |
223 | + * Define o valor do atributo <code>observacoes</code>. | |
224 | + * | |
225 | + * @param observacoes | |
226 | + */ | |
227 | + public void setObservacoes(Collection<EntradaAlmoxarifadoObservacao> observacoes) { | |
228 | + | |
229 | + this.observacoes = observacoes; | |
230 | + } | |
231 | + | |
232 | + /** | |
233 | + * Retorna o valor do atributo <code>documentos</code> | |
234 | + * | |
235 | + * @return <code>Collection<EntradaDocumento></code> | |
236 | + */ | |
237 | + public Collection<EntradaAlmoxarifadoDocumento> getDocumentos() { | |
238 | + | |
239 | + if (!UtilObjeto.isReferencia(documentos)) { | |
240 | + | |
241 | + this.documentos = new ArrayList<EntradaAlmoxarifadoDocumento>(); | |
242 | + } | |
243 | + | |
244 | + return documentos; | |
245 | + } | |
246 | + | |
247 | + /** | |
248 | + * Define o valor do atributo <code>documentos</code>. | |
249 | + * | |
250 | + * @param documentos | |
251 | + */ | |
252 | + public void setDocumentos(Collection<EntradaAlmoxarifadoDocumento> documentos) { | |
253 | + | |
254 | + this.documentos = documentos; | |
255 | + } | |
256 | + | |
257 | + /** | |
258 | + * Retorna o valor do atributo <code>dataContabil</code> | |
259 | + * | |
260 | + * @return <code>Calendar</code> | |
261 | + */ | |
262 | + public Calendar getDataContabil() { | |
263 | + | |
264 | + return dataContabil; | |
265 | + } | |
266 | + | |
267 | + /** | |
268 | + * Define o valor do atributo <code>dataContabil</code>. | |
269 | + * | |
270 | + * @param dataContabil | |
271 | + */ | |
272 | + public void setDataContabil(Calendar dataContabil) { | |
273 | + | |
274 | + this.dataContabil = dataContabil; | |
275 | + } | |
276 | + | |
277 | + /** | |
278 | + * Retorna o valor do atributo <code>dataRecebimento</code> | |
279 | + * | |
280 | + * @return <code>Calendar</code> | |
281 | + */ | |
282 | + public Calendar getDataRecebimento() { | |
283 | + | |
284 | + return dataRecebimento; | |
285 | + } | |
286 | + | |
287 | + /** | |
288 | + * Define o valor do atributo <code>dataRecebimento</code>. | |
289 | + * | |
290 | + * @param dataRecebimento | |
291 | + */ | |
292 | + public void setDataRecebimento(Calendar dataRecebimento) { | |
293 | + | |
294 | + this.dataRecebimento = dataRecebimento; | |
295 | + } | |
296 | + | |
297 | + /** | |
298 | + * Retorna o valor do atributo <code>codigo</code> | |
299 | + * | |
300 | + * @return <code>String</code> | |
301 | + */ | |
302 | + public String getCodigo() { | |
303 | + | |
304 | + return codigo; | |
305 | + } | |
306 | + | |
307 | + /** | |
308 | + * Define o valor do atributo <code>codigo</code>. | |
309 | + * | |
310 | + * @param codigo | |
311 | + */ | |
312 | + public void setCodigo(String codigo) { | |
313 | + | |
314 | + this.codigo = codigo; | |
315 | + } | |
316 | + | |
317 | + /** | |
318 | + * Retorna o valor do atributo <code>valorTotalNota</code> | |
319 | + * | |
320 | + * @return <code>BigDecimal</code> | |
321 | + */ | |
322 | + public BigDecimal getValorTotalNota() { | |
323 | + | |
324 | + return valorTotalNota; | |
325 | + } | |
326 | + | |
327 | + /** | |
328 | + * Define o valor do atributo <code>valorTotalNota</code>. | |
329 | + * | |
330 | + * @param valorTotalNota | |
331 | + */ | |
332 | + public void setValorTotalNota(BigDecimal valorTotalNota) { | |
333 | + | |
334 | + this.valorTotalNota = valorTotalNota; | |
335 | + } | |
336 | + | |
337 | + /** | |
338 | + * Retorna o valor do atributo <code>dominioTipoEntrada</code> | |
339 | + * | |
340 | + * @return <code>Dominio</code> | |
341 | + */ | |
342 | + public Dominio getDominioTipoEntrada() { | |
343 | + | |
344 | + return dominioTipoEntrada; | |
345 | + } | |
346 | + | |
347 | + /** | |
348 | + * Define o valor do atributo <code>dominioTipoEntrada</code>. | |
349 | + * | |
350 | + * @param dominioTipoEntrada | |
351 | + */ | |
352 | + public void setDominioTipoEntrada(Dominio dominioTipoEntrada) { | |
353 | + | |
354 | + this.dominioTipoEntrada = dominioTipoEntrada; | |
355 | + } | |
356 | + | |
357 | + /** | |
358 | + * Retorna o valor do atributo <code>fornecedor</code> | |
359 | + * | |
360 | + * @return <code>Parceiro</code> | |
361 | + */ | |
362 | + public Parceiro getFornecedor() { | |
363 | + | |
364 | + return fornecedor; | |
365 | + } | |
366 | + | |
367 | + /** | |
368 | + * Define o valor do atributo <code>fornecedor</code>. | |
369 | + * | |
370 | + * @param fornecedor | |
371 | + */ | |
372 | + public void setFornecedor(Parceiro fornecedor) { | |
373 | + | |
374 | + this.fornecedor = fornecedor; | |
375 | + } | |
376 | + | |
377 | + /** | |
378 | + * Retorna o valor do atributo <code>dominioTipoRecebimento</code> | |
379 | + * | |
380 | + * @return <code>Dominio</code> | |
381 | + */ | |
382 | + public Dominio getDominioTipoRecebimento() { | |
383 | + | |
384 | + return dominioTipoRecebimento; | |
385 | + } | |
386 | + | |
387 | + /** | |
388 | + * Define o valor do atributo <code>dominioTipoRecebimento</code>. | |
389 | + * | |
390 | + * @param dominioTipoRecebimento | |
391 | + */ | |
392 | + public void setDominioTipoRecebimento(Dominio dominioTipoRecebimento) { | |
393 | + | |
394 | + this.dominioTipoRecebimento = dominioTipoRecebimento; | |
395 | + } | |
396 | + | |
397 | + /** | |
398 | + * Retorna o valor do atributo <code>dataReferencia</code> | |
399 | + * | |
400 | + * @return <code>Calendar</code> | |
401 | + */ | |
402 | + public Calendar getDataReferencia() { | |
403 | + | |
404 | + return dataReferencia; | |
405 | + } | |
406 | + | |
407 | + /** | |
408 | + * Retorna o valor do atributo <code>codigoAsi</code> | |
409 | + * | |
410 | + * @return <code>String</code> | |
411 | + */ | |
412 | + public String getCodigoAsi() { | |
413 | + | |
414 | + return codigoAsi; | |
415 | + } | |
416 | + | |
417 | + /** | |
418 | + * Define o valor do atributo <code>codigoAsi</code>. | |
419 | + * | |
420 | + * @param codigoAsi | |
421 | + */ | |
422 | + public void setCodigoAsi(String codigoAsi) { | |
423 | + | |
424 | + this.codigoAsi = codigoAsi; | |
425 | + } | |
426 | + | |
427 | + /** | |
428 | + * Define o valor do atributo <code>dataReferencia</code>. | |
429 | + * | |
430 | + * @param dataReferencia | |
431 | + */ | |
432 | + public void setDataReferencia(Calendar dataReferencia) { | |
433 | + | |
434 | + this.dataReferencia = dataReferencia; | |
435 | + } | |
436 | + | |
437 | + /** | |
438 | + * Define o valor do atributo <code>isEntradaConcluida</code>. | |
439 | + * | |
440 | + * @param isEntradaConcluida | |
441 | + */ | |
442 | + public void setIsEntradaConcluida(Boolean isEntradaConcluida) { | |
443 | + | |
444 | + this.isEntradaConcluida = isEntradaConcluida; | |
445 | + } | |
446 | + | |
447 | + /** | |
448 | + * Retorna o valor do atributo <code>isEntradaConcluida</code> | |
449 | + * | |
450 | + * @return <code>IsEntradaConcluida</code> | |
451 | + */ | |
452 | + public Boolean getIsEntradaConcluida() { | |
453 | + | |
454 | + return isEntradaConcluida; | |
455 | + } | |
456 | + | |
457 | + /** | |
458 | + * Define o valor do atributo <code>isContabilizada</code>. | |
459 | + * | |
460 | + * @param isContabilizada | |
461 | + */ | |
462 | + public void setIsContabilizada(Boolean isContabilizada) { | |
463 | + | |
464 | + this.isContabilizada = isContabilizada; | |
465 | + } | |
466 | + | |
467 | + /** | |
468 | + * Retorna o valor do atributo <code>isContabilizada</code> | |
469 | + * | |
470 | + * @return <code>IsContabilizada</code> | |
471 | + */ | |
472 | + public Boolean getIsContabilizada() { | |
473 | + | |
474 | + return isContabilizada; | |
475 | + } | |
476 | + | |
477 | + /** | |
478 | + * {@inheritDoc} | |
479 | + */ | |
480 | + @Override | |
481 | + public EntradaAlmoxarifado clone() { | |
482 | + | |
483 | + try { | |
484 | + | |
485 | + return (EntradaAlmoxarifado) super.clone(); | |
486 | + | |
487 | + } catch (CloneNotSupportedException ex) { | |
488 | + | |
489 | + return this; | |
490 | + } | |
491 | + } | |
492 | + | |
493 | + /** | |
83 | 494 | * Retorna o valor do atributo <code>almoxarifado</code> |
84 | 495 | * |
85 | 496 | * @return <code>EstruturaOrganizacional</code> |
... | ... | @@ -124,9 +535,9 @@ public class EntradaAlmoxarifado extends Entrada { |
124 | 535 | * |
125 | 536 | * @return <code>Collection<EntradaItemAlmoxarifado></code> |
126 | 537 | */ |
127 | - public Collection<EntradaAlmoxarifadoItem> getEntradasIten() { | |
538 | + public Collection<EntradaAlmoxarifadoItem> getEntradasItem() { | |
128 | 539 | |
129 | - return entradasIten; | |
540 | + return entradasItem; | |
130 | 541 | } |
131 | 542 | |
132 | 543 | /** |
... | ... | @@ -134,9 +545,9 @@ public class EntradaAlmoxarifado extends Entrada { |
134 | 545 | * |
135 | 546 | * @param entradasIten |
136 | 547 | */ |
137 | - public void setEntradasIten(Collection<EntradaAlmoxarifadoItem> entradasIten) { | |
548 | + public void setEntradasItem(Collection<EntradaAlmoxarifadoItem> entradasItem) { | |
138 | 549 | |
139 | - this.entradasIten = entradasIten; | |
550 | + this.entradasItem = entradasItem; | |
140 | 551 | } |
141 | 552 | |
142 | 553 | public Dominio getDominioFinalidade() { | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifadoDocumento.java
0 → 100644
... | ... | @@ -0,0 +1,89 @@ |
1 | +package br.com.centralit.api.model; | |
2 | + | |
3 | +import javax.persistence.Entity; | |
4 | +import javax.persistence.FetchType; | |
5 | +import javax.persistence.ManyToOne; | |
6 | +import javax.persistence.Table; | |
7 | + | |
8 | +import org.hibernate.envers.Audited; | |
9 | + | |
10 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
11 | + | |
12 | +/** | |
13 | + * | |
14 | + * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | |
15 | + * | |
16 | + * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | |
17 | + * | |
18 | + * <p><b>Title: </b></p> | |
19 | + * | |
20 | + * <p><b>Description: </b></p> | |
21 | + * | |
22 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
23 | + * | |
24 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
25 | + * | |
26 | + * @since 27/04/2016 - 17:31:20 | |
27 | + * | |
28 | + * @version 1.0.0 | |
29 | + * | |
30 | + * @author geovane.filho | |
31 | + * | |
32 | + */ | |
33 | +@Audited | |
34 | +@Entity | |
35 | +@Table(name = "alm_en_documento") | |
36 | +@JsonIgnoreProperties({ "uploadsDocumento", "$uuid", "$checked", "$index", "size", "name", "$error" }) | |
37 | +public class EntradaAlmoxarifadoDocumento extends Documento { | |
38 | + | |
39 | + /** Atributo serialVersionUID. */ | |
40 | + private static final long serialVersionUID = 4810063162923776584L; | |
41 | + | |
42 | + /** Atributo entrada. */ | |
43 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
44 | + private EntradaAlmoxarifado entrada; | |
45 | + | |
46 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
47 | + private EntradaAlmoxarifado entradaInativo; | |
48 | + | |
49 | + /** | |
50 | + * Retorna o valor do atributo <code>entrada</code> | |
51 | + * | |
52 | + * @return <code>Entrada</code> | |
53 | + */ | |
54 | + public EntradaAlmoxarifado getEntrada() { | |
55 | + | |
56 | + return entrada; | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * Define o valor do atributo <code>entrada</code>. | |
61 | + * | |
62 | + * @param entrada | |
63 | + */ | |
64 | + public void setEntrada(EntradaAlmoxarifado entrada) { | |
65 | + | |
66 | + this.entrada = entrada; | |
67 | + } | |
68 | + | |
69 | + /** | |
70 | + * Retorna o valor do atributo <code>entradaInativo</code> | |
71 | + * | |
72 | + * @return <code>Entrada</code> | |
73 | + */ | |
74 | + public EntradaAlmoxarifado getEntradaInativo() { | |
75 | + | |
76 | + return entradaInativo; | |
77 | + } | |
78 | + | |
79 | + /** | |
80 | + * Define o valor do atributo <code>entradaInativo</code>. | |
81 | + * | |
82 | + * @param entradaInativo | |
83 | + */ | |
84 | + public void setEntradaInativo(EntradaAlmoxarifado entradaInativo) { | |
85 | + | |
86 | + this.entradaInativo = entradaInativo; | |
87 | + } | |
88 | + | |
89 | +} | ... | ... |
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 | |
... | ... | @@ -88,29 +90,22 @@ public class EntradaAlmoxarifadoItem extends PersistentObjectAudit { |
88 | 90 | @ManyToOne(fetch = FetchType.LAZY, optional = false) |
89 | 91 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
90 | 92 | private MaterialConsumo material; |
91 | - | |
92 | - /** Atributo quantidade. */ | |
93 | + | |
94 | + /** Atributo material. */ | |
95 | + @AuditJoinTable | |
96 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
93 | 97 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
94 | - private BigDecimal quantidade; | |
98 | + private MaterialLocalEstoque materialLocalEstoque; | |
95 | 99 | |
96 | 100 | /** Atributo quantidade. */ |
97 | 101 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
98 | - private BigDecimal quantidadeSaldo; | |
99 | - | |
100 | - /** Atributo quantidadeDominioTipoUnidadeEntrada. >>> Fator de conversão da unidade */ | |
101 | - @Column(name = "quantidadetipounidadeentrada") | |
102 | - @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) | |
103 | - private BigDecimal quantidadeDominioTipoUnidadeEntrada; | |
102 | + private BigDecimal quantidade; | |
104 | 103 | |
105 | 104 | /** Atributo valorUnitario. */ |
106 | 105 | @Column(precision = 20, scale = 4) |
107 | 106 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
108 | 107 | private BigDecimal valorUnitario; |
109 | 108 | |
110 | - /** Atributo valorSobra. */ | |
111 | - @Column(precision = 20, scale = 4) | |
112 | - private BigDecimal valorSobra; | |
113 | - | |
114 | 109 | /** Atributo valorTotal. */ |
115 | 110 | @Column(precision = 20, scale = 4) |
116 | 111 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
... | ... | @@ -157,65 +152,46 @@ public class EntradaAlmoxarifadoItem extends PersistentObjectAudit { |
157 | 152 | this.id = id; |
158 | 153 | } |
159 | 154 | |
155 | + | |
160 | 156 | /** |
161 | - * Retorna o valor do atributo <code>dataValidade</code> | |
157 | + * Retorna o valor do atributo <code>materialLocalEstoque</code> | |
162 | 158 | * |
163 | - * @return <code>Calendar</code> | |
159 | + * @return <code>MaterialLocalEstoque</code> | |
164 | 160 | */ |
165 | - public Calendar getDataValidade() { | |
166 | - | |
167 | - return dataValidade; | |
168 | - } | |
169 | - | |
170 | - /** | |
171 | - * Define o valor do atributo <code>dataValidade</code>. | |
172 | - * | |
173 | - * @param dataValidade | |
174 | - */ | |
175 | - public void setDataValidade(Calendar dataValidade) { | |
176 | - | |
177 | - this.dataValidade = dataValidade; | |
161 | + public MaterialLocalEstoque getMaterialLocalEstoque() { | |
162 | + | |
163 | + return materialLocalEstoque; | |
178 | 164 | } |
179 | 165 | |
166 | + | |
180 | 167 | /** |
181 | - * Retorna o valor do atributo <code>quantidadeDominioTipoUnidadeEntrada</code> | |
168 | + * Define o valor do atributo <code>materialLocalEstoque</code>. | |
182 | 169 | * |
183 | - * @return <code>BigDecimal</code> | |
170 | + * @param materialLocalEstoque | |
184 | 171 | */ |
185 | - public BigDecimal getQuantidadeDominioTipoUnidadeEntrada() { | |
186 | - | |
187 | - return quantidadeDominioTipoUnidadeEntrada; | |
172 | + public void setMaterialLocalEstoque(MaterialLocalEstoque materialLocalEstoque) { | |
173 | + | |
174 | + this.materialLocalEstoque = materialLocalEstoque; | |
188 | 175 | } |
189 | 176 | |
190 | 177 | /** |
191 | - * Define o valor do atributo <code>quantidadeDominioTipoUnidadeEntrada</code>. | |
192 | - * | |
193 | - * @param quantidadeDominioTipoUnidadeEntrada | |
194 | - */ | |
195 | - public void setQuantidadeDominioTipoUnidadeEntrada(BigDecimal quantidadeDominioTipoUnidadeEntrada) { | |
196 | - | |
197 | - this.quantidadeDominioTipoUnidadeEntrada = quantidadeDominioTipoUnidadeEntrada; | |
198 | - } | |
199 | - | |
200 | - /** | |
201 | - * Retorna o valor do atributo <code>valorSobra</code> | |
178 | + * Retorna o valor do atributo <code>dataValidade</code> | |
202 | 179 | * |
203 | - * @return <code>BigDecimal</code> | |
180 | + * @return <code>Calendar</code> | |
204 | 181 | */ |
205 | - public BigDecimal getValorSobra() { | |
206 | - | |
207 | - return valorSobra == null ? BigDecimal.ZERO : valorSobra; | |
182 | + public Calendar getDataValidade() { | |
208 | 183 | |
184 | + return dataValidade; | |
209 | 185 | } |
210 | 186 | |
211 | 187 | /** |
212 | - * Define o valor do atributo <code>valorSobra</code>. | |
188 | + * Define o valor do atributo <code>dataValidade</code>. | |
213 | 189 | * |
214 | - * @param valorSobra | |
190 | + * @param dataValidade | |
215 | 191 | */ |
216 | - public void setValorSobra(BigDecimal valorSobra) { | |
192 | + public void setDataValidade(Calendar dataValidade) { | |
217 | 193 | |
218 | - this.valorSobra = valorSobra; | |
194 | + this.dataValidade = dataValidade; | |
219 | 195 | } |
220 | 196 | |
221 | 197 | /** |
... | ... | @@ -359,26 +335,6 @@ public class EntradaAlmoxarifadoItem extends PersistentObjectAudit { |
359 | 335 | } |
360 | 336 | |
361 | 337 | /** |
362 | - * Retorna o valor do atributo <code>quantidadeSaldo</code> | |
363 | - * | |
364 | - * @return <code>BigDecimal</code> | |
365 | - */ | |
366 | - public BigDecimal getQuantidadeSaldo() { | |
367 | - | |
368 | - return quantidadeSaldo == null ? BigDecimal.ZERO : quantidadeSaldo; | |
369 | - } | |
370 | - | |
371 | - /** | |
372 | - * Define o valor do atributo <code>quantidadeSaldo</code>. | |
373 | - * | |
374 | - * @param quantidadeSaldo | |
375 | - */ | |
376 | - public void setQuantidadeSaldo(BigDecimal quantidadeSaldo) { | |
377 | - | |
378 | - this.quantidadeSaldo = quantidadeSaldo; | |
379 | - } | |
380 | - | |
381 | - /** | |
382 | 338 | * Retorna o valor do atributo <code>entradaInativo</code> |
383 | 339 | * |
384 | 340 | * @return <code>EntradaAlmoxarifado</code> | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifadoObservacao.java
0 → 100644
... | ... | @@ -0,0 +1,60 @@ |
1 | +package br.com.centralit.api.model; | |
2 | + | |
3 | +import javax.persistence.Entity; | |
4 | +import javax.persistence.FetchType; | |
5 | +import javax.persistence.ManyToOne; | |
6 | +import javax.persistence.Table; | |
7 | + | |
8 | +/** | |
9 | + * | |
10 | + * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | |
11 | + * | |
12 | + * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | |
13 | + * | |
14 | + * <p><b>Title: </b></p> | |
15 | + * | |
16 | + * <p><b>Description: </b></p> | |
17 | + * | |
18 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
19 | + * | |
20 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
21 | + * | |
22 | + * @since 27/04/2016 - 17:31:26 | |
23 | + * | |
24 | + * @version 1.0.0 | |
25 | + * | |
26 | + * @author geovane.filho | |
27 | + * | |
28 | + */ | |
29 | +@Entity | |
30 | +@Table(name = "alm_en_observacao") | |
31 | +public class EntradaAlmoxarifadoObservacao extends Observacao { | |
32 | + | |
33 | + /** Atributo serialVersionUID. */ | |
34 | + private static final long serialVersionUID = 78579413846779181L; | |
35 | + | |
36 | + /** Atributo entrada. */ | |
37 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
38 | + private EntradaAlmoxarifado entrada; | |
39 | + | |
40 | + /** | |
41 | + * Retorna o valor do atributo <code>entrada</code> | |
42 | + * | |
43 | + * @return <code>Entrada</code> | |
44 | + */ | |
45 | + public EntradaAlmoxarifado getEntrada() { | |
46 | + | |
47 | + return entrada; | |
48 | + } | |
49 | + | |
50 | + /** | |
51 | + * Define o valor do atributo <code>entrada</code>. | |
52 | + * | |
53 | + * @param entrada | |
54 | + */ | |
55 | + public void setEntrada(EntradaAlmoxarifado entrada) { | |
56 | + | |
57 | + this.entrada = entrada; | |
58 | + } | |
59 | + | |
60 | +} | ... | ... |
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; |
... | ... | @@ -52,6 +54,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
52 | 54 | * @author geovane.filho |
53 | 55 | * |
54 | 56 | */ |
57 | +@Audited | |
55 | 58 | @Entity |
56 | 59 | @Table(name = "alm_estoque") |
57 | 60 | public class Estoque extends PersistentObjectAuditOrganizacao { |
... | ... | @@ -68,7 +71,7 @@ public class Estoque extends PersistentObjectAuditOrganizacao { |
68 | 71 | /** Atributo almoxarifado. */ |
69 | 72 | @OneToOne(fetch = FetchType.LAZY, optional = false) |
70 | 73 | @JsonView({ ViewsAdmMateriais.LocalEstoqueAutoCompleteView.class, |
71 | - ViewsAlmoxarifado.ConfiguracaoRessuprimentoEditView.class, Views.MaterialConsultaInfo.class, ViewsAdmMateriais.EnderecoEstoqueView.class }) | |
74 | + ViewsAlmoxarifado.ConfiguracaoRessuprimentoEditView.class, Views.MaterialConsultaInfo.class }) | |
72 | 75 | private EstruturaOrganizacional almoxarifado; |
73 | 76 | |
74 | 77 | /** Atributo locais. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EstruturaOrganizacionalAlmoxarifado.java
... | ... | @@ -49,7 +49,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
49 | 49 | * |
50 | 50 | */ |
51 | 51 | @Entity |
52 | -@Table(name = "EstruturaOrganizacionalAlmox") | |
52 | +@Table(name="alm_eo_almoxarifado") | |
53 | 53 | public class EstruturaOrganizacionalAlmoxarifado extends PersistentObjectAudit implements Comparable<EstruturaOrganizacionalAlmoxarifado>, Cloneable { |
54 | 54 | |
55 | 55 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/LocalEstoque.java
... | ... | @@ -1,134 +0,0 @@ |
1 | -package br.com.centralit.api.model; | |
2 | - | |
3 | -import java.util.Collection; | |
4 | - | |
5 | -import javax.persistence.CascadeType; | |
6 | -import javax.persistence.Entity; | |
7 | -import javax.persistence.FetchType; | |
8 | -import javax.persistence.GeneratedValue; | |
9 | -import javax.persistence.GenerationType; | |
10 | -import javax.persistence.Id; | |
11 | -import javax.persistence.OneToMany; | |
12 | -import javax.persistence.OneToOne; | |
13 | - | |
14 | -import br.com.centralit.api.framework.json.ViewsAdmMateriais; | |
15 | -import br.com.centralit.api.framework.json.ViewsAlmoxarifado; | |
16 | -import br.com.centralit.framework.json.Views; | |
17 | -import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
18 | - | |
19 | -import com.fasterxml.jackson.annotation.JsonView; | |
20 | - | |
21 | -/** | |
22 | - * <p> | |
23 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
24 | - * </p> | |
25 | - * | |
26 | - * <p> | |
27 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
28 | - * </p> | |
29 | - * | |
30 | - * <p> | |
31 | - * <b>Title: </b> | |
32 | - * </p> | |
33 | - * | |
34 | - * <p> | |
35 | - * <b>Description: </b> | |
36 | - * </p> | |
37 | - * | |
38 | - * <p> | |
39 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
40 | - * </p> | |
41 | - * | |
42 | - * <p> | |
43 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
44 | - * </p> | |
45 | - * | |
46 | - * @since 21/05/2015 - 10:10:16 | |
47 | - * | |
48 | - * @version 1.0.0 | |
49 | - * | |
50 | - * @author rogerio.costa | |
51 | - * | |
52 | - */ | |
53 | -@Entity | |
54 | -public class LocalEstoque extends PersistentObjectAuditOrganizacao { | |
55 | - | |
56 | - /** Atributo serialVersionUID. */ | |
57 | - private static final long serialVersionUID = 583158275027529648L; | |
58 | - | |
59 | - /** Atributo id. */ | |
60 | - @Id | |
61 | - @GeneratedValue(strategy = GenerationType.AUTO) | |
62 | - @JsonView({ Views.GenericView.class }) | |
63 | - private Long id; | |
64 | - | |
65 | - /** Atributo almoxarifado. */ | |
66 | - @OneToOne(fetch = FetchType.LAZY, optional = false) | |
67 | - @JsonView({ ViewsAdmMateriais.LocalEstoqueAutoCompleteView.class, ViewsAlmoxarifado.ConfiguracaoRessuprimentoEditView.class, Views.MaterialConsultaInfo.class}) | |
68 | - private EstruturaOrganizacional almoxarifado; | |
69 | - | |
70 | - /** Atributo historicoSaldo. */ | |
71 | - @OneToMany(fetch = FetchType.LAZY, mappedBy = "localEstoque", cascade = CascadeType.ALL) | |
72 | - private Collection<MaterialEstoqueSaldo> historicoSaldo; | |
73 | - | |
74 | - /** | |
75 | - * Retorna o valor do atributo <code>id</code> | |
76 | - * | |
77 | - * @return <code>Long</code> | |
78 | - */ | |
79 | - public Long getId() { | |
80 | - | |
81 | - return id; | |
82 | - } | |
83 | - | |
84 | - /** | |
85 | - * Define o valor do atributo <code>id</code>. | |
86 | - * | |
87 | - * @param id | |
88 | - */ | |
89 | - public void setId(Long id) { | |
90 | - | |
91 | - this.id = id; | |
92 | - } | |
93 | - | |
94 | - /** | |
95 | - * Retorna o valor do atributo <code>almoxarifado</code> | |
96 | - * | |
97 | - * @return <code>EstruturaOrganizacional</code> | |
98 | - */ | |
99 | - public EstruturaOrganizacional getAlmoxarifado() { | |
100 | - | |
101 | - return almoxarifado; | |
102 | - } | |
103 | - | |
104 | - /** | |
105 | - * Define o valor do atributo <code>almoxarifado</code>. | |
106 | - * | |
107 | - * @param almoxarifado | |
108 | - */ | |
109 | - public void setAlmoxarifado(EstruturaOrganizacional almoxarifado) { | |
110 | - | |
111 | - this.almoxarifado = almoxarifado; | |
112 | - } | |
113 | - | |
114 | - /** | |
115 | - * Retorna o valor do atributo <code>historicoSaldo</code> | |
116 | - * | |
117 | - * @return <code>Collection<LocalEstoqueSaldo></code> | |
118 | - */ | |
119 | - public Collection<MaterialEstoqueSaldo> getHistoricoSaldo() { | |
120 | - | |
121 | - return historicoSaldo; | |
122 | - } | |
123 | - | |
124 | - /** | |
125 | - * Define o valor do atributo <code>historicoSaldo</code>. | |
126 | - * | |
127 | - * @param historicoSaldo | |
128 | - */ | |
129 | - public void setHistoricoSaldo(Collection<MaterialEstoqueSaldo> historicoSaldo) { | |
130 | - | |
131 | - this.historicoSaldo = historicoSaldo; | |
132 | - } | |
133 | - | |
134 | -} |
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. */ |
... | ... | @@ -87,7 +86,7 @@ public class MaterialEstoqueSaldo extends PersistentObjectAuditOrganizacao { |
87 | 86 | /** Atributo localEstoque. */ |
88 | 87 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
89 | 88 | @JsonView({ Views.MaterialConsultaInfo.class }) |
90 | - private LocalEstoque localEstoque; | |
89 | + private MaterialLocalEstoque localEstoque; | |
91 | 90 | |
92 | 91 | /** Atributo material. */ |
93 | 92 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
... | ... | @@ -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 | * |
... | ... | @@ -153,7 +147,7 @@ public class MaterialEstoqueSaldo extends PersistentObjectAuditOrganizacao { |
153 | 147 | * |
154 | 148 | * @return <code>LocalEstoque</code> |
155 | 149 | */ |
156 | - public LocalEstoque getLocalEstoque() { | |
150 | + public MaterialLocalEstoque getLocalEstoque() { | |
157 | 151 | |
158 | 152 | return localEstoque; |
159 | 153 | } |
... | ... | @@ -163,7 +157,7 @@ public class MaterialEstoqueSaldo extends PersistentObjectAuditOrganizacao { |
163 | 157 | * |
164 | 158 | * @param localEstoque |
165 | 159 | */ |
166 | - public void setLocalEstoque(LocalEstoque localEstoque) { | |
160 | + public void setLocalEstoque(MaterialLocalEstoque localEstoque) { | |
167 | 161 | |
168 | 162 | this.localEstoque = localEstoque; |
169 | 163 | } |
... | ... | @@ -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
... | ... | @@ -1,204 +0,0 @@ |
1 | -package br.com.centralit.api.model; | |
2 | - | |
3 | -import java.math.BigDecimal; | |
4 | - | |
5 | -import javax.persistence.Column; | |
6 | -import javax.persistence.Entity; | |
7 | -import javax.persistence.GeneratedValue; | |
8 | -import javax.persistence.GenerationType; | |
9 | -import javax.persistence.Id; | |
10 | -import javax.persistence.OneToOne; | |
11 | - | |
12 | -import com.fasterxml.jackson.annotation.JsonView; | |
13 | - | |
14 | -import br.com.centralit.api.framework.json.ViewsAdmMateriais; | |
15 | -import br.com.centralit.framework.json.Views; | |
16 | -import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
17 | - | |
18 | -/** | |
19 | - * <p> | |
20 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
21 | - * </p> | |
22 | - * | |
23 | - * <p> | |
24 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
25 | - * </p> | |
26 | - * | |
27 | - * <p> | |
28 | - * <b>Title: Material Estoque Saldo Medio</b> | |
29 | - * </p> | |
30 | - * | |
31 | - * <p> | |
32 | - * <b>Description: Saldo médio de um material em estoque</b> | |
33 | - * </p> | |
34 | - * | |
35 | - * <p> | |
36 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
37 | - * </p> | |
38 | - * | |
39 | - * <p> | |
40 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
41 | - * </p> | |
42 | - * | |
43 | - * @since 22/06/2015 - 16:12:33 | |
44 | - * | |
45 | - * @version 1.0.0 | |
46 | - * | |
47 | - * @author geovane.filho | |
48 | - * | |
49 | - */ | |
50 | -@Entity | |
51 | -public class MaterialEstoqueSaldoMedio extends PersistentObjectAuditOrganizacao { | |
52 | - | |
53 | - private static final long serialVersionUID = -9108177938688790640L; | |
54 | - | |
55 | - /** Atributo id. */ | |
56 | - @Id | |
57 | - @GeneratedValue(strategy = GenerationType.AUTO) | |
58 | - private Long id; | |
59 | - | |
60 | - /** Atributo material. */ | |
61 | - @OneToOne(optional = false) | |
62 | - private Material material; | |
63 | - | |
64 | - /** Atributo quantidade. */ | |
65 | - @Column(precision = 20, scale = 4) | |
66 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
67 | - private BigDecimal quantidadeAtual; | |
68 | - | |
69 | - /** Atributo valorFechado. */ | |
70 | - @Column(precision = 20, scale = 4) | |
71 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
72 | - private BigDecimal valorUnitarioMedio; | |
73 | - | |
74 | - /** Atributo restoMedio. */ | |
75 | - @Column(precision = 20, scale = 4) | |
76 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
77 | - private BigDecimal restoMedio; | |
78 | - | |
79 | - /** | |
80 | - * | |
81 | - * Responsável pela criação de novas instâncias desta classe. | |
82 | - */ | |
83 | - protected MaterialEstoqueSaldoMedio() { | |
84 | - super(); | |
85 | - } | |
86 | - | |
87 | - /** | |
88 | - * | |
89 | - * Responsável pela criação de novas instâncias desta classe com seus atributos obrigatorios. | |
90 | - */ | |
91 | - public MaterialEstoqueSaldoMedio(Material material, BigDecimal quantidadeAtual, BigDecimal valorUnitarioMedio, BigDecimal restoMedio) { | |
92 | - super(); | |
93 | - this.material = material; | |
94 | - this.quantidadeAtual = quantidadeAtual; | |
95 | - this.valorUnitarioMedio = valorUnitarioMedio; | |
96 | - this.restoMedio = restoMedio; | |
97 | - } | |
98 | - | |
99 | - /** | |
100 | - * | |
101 | - * Responsável pela criação de novas instâncias desta classe definindo o material e zerando os atributos de controle de estoque | |
102 | - */ | |
103 | - public MaterialEstoqueSaldoMedio(Material material) { | |
104 | - super(); | |
105 | - this.material = material; | |
106 | - this.quantidadeAtual = BigDecimal.ZERO; | |
107 | - this.valorUnitarioMedio = BigDecimal.ZERO; | |
108 | - this.restoMedio = BigDecimal.ZERO; | |
109 | - } | |
110 | - | |
111 | - /** | |
112 | - * Retorna o valor do atributo <code>material</code> | |
113 | - * | |
114 | - * @return <code>Material</code> | |
115 | - */ | |
116 | - public Material getMaterial() { | |
117 | - return material; | |
118 | - } | |
119 | - | |
120 | - /** | |
121 | - * Define o valor do atributo <code>material</code>. | |
122 | - * | |
123 | - * @param material | |
124 | - */ | |
125 | - public void setMaterial(Material material) { | |
126 | - this.material = material; | |
127 | - } | |
128 | - | |
129 | - /** | |
130 | - * Retorna o valor do atributo <code>quantidadeAtual</code> | |
131 | - * | |
132 | - * @return <code>BigDecimal</code> | |
133 | - */ | |
134 | - public BigDecimal getQuantidadeAtual() { | |
135 | - return quantidadeAtual; | |
136 | - } | |
137 | - | |
138 | - /** | |
139 | - * Define o valor do atributo <code>quantidadeAtual</code>. | |
140 | - * | |
141 | - * @param quantidadeAtual | |
142 | - */ | |
143 | - public void setQuantidadeAtual(BigDecimal quantidadeAtual) { | |
144 | - this.quantidadeAtual = quantidadeAtual; | |
145 | - } | |
146 | - | |
147 | - /** | |
148 | - * Retorna o valor do atributo <code>valorUnitarioMedio</code> | |
149 | - * | |
150 | - * @return <code>BigDecimal</code> | |
151 | - */ | |
152 | - public BigDecimal getValorUnitarioMedio() { | |
153 | - return valorUnitarioMedio; | |
154 | - } | |
155 | - | |
156 | - /** | |
157 | - * Define o valor do atributo <code>valorUnitarioMedio</code>. | |
158 | - * | |
159 | - * @param valorUnitarioMedio | |
160 | - */ | |
161 | - public void setValorUnitarioMedio(BigDecimal valorUnitarioMedio) { | |
162 | - this.valorUnitarioMedio = valorUnitarioMedio; | |
163 | - } | |
164 | - | |
165 | - /** | |
166 | - * Retorna o valor do atributo <code>id</code> | |
167 | - * | |
168 | - * @return <code>Long</code> | |
169 | - */ | |
170 | - @Override | |
171 | - public Long getId() { | |
172 | - | |
173 | - return id; | |
174 | - } | |
175 | - | |
176 | - /** | |
177 | - * Define o valor do atributo <code>id</code>. | |
178 | - * | |
179 | - * @param id | |
180 | - */ | |
181 | - public void setId(Long id) { | |
182 | - | |
183 | - this.id = id; | |
184 | - } | |
185 | - | |
186 | - /** | |
187 | - * Retorna o valor do atributo <code>restoMedio</code> | |
188 | - * | |
189 | - * @return <code>BigDecimal</code> | |
190 | - */ | |
191 | - public BigDecimal getRestoMedio() { | |
192 | - return restoMedio; | |
193 | - } | |
194 | - | |
195 | - /** | |
196 | - * Define o valor do atributo <code>restoMedio</code>. | |
197 | - * | |
198 | - * @param restoMedio | |
199 | - */ | |
200 | - public void setRestoMedio(BigDecimal restoMedio) { | |
201 | - this.restoMedio = restoMedio; | |
202 | - } | |
203 | - | |
204 | -} |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialLocalEstoque.java
... | ... | @@ -11,38 +11,27 @@ import javax.persistence.ManyToOne; |
11 | 11 | import javax.persistence.OneToOne; |
12 | 12 | import javax.persistence.Table; |
13 | 13 | |
14 | -import com.fasterxml.jackson.annotation.JsonView; | |
14 | +import org.hibernate.envers.Audited; | |
15 | 15 | |
16 | -import br.com.centralit.api.framework.json.ViewsAdmMateriais; | |
17 | 16 | import br.com.centralit.framework.json.Views; |
18 | 17 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
19 | 18 | |
19 | +import com.fasterxml.jackson.annotation.JsonView; | |
20 | + | |
20 | 21 | /** |
21 | 22 | * |
22 | - * <p> | |
23 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
24 | - * </p> | |
23 | + * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | |
25 | 24 | * |
26 | - * <p> | |
27 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
28 | - * </p> | |
25 | + * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | |
29 | 26 | * |
30 | - * <p> | |
31 | - * <b>Title: </b> | |
32 | - * </p> | |
27 | + * <p><b>Title: </b></p> | |
33 | 28 | * |
34 | - * <p> | |
35 | - * <b>Description: </b> | |
36 | - * </p> | |
29 | + * <p><b>Description: </b></p> | |
37 | 30 | * |
38 | - * <p> | |
39 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
40 | - * </p> | |
31 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
41 | 32 | * |
42 | - * <p> | |
43 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
44 | - * </p> | |
45 | - * | |
33 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
34 | + * | |
46 | 35 | * @since 29/04/2016 - 09:06:28 |
47 | 36 | * |
48 | 37 | * @version 1.0.0 |
... | ... | @@ -50,6 +39,7 @@ import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganiz |
50 | 39 | * @author geovane.filho |
51 | 40 | * |
52 | 41 | */ |
42 | +@Audited | |
53 | 43 | @Entity |
54 | 44 | @Table(name = "alm_me_localestoque") |
55 | 45 | public class MaterialLocalEstoque extends PersistentObjectAuditOrganizacao { |
... | ... | @@ -62,30 +52,28 @@ public class MaterialLocalEstoque extends PersistentObjectAuditOrganizacao { |
62 | 52 | @GeneratedValue(strategy = GenerationType.AUTO) |
63 | 53 | @JsonView({ Views.GenericView.class }) |
64 | 54 | private Long id; |
65 | - | |
55 | + | |
66 | 56 | /** Atributo materialEstoque. */ |
67 | 57 | @OneToOne(fetch = FetchType.LAZY, optional = false) |
68 | - @JsonView({ ViewsAdmMateriais.EnderecoEstoqueView.class }) | |
69 | 58 | private MaterialEstoque materialEstoque; |
70 | - | |
59 | + | |
71 | 60 | /** Atributo materialEstoqueInativo. */ |
72 | 61 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
73 | 62 | private MaterialEstoque materialEstoqueInativo; |
74 | - | |
63 | + | |
75 | 64 | /** Atributo endereco. */ |
76 | 65 | @OneToOne(fetch = FetchType.LAZY, optional = false) |
77 | 66 | private EnderecoEstoque endereco; |
78 | - | |
67 | + | |
79 | 68 | /** Atributo enderecoInativo. */ |
80 | 69 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
81 | 70 | private EnderecoEstoque enderecoInativo; |
82 | - | |
71 | + | |
83 | 72 | /** Atributo quantidade. */ |
84 | - @JsonView({ ViewsAdmMateriais.EnderecoEstoqueView.class }) | |
85 | 73 | private BigDecimal quantidade; |
86 | - | |
74 | + | |
87 | 75 | /** Atributo unidadeMedidaEntrada. */ |
88 | - @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
76 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
89 | 77 | private UnidadeMedida unidadeMedidaEntrada; |
90 | 78 | |
91 | 79 | /** |
... | ... | @@ -107,44 +95,48 @@ public class MaterialLocalEstoque extends PersistentObjectAuditOrganizacao { |
107 | 95 | |
108 | 96 | this.id = id; |
109 | 97 | } |
110 | - | |
98 | + | |
111 | 99 | /** |
112 | 100 | * Retorna o valor do atributo <code>endereco</code> |
113 | 101 | * |
114 | 102 | * @return <code>EnderecoEstoque</code> |
115 | 103 | */ |
116 | 104 | public EnderecoEstoque getEndereco() { |
117 | - | |
105 | + | |
118 | 106 | return endereco; |
119 | 107 | } |
120 | 108 | |
109 | + | |
121 | 110 | /** |
122 | 111 | * Define o valor do atributo <code>endereco</code>. |
123 | 112 | * |
124 | - * @param endereco | |
113 | + * @param endereco | |
125 | 114 | */ |
126 | 115 | public void setEndereco(EnderecoEstoque endereco) { |
127 | - | |
116 | + | |
128 | 117 | this.endereco = endereco; |
129 | 118 | } |
130 | 119 | |
120 | + | |
121 | + | |
131 | 122 | /** |
132 | 123 | * Retorna o valor do atributo <code>enderecoInativo</code> |
133 | 124 | * |
134 | 125 | * @return <code>EnderecoEstoque</code> |
135 | 126 | */ |
136 | 127 | public EnderecoEstoque getEnderecoInativo() { |
137 | - | |
128 | + | |
138 | 129 | return enderecoInativo; |
139 | 130 | } |
140 | 131 | |
132 | + | |
141 | 133 | /** |
142 | 134 | * Define o valor do atributo <code>enderecoInativo</code>. |
143 | 135 | * |
144 | - * @param enderecoInativo | |
136 | + * @param enderecoInativo | |
145 | 137 | */ |
146 | 138 | public void setEnderecoInativo(EnderecoEstoque enderecoInativo) { |
147 | - | |
139 | + | |
148 | 140 | this.enderecoInativo = enderecoInativo; |
149 | 141 | } |
150 | 142 | |
... | ... | @@ -154,77 +146,84 @@ public class MaterialLocalEstoque extends PersistentObjectAuditOrganizacao { |
154 | 146 | * @return <code>BigDecimal</code> |
155 | 147 | */ |
156 | 148 | public BigDecimal getQuantidade() { |
157 | - | |
149 | + | |
158 | 150 | return quantidade; |
159 | 151 | } |
160 | 152 | |
153 | + | |
161 | 154 | /** |
162 | 155 | * Define o valor do atributo <code>quantidade</code>. |
163 | 156 | * |
164 | - * @param quantidade | |
157 | + * @param quantidade | |
165 | 158 | */ |
166 | 159 | public void setQuantidade(BigDecimal quantidade) { |
167 | - | |
160 | + | |
168 | 161 | this.quantidade = quantidade; |
169 | 162 | } |
170 | 163 | |
164 | + | |
171 | 165 | /** |
172 | 166 | * Retorna o valor do atributo <code>unidadeMedidaEntrada</code> |
173 | 167 | * |
174 | 168 | * @return <code>UnidadeMedida</code> |
175 | 169 | */ |
176 | 170 | public UnidadeMedida getUnidadeMedidaEntrada() { |
177 | - | |
171 | + | |
178 | 172 | return unidadeMedidaEntrada; |
179 | 173 | } |
180 | 174 | |
175 | + | |
181 | 176 | /** |
182 | 177 | * Define o valor do atributo <code>unidadeMedidaEntrada</code>. |
183 | 178 | * |
184 | - * @param unidadeMedidaEntrada | |
179 | + * @param unidadeMedidaEntrada | |
185 | 180 | */ |
186 | 181 | public void setUnidadeMedidaEntrada(UnidadeMedida unidadeMedidaEntrada) { |
187 | - | |
182 | + | |
188 | 183 | this.unidadeMedidaEntrada = unidadeMedidaEntrada; |
189 | 184 | } |
190 | 185 | |
186 | + | |
191 | 187 | /** |
192 | 188 | * Retorna o valor do atributo <code>materialEstoque</code> |
193 | 189 | * |
194 | 190 | * @return <code>MaterialEstoque</code> |
195 | 191 | */ |
196 | 192 | public MaterialEstoque getMaterialEstoque() { |
197 | - | |
193 | + | |
198 | 194 | return materialEstoque; |
199 | 195 | } |
200 | 196 | |
197 | + | |
201 | 198 | /** |
202 | 199 | * Define o valor do atributo <code>materialEstoque</code>. |
203 | 200 | * |
204 | - * @param materialEstoque | |
201 | + * @param materialEstoque | |
205 | 202 | */ |
206 | 203 | public void setMaterialEstoque(MaterialEstoque materialEstoque) { |
207 | - | |
204 | + | |
208 | 205 | this.materialEstoque = materialEstoque; |
209 | 206 | } |
210 | 207 | |
208 | + | |
211 | 209 | /** |
212 | 210 | * Retorna o valor do atributo <code>materialEstoqueInativo</code> |
213 | 211 | * |
214 | 212 | * @return <code>MaterialEstoque</code> |
215 | 213 | */ |
216 | 214 | public MaterialEstoque getMaterialEstoqueInativo() { |
217 | - | |
215 | + | |
218 | 216 | return materialEstoqueInativo; |
219 | 217 | } |
220 | 218 | |
219 | + | |
221 | 220 | /** |
222 | 221 | * Define o valor do atributo <code>materialEstoqueInativo</code>. |
223 | 222 | * |
224 | - * @param materialEstoqueInativo | |
223 | + * @param materialEstoqueInativo | |
225 | 224 | */ |
226 | 225 | public void setMaterialEstoqueInativo(MaterialEstoque materialEstoqueInativo) { |
227 | - | |
226 | + | |
228 | 227 | this.materialEstoqueInativo = materialEstoqueInativo; |
229 | 228 | } |
230 | 229 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MovimentoEstoque.java
... | ... | @@ -9,11 +9,13 @@ import javax.persistence.FetchType; |
9 | 9 | import javax.persistence.GeneratedValue; |
10 | 10 | import javax.persistence.GenerationType; |
11 | 11 | import javax.persistence.Id; |
12 | -import javax.persistence.JoinColumn; | |
13 | 12 | import javax.persistence.ManyToOne; |
13 | +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; |
... | ... | @@ -25,38 +27,29 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
25 | 27 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
26 | 28 | |
27 | 29 | /** |
28 | - * <p> | |
29 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
30 | - * </p> | |
31 | - * | |
32 | - * <p> | |
33 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
34 | - * </p> | |
30 | + * | |
31 | + * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | |
35 | 32 | * |
36 | - * <p> | |
37 | - * <b>Title: </b> | |
38 | - * </p> | |
33 | + * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | |
39 | 34 | * |
40 | - * <p> | |
41 | - * <b>Description: </b> | |
42 | - * </p> | |
35 | + * <p><b>Title: </b></p> | |
43 | 36 | * |
44 | - * <p> | |
45 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
46 | - * </p> | |
37 | + * <p><b>Description: </b></p> | |
38 | + * | |
39 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
47 | 40 | * |
48 | - * <p> | |
49 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
50 | - * </p> | |
51 | - * | |
52 | - * @since 21/05/2015 - 09:56:41 | |
41 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
42 | + * | |
43 | + * @since 29/04/2016 - 16:22:59 | |
53 | 44 | * |
54 | 45 | * @version 1.0.0 |
55 | 46 | * |
56 | - * @author rogerio.costa | |
47 | + * @author geovane.filho | |
57 | 48 | * |
58 | 49 | */ |
50 | +@Audited | |
59 | 51 | @Entity |
52 | +@Table(name = "alm_me_movimentoestoque") | |
60 | 53 | public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
61 | 54 | |
62 | 55 | /** Atributo serialVersionUID. */ |
... | ... | @@ -66,73 +59,51 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
66 | 59 | @Id |
67 | 60 | @GeneratedValue(strategy = GenerationType.AUTO) |
68 | 61 | private Long id; |
69 | - | |
62 | + | |
63 | + /** Atributo material. */ | |
64 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
65 | + @JsonView({ Views.MaterialConsultaInfo.class }) | |
66 | + private MaterialConsumo material; | |
67 | + | |
68 | + /** Atributo materialEstoque. */ | |
69 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
70 | + private MaterialEstoque materialEstoque; | |
71 | + | |
72 | + /** Atributo materialLocalEstoque. */ | |
73 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
74 | + private MaterialLocalEstoque materialLocalEstoque; | |
75 | + | |
70 | 76 | /** Atributo dataMovimento. */ |
71 | - @Column(name = "dataMovimento", nullable = true) | |
77 | + @Column(name = "dataMovimento", nullable = false) | |
72 | 78 | @Temporal(TemporalType.TIMESTAMP) |
73 | 79 | @JsonSerialize(using = JsonCalendarSimpleDateSerializer.class) |
74 | 80 | @JsonDeserialize(using = JsonCalendarSimpleDateDeserializer.class) |
75 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
76 | 81 | private Calendar dataMovimento; |
77 | - | |
82 | + | |
78 | 83 | /** Atributo quantidade. */ |
79 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
80 | 84 | private BigDecimal quantidade; |
81 | 85 | |
82 | 86 | /** Atributo valor. */ |
83 | 87 | @Column(precision = 20, scale = 4) |
84 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
85 | 88 | private BigDecimal valorFIFO; |
86 | 89 | |
87 | 90 | /** Atributo valor. */ |
88 | 91 | @Column(precision = 20, scale = 4) |
89 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
90 | 92 | private BigDecimal valorMedia; |
91 | 93 | |
92 | 94 | /** Atributo tipoMovimento. */ |
93 | 95 | @ManyToOne(fetch = FetchType.LAZY, optional = false) |
94 | 96 | @JsonView({ Views.MaterialConsultaInfo.class }) |
95 | 97 | private Dominio tipoMovimento; |
96 | - | |
97 | - /** Atributo localEstoque. */ | |
98 | - @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
99 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
100 | - private LocalEstoque localEstoque; | |
101 | - | |
102 | - /** Atributo material. */ | |
103 | - @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
104 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
105 | - private Material material; | |
106 | - | |
98 | + | |
99 | + /** Atributo dominioClasseReferencia. */ | |
107 | 100 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
108 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
109 | - private MaterialEstoqueSaldo materialEstoqueSaldo; | |
101 | + private Dominio dominioClasseReferencia; | |
110 | 102 | |
111 | - /** Atributo baixaAlmoxarifado. */ | |
112 | - @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
113 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
114 | - private BaixaAlmoxarifadoItem baixaAlmoxarifadoItem; | |
115 | - | |
116 | - /** Atributo devolucao. */ | |
117 | - @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
118 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
119 | - private DevolucaoItem devolucaoItem; | |
120 | - | |
121 | - /** Atributo entrada. */ | |
122 | - @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
123 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
124 | - private EntradaAlmoxarifadoItem entradaAlmoxarifadoItem; | |
125 | - | |
126 | - /** Atributo requisicao. */ | |
127 | - @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
128 | - @JoinColumn(name = "atendimentoreqconsumoitem_id") | |
129 | - @JsonView({ Views.MaterialConsultaInfo.class }) | |
130 | - private AtendimentoRequisicaoConsumoItem atendimentoRequisicaoConsumoItem; | |
131 | - | |
132 | - /** Atributo materialEstoque. */ | |
133 | - @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
134 | - private MaterialEstoque materialEstoque; | |
103 | + @Column() | |
104 | + private Long idClasseReferencia; | |
135 | 105 | |
106 | + | |
136 | 107 | /** |
137 | 108 | * Responsável pela criação de novas instâncias desta classe. |
138 | 109 | */ |
... | ... | @@ -150,8 +121,7 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
150 | 121 | * @param valorMedia |
151 | 122 | * @param tipoMovimento |
152 | 123 | */ |
153 | - public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, | |
154 | - Dominio tipoMovimento) { | |
124 | + public MovimentoEstoque( Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, Dominio tipoMovimento ) { | |
155 | 125 | |
156 | 126 | super(); |
157 | 127 | this.dataMovimento = dataMovimento; |
... | ... | @@ -169,41 +139,42 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
169 | 139 | * @param valorFIFO |
170 | 140 | * @param valorMedia |
171 | 141 | * @param tipoMovimento |
172 | - * @param localEstoque | |
142 | + * @param materialEstoque | |
173 | 143 | * @param material |
174 | 144 | */ |
175 | - public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, | |
176 | - Dominio tipoMovimento, LocalEstoque localEstoque, Material material) { | |
145 | + public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, Dominio tipoMovimento, MaterialEstoque materialEstoque, | |
146 | + MaterialConsumo material) { | |
177 | 147 | |
178 | 148 | this(dataMovimento, quantidade, valorFIFO, valorMedia, tipoMovimento); |
179 | - this.localEstoque = localEstoque; | |
149 | + this.materialEstoque = materialEstoque; | |
180 | 150 | this.material = material; |
181 | 151 | } |
182 | 152 | |
183 | 153 | /** |
154 | + * | |
184 | 155 | * Responsável pela criação de novas instâncias desta classe. |
185 | - * | |
186 | 156 | * @param dataMovimento |
187 | 157 | * @param quantidade |
188 | 158 | * @param valorFIFO |
189 | 159 | * @param valorMedia |
190 | 160 | * @param tipoMovimento |
191 | - * @param baixaAlmoxarifadoItem | |
161 | + * @param classeReferencia | |
162 | + * @param idClasseReferencia | |
163 | + * @param materialEstoque | |
164 | + * @param material | |
192 | 165 | */ |
193 | - public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, | |
194 | - Dominio tipoMovimento, BaixaAlmoxarifadoItem baixaAlmoxarifadoItem, LocalEstoque localEstoque, | |
195 | - Material material, EntradaAlmoxarifadoItem entradaAlmoxarifadoItem) { | |
166 | + public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, Dominio tipoMovimento, Dominio classeReferencia, Long idClasseReferencia, | |
167 | + MaterialEstoque materialEstoque, MaterialConsumo material) { | |
196 | 168 | |
197 | 169 | this.dataMovimento = dataMovimento; |
198 | 170 | this.quantidade = quantidade; |
199 | 171 | this.valorFIFO = valorFIFO; |
200 | 172 | this.valorMedia = valorMedia; |
201 | 173 | this.tipoMovimento = tipoMovimento; |
202 | - this.baixaAlmoxarifadoItem = baixaAlmoxarifadoItem; | |
203 | - this.localEstoque = localEstoque; | |
174 | + this.materialEstoque = materialEstoque; | |
204 | 175 | this.material = material; |
205 | - this.entradaAlmoxarifadoItem = entradaAlmoxarifadoItem; | |
206 | - | |
176 | + this.dominioClasseReferencia = classeReferencia; | |
177 | + this.idClasseReferencia = idClasseReferencia; | |
207 | 178 | } |
208 | 179 | |
209 | 180 | /** |
... | ... | @@ -267,51 +238,11 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
267 | 238 | } |
268 | 239 | |
269 | 240 | /** |
270 | - * Retorna o valor do atributo <code>atendimentoRequisicaoConsumoItem</code> | |
271 | - * | |
272 | - * @return <code>AtendimentoRequisicaoConsumoItem</code> | |
273 | - */ | |
274 | - public AtendimentoRequisicaoConsumoItem getAtendimentoRequisicaoConsumoItem() { | |
275 | - | |
276 | - return atendimentoRequisicaoConsumoItem; | |
277 | - } | |
278 | - | |
279 | - /** | |
280 | - * Define o valor do atributo <code>atendimentoRequisicaoConsumoItem</code>. | |
281 | - * | |
282 | - * @param atendimentoRequisicaoConsumoItem | |
283 | - */ | |
284 | - public void setAtendimentoRequisicaoConsumoItem(AtendimentoRequisicaoConsumoItem atendimentoRequisicaoConsumoItem) { | |
285 | - | |
286 | - this.atendimentoRequisicaoConsumoItem = atendimentoRequisicaoConsumoItem; | |
287 | - } | |
288 | - | |
289 | - /** | |
290 | - * Retorna o valor do atributo <code>localEstoque</code> | |
291 | - * | |
292 | - * @return <code>LocalEstoque</code> | |
293 | - */ | |
294 | - public LocalEstoque getLocalEstoque() { | |
295 | - | |
296 | - return localEstoque; | |
297 | - } | |
298 | - | |
299 | - /** | |
300 | - * Define o valor do atributo <code>localEstoque</code>. | |
301 | - * | |
302 | - * @param localEstoque | |
303 | - */ | |
304 | - public void setLocalEstoque(LocalEstoque localEstoque) { | |
305 | - | |
306 | - this.localEstoque = localEstoque; | |
307 | - } | |
308 | - | |
309 | - /** | |
310 | 241 | * Retorna o valor do atributo <code>material</code> |
311 | 242 | * |
312 | 243 | * @return <code>Material</code> |
313 | 244 | */ |
314 | - public Material getMaterial() { | |
245 | + public MaterialConsumo getMaterial() { | |
315 | 246 | |
316 | 247 | return material; |
317 | 248 | } |
... | ... | @@ -321,7 +252,7 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
321 | 252 | * |
322 | 253 | * @param material |
323 | 254 | */ |
324 | - public void setMaterial(Material material) { | |
255 | + public void setMaterial(MaterialConsumo material) { | |
325 | 256 | |
326 | 257 | this.material = material; |
327 | 258 | } |
... | ... | @@ -347,131 +278,132 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
347 | 278 | } |
348 | 279 | |
349 | 280 | /** |
350 | - * Retorna o valor do atributo <code>baixaAlmoxarifadoItem</code> | |
281 | + * Retorna o valor do atributo <code>valorFIFO</code> | |
351 | 282 | * |
352 | - * @return <code>BaixaAlmoxarifadoItem</code> | |
283 | + * @return <code>BigDecimal</code> | |
353 | 284 | */ |
354 | - public BaixaAlmoxarifadoItem getBaixaAlmoxarifadoItem() { | |
285 | + public BigDecimal getValorFIFO() { | |
355 | 286 | |
356 | - return baixaAlmoxarifadoItem; | |
287 | + return valorFIFO; | |
357 | 288 | } |
358 | 289 | |
359 | 290 | /** |
360 | - * Define o valor do atributo <code>baixaAlmoxarifadoItem</code>. | |
291 | + * Define o valor do atributo <code>valorFIFO</code>. | |
361 | 292 | * |
362 | - * @param baixaAlmoxarifadoItem | |
293 | + * @param valorFIFO | |
363 | 294 | */ |
364 | - public void setBaixaAlmoxarifadoItem(BaixaAlmoxarifadoItem baixaAlmoxarifadoItem) { | |
295 | + public void setValorFIFO(BigDecimal valorFIFO) { | |
365 | 296 | |
366 | - this.baixaAlmoxarifadoItem = baixaAlmoxarifadoItem; | |
297 | + this.valorFIFO = valorFIFO; | |
367 | 298 | } |
368 | 299 | |
369 | 300 | /** |
370 | - * Retorna o valor do atributo <code>devolucaoItem</code> | |
301 | + * Retorna o valor do atributo <code>valorMedia</code> | |
371 | 302 | * |
372 | - * @return <code>DevolucaoItem</code> | |
303 | + * @return <code>BigDecimal</code> | |
373 | 304 | */ |
374 | - public DevolucaoItem getDevolucaoItem() { | |
305 | + public BigDecimal getValorMedia() { | |
375 | 306 | |
376 | - return devolucaoItem; | |
307 | + return valorMedia; | |
377 | 308 | } |
378 | 309 | |
379 | 310 | /** |
380 | - * Define o valor do atributo <code>devolucaoItem</code>. | |
311 | + * Define o valor do atributo <code>valorMedia</code>. | |
381 | 312 | * |
382 | - * @param devolucaoItem | |
313 | + * @param valorMedia | |
383 | 314 | */ |
384 | - public void setDevolucaoItem(DevolucaoItem devolucaoItem) { | |
315 | + public void setValorMedia(BigDecimal valorMedia) { | |
385 | 316 | |
386 | - this.devolucaoItem = devolucaoItem; | |
317 | + this.valorMedia = valorMedia; | |
387 | 318 | } |
388 | 319 | |
320 | + | |
389 | 321 | /** |
390 | - * Retorna o valor do atributo <code>entradaAlmoxarifadoItem</code> | |
322 | + * Retorna o valor do atributo <code>materialEstoque</code> | |
391 | 323 | * |
392 | - * @return <code>EntradaAlmoxarifadoItem</code> | |
324 | + * @return <code>MaterialEstoque</code> | |
393 | 325 | */ |
394 | - public EntradaAlmoxarifadoItem getEntradaAlmoxarifadoItem() { | |
395 | - | |
396 | - return entradaAlmoxarifadoItem; | |
326 | + public MaterialEstoque getMaterialEstoque() { | |
327 | + | |
328 | + return materialEstoque; | |
397 | 329 | } |
398 | 330 | |
331 | + | |
399 | 332 | /** |
400 | - * Define o valor do atributo <code>entradaAlmoxarifadoItem</code>. | |
333 | + * Define o valor do atributo <code>materialEstoque</code>. | |
401 | 334 | * |
402 | - * @param entradaAlmoxarifadoItem | |
335 | + * @param materialEstoque | |
403 | 336 | */ |
404 | - public void setEntradaAlmoxarifadoItem(EntradaAlmoxarifadoItem entradaAlmoxarifadoItem) { | |
405 | - | |
406 | - this.entradaAlmoxarifadoItem = entradaAlmoxarifadoItem; | |
337 | + public void setMaterialEstoque(MaterialEstoque materialEstoque) { | |
338 | + | |
339 | + this.materialEstoque = materialEstoque; | |
407 | 340 | } |
408 | 341 | |
342 | + | |
409 | 343 | /** |
410 | - * Retorna o valor do atributo <code>materialEstoqueSaldo</code> | |
344 | + * Retorna o valor do atributo <code>dominioClasseReferencia</code> | |
411 | 345 | * |
412 | - * @return <code>MaterialEstoqueSaldo</code> | |
346 | + * @return <code>Dominio</code> | |
413 | 347 | */ |
414 | - public MaterialEstoqueSaldo getMaterialEstoqueSaldo() { | |
415 | - | |
416 | - return materialEstoqueSaldo; | |
348 | + public Dominio getDominioClasseReferencia() { | |
349 | + | |
350 | + return dominioClasseReferencia; | |
417 | 351 | } |
418 | 352 | |
353 | + | |
419 | 354 | /** |
420 | - * Define o valor do atributo <code>materialEstoqueSaldo</code>. | |
355 | + * Define o valor do atributo <code>dominioClasseReferencia</code>. | |
421 | 356 | * |
422 | - * @param materialEstoqueSaldo | |
357 | + * @param dominioClasseReferencia | |
423 | 358 | */ |
424 | - public void setMaterialEstoqueSaldo(MaterialEstoqueSaldo materialEstoqueSaldo) { | |
425 | - | |
426 | - this.materialEstoqueSaldo = materialEstoqueSaldo; | |
359 | + public void setDominioClasseReferencia(Dominio dominioClasseReferencia) { | |
360 | + | |
361 | + this.dominioClasseReferencia = dominioClasseReferencia; | |
427 | 362 | } |
428 | 363 | |
364 | + | |
429 | 365 | /** |
430 | - * Retorna o valor do atributo <code>valorFIFO</code> | |
366 | + * Retorna o valor do atributo <code>idClasseReferencia</code> | |
431 | 367 | * |
432 | - * @return <code>BigDecimal</code> | |
368 | + * @return <code>Long</code> | |
433 | 369 | */ |
434 | - public BigDecimal getValorFIFO() { | |
435 | - | |
436 | - return valorFIFO; | |
370 | + public Long getIdClasseReferencia() { | |
371 | + | |
372 | + return idClasseReferencia; | |
437 | 373 | } |
438 | 374 | |
375 | + | |
439 | 376 | /** |
440 | - * Define o valor do atributo <code>valorFIFO</code>. | |
377 | + * Define o valor do atributo <code>idClasseReferencia</code>. | |
441 | 378 | * |
442 | - * @param valorFIFO | |
379 | + * @param idClasseReferencia | |
443 | 380 | */ |
444 | - public void setValorFIFO(BigDecimal valorFIFO) { | |
445 | - | |
446 | - this.valorFIFO = valorFIFO; | |
381 | + public void setIdClasseReferencia(Long idClasseReferencia) { | |
382 | + | |
383 | + this.idClasseReferencia = idClasseReferencia; | |
447 | 384 | } |
448 | 385 | |
386 | + | |
449 | 387 | /** |
450 | - * Retorna o valor do atributo <code>valorMedia</code> | |
388 | + * Retorna o valor do atributo <code>materialLocalEstoque</code> | |
451 | 389 | * |
452 | - * @return <code>BigDecimal</code> | |
390 | + * @return <code>MaterialLocalEstoque</code> | |
453 | 391 | */ |
454 | - public BigDecimal getValorMedia() { | |
455 | - | |
456 | - return valorMedia; | |
392 | + public MaterialLocalEstoque getMaterialLocalEstoque() { | |
393 | + | |
394 | + return materialLocalEstoque; | |
457 | 395 | } |
458 | 396 | |
397 | + | |
459 | 398 | /** |
460 | - * Define o valor do atributo <code>valorMedia</code>. | |
399 | + * Define o valor do atributo <code>materialLocalEstoque</code>. | |
461 | 400 | * |
462 | - * @param valorMedia | |
401 | + * @param materialLocalEstoque | |
463 | 402 | */ |
464 | - public void setValorMedia(BigDecimal valorMedia) { | |
465 | - | |
466 | - this.valorMedia = valorMedia; | |
403 | + public void setMaterialLocalEstoque(MaterialLocalEstoque materialLocalEstoque) { | |
404 | + | |
405 | + this.materialLocalEstoque = materialLocalEstoque; | |
467 | 406 | } |
468 | 407 | |
469 | - public MaterialEstoque getMaterialEstoque() { | |
470 | - return materialEstoque; | |
471 | - } | |
472 | - | |
473 | - public void setMaterialEstoque(MaterialEstoque materialEstoque) { | |
474 | - this.materialEstoque = materialEstoque; | |
475 | - } | |
476 | 408 | |
477 | 409 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/RequisicaoConsumo.java
... | ... | @@ -12,6 +12,7 @@ import javax.persistence.GenerationType; |
12 | 12 | import javax.persistence.Id; |
13 | 13 | import javax.persistence.ManyToOne; |
14 | 14 | import javax.persistence.OneToMany; |
15 | +import javax.persistence.Table; | |
15 | 16 | import javax.persistence.Temporal; |
16 | 17 | import javax.persistence.TemporalType; |
17 | 18 | |
... | ... | @@ -61,6 +62,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
61 | 62 | * |
62 | 63 | */ |
63 | 64 | @Entity |
65 | +@Table(name="alm_requisicaoconsumo") | |
64 | 66 | @JsonIgnoreProperties({"$checked"}) |
65 | 67 | public class RequisicaoConsumo extends PersistentObjectAuditOrganizacao { |
66 | 68 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/RequisicaoConsumoItem.java
... | ... | @@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue; |
8 | 8 | import javax.persistence.GenerationType; |
9 | 9 | import javax.persistence.Id; |
10 | 10 | import javax.persistence.ManyToOne; |
11 | +import javax.persistence.Table; | |
11 | 12 | |
12 | 13 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
13 | 14 | import br.com.centralit.api.framework.json.ViewsAlmoxarifado; |
... | ... | @@ -52,6 +53,7 @@ import com.fasterxml.jackson.annotation.JsonView; |
52 | 53 | */ |
53 | 54 | @JsonIgnoreProperties({ "$quantidadeAtendida", "$quantidadeADevolver", "$TIPO_DECIMAL", "$index" }) |
54 | 55 | @Entity |
56 | +@Table(name="alm_rc_item") | |
55 | 57 | public class RequisicaoConsumoItem extends PersistentObjectAuditOrganizacao { |
56 | 58 | |
57 | 59 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/RequisicaoObservacao.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 | * <p> |
... | ... | @@ -37,6 +38,7 @@ import javax.persistence.ManyToOne; |
37 | 38 | * |
38 | 39 | */ |
39 | 40 | @Entity |
41 | +@Table(name="alm_rc_observacao") | |
40 | 42 | public class RequisicaoObservacao extends Observacao { |
41 | 43 | |
42 | 44 | /** Atributo serialVersionUID. */ | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/LocalEstoqueService.java
... | ... | @@ -1,36 +0,0 @@ |
1 | -package br.com.centralit.api.service; | |
2 | - | |
3 | -import br.com.centralit.api.model.EstruturaOrganizacional; | |
4 | -import br.com.centralit.api.model.LocalEstoque; | |
5 | -import br.com.centralit.framework.service.arquitetura.GenericService; | |
6 | - | |
7 | -public interface LocalEstoqueService extends GenericService<LocalEstoque, Long> { | |
8 | - | |
9 | - /** | |
10 | - * Método responsável por | |
11 | - * | |
12 | - * @author wilker.machado | |
13 | - * | |
14 | - * @param almoxarifado | |
15 | - * @return | |
16 | - */ | |
17 | - LocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado); | |
18 | - | |
19 | - /** | |
20 | - * <p> | |
21 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
22 | - * </p> | |
23 | - * | |
24 | - * <p> | |
25 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
26 | - * </p> | |
27 | - * | |
28 | - * Método responsável por salvar local estoque almoxarifado | |
29 | - * | |
30 | - * @author rogerio.cassimiro | |
31 | - * | |
32 | - * @param idEstruturaAlmoxarifado | |
33 | - * @return LocalEstoque | |
34 | - */ | |
35 | - LocalEstoque saveLocalEstoqueAlmoxarifado(String idEstruturaAlmoxarifado); | |
36 | -} |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/MaterialEstoqueSaldoMedioService.java
... | ... | @@ -1,144 +0,0 @@ |
1 | -/** | |
2 | - * | |
3 | - */ | |
4 | -package br.com.centralit.api.service; | |
5 | - | |
6 | -import java.math.BigDecimal; | |
7 | - | |
8 | -import br.com.centralit.api.model.Material; | |
9 | -import br.com.centralit.api.model.MaterialConsumo; | |
10 | -import br.com.centralit.api.model.MaterialEstoqueSaldoMedio; | |
11 | -import br.com.centralit.framework.service.arquitetura.GenericService; | |
12 | - | |
13 | -/** | |
14 | - * <p> | |
15 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
16 | - * </p> | |
17 | - * | |
18 | - * <p> | |
19 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
20 | - * </p> | |
21 | - * | |
22 | - * <p> | |
23 | - * <b>Title: </b> | |
24 | - * </p> | |
25 | - * | |
26 | - * <p> | |
27 | - * <b>Description: </b> | |
28 | - * </p> | |
29 | - * | |
30 | - * @since 23/06/2015 - 17:51:55 | |
31 | - * | |
32 | - * @version 1.0.0 | |
33 | - * | |
34 | - * @author geovane.filho | |
35 | - * | |
36 | - */ | |
37 | -public interface MaterialEstoqueSaldoMedioService extends GenericService<MaterialEstoqueSaldoMedio, Long> { | |
38 | - | |
39 | - /** | |
40 | - * <p> | |
41 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
42 | - * </p> | |
43 | - * | |
44 | - * <p> | |
45 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
46 | - * </p> | |
47 | - * | |
48 | - * Método responsável por atualizar o saldo do estoque de um material | |
49 | - * | |
50 | - * @author geovane.filho | |
51 | - * | |
52 | - * @param material Material a se atualizar o saldo médio do estoque | |
53 | - * @param quantidade Quantidade de material a se adicionar | |
54 | - * @param valorTotal Valor total dos materiais que estão sendo adicionados | |
55 | - */ | |
56 | - public void atualizaMaterialEstoque(Material material, BigDecimal quantidade, BigDecimal valorTotal); | |
57 | - | |
58 | - /** | |
59 | - * <p> | |
60 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
61 | - * </p> | |
62 | - * | |
63 | - * <p> | |
64 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
65 | - * </p> | |
66 | - * | |
67 | - * Método responsável por trazer o estoque atual de material baseado na análise de estoque por Média Móvel. | |
68 | - * | |
69 | - * @author geovane.filho | |
70 | - * | |
71 | - * @param material Material a se buscar o estoque atual. | |
72 | - * @return | |
73 | - */ | |
74 | - public MaterialEstoqueSaldoMedio findByMaterial(Material material); | |
75 | - | |
76 | - /** | |
77 | - * <p> | |
78 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
79 | - * </p> | |
80 | - * | |
81 | - * <p> | |
82 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
83 | - * </p> | |
84 | - * | |
85 | - * Método responsável por realizar um movimento de saida no saldo de estoque baseado na análise de estoque por média móvel. | |
86 | - * | |
87 | - * @author geovane.filho | |
88 | - * | |
89 | - * @param materialConsumo Material a se buscar o valor a ser movimentado pela analise de estoque baseado na Média Móvel. | |
90 | - * @param quantidadeMovimentada Quantidade de material sendo movimentado. | |
91 | - * | |
92 | - * @return Valor monetário da quantidade movimentada na saida. | |
93 | - */ | |
94 | - public BigDecimal realizaMovimentoSaida(MaterialConsumo materialConsumo, BigDecimal quantidadeMovimentada); | |
95 | - | |
96 | - /** | |
97 | - * <p> | |
98 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
99 | - * </p> | |
100 | - * | |
101 | - * <p> | |
102 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
103 | - * </p> | |
104 | - * | |
105 | - * Método responsável por realizar um movimento de devolução no saldo de estoque baseado na análise de estoque por média móvel. | |
106 | - * | |
107 | - * @author geovane.filho | |
108 | - * | |
109 | - * @param materialConsumo Material a se buscar o valor a ser movimentado pela analise de estoque baseado na Média Móvel. | |
110 | - * @param quantidadeMovimentada Quantidade de material sendo movimentado. | |
111 | - * | |
112 | - * @return Valor monetário da quantidade movimentada na devolução. | |
113 | - */ | |
114 | - public BigDecimal realizaMovimentoDevolucao(MaterialConsumo materialConsumo, BigDecimal quantidadeMovimentada); | |
115 | - | |
116 | - /** | |
117 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">2485</a></p> | |
118 | - * | |
119 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
120 | - * | |
121 | - * Método responsável por buscar o valor unitario do material na quando o sistema esta configurado para trabalhar com a media movel | |
122 | - * | |
123 | - * @author juliana.barbosa | |
124 | - * | |
125 | - * @param materialId | |
126 | - * @return | |
127 | - */ | |
128 | - public BigDecimal buscaValorUnitario(Long materialId); | |
129 | - | |
130 | - /** | |
131 | - * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">2485</a></p> | |
132 | - * | |
133 | - * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
134 | - * | |
135 | - * Método responsável por buscar o resto do material na quando o sistema esta configurado para trabalhar com a media movel | |
136 | - * | |
137 | - * @author juliana.barbosa | |
138 | - * | |
139 | - * @param materialId | |
140 | - * @return | |
141 | - */ | |
142 | - public BigDecimal buscaValorResto(Long materialId); | |
143 | - | |
144 | -} |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/MaterialEstoqueService.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.api.service; | |
2 | + | |
3 | +import br.com.centralit.api.model.MaterialEstoque; | |
4 | +import br.com.centralit.framework.service.arquitetura.GenericService; | |
5 | + | |
6 | +public interface MaterialEstoqueService extends GenericService<MaterialEstoque, Long> { | |
7 | + | |
8 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/MaterialLocalEstoqueService.java
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +package br.com.centralit.api.service; | |
2 | + | |
3 | +import br.com.centralit.api.model.EstruturaOrganizacional; | |
4 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
5 | +import br.com.centralit.framework.service.arquitetura.GenericService; | |
6 | + | |
7 | +public interface MaterialLocalEstoqueService extends GenericService<MaterialLocalEstoque, Long> { | |
8 | + | |
9 | + /** | |
10 | + * Método responsável por | |
11 | + * | |
12 | + * @author wilker.machado | |
13 | + * | |
14 | + * @param almoxarifado | |
15 | + * @return | |
16 | + */ | |
17 | + MaterialLocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado); | |
18 | +} | ... | ... |
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/BaixaAlmoxarifadoServiceImpl.java
1 | -package br.com.centralit.api.service.impl; | |
2 | - | |
3 | -import java.math.BigDecimal; | |
4 | -import java.util.List; | |
5 | - | |
6 | -import org.springframework.beans.factory.annotation.Autowired; | |
7 | -import org.springframework.beans.factory.annotation.Qualifier; | |
8 | -import org.springframework.stereotype.Service; | |
9 | -import org.springframework.validation.Validator; | |
10 | - | |
11 | -import br.com.centralit.api.dao.BaixaAlmoxarifadoDao; | |
12 | -import br.com.centralit.api.model.BaixaAlmoxarifado; | |
13 | -import br.com.centralit.api.model.BaixaAlmoxarifadoItem; | |
14 | -import br.com.centralit.api.model.BaixaDocumento; | |
15 | -import br.com.centralit.api.model.BaixaObservacao; | |
16 | -import br.com.centralit.api.model.DominioAlmoxarifado; | |
17 | -import br.com.centralit.api.service.BaixaAlmoxarifadoItemService; | |
18 | -import br.com.centralit.api.service.BaixaAlmoxarifadoService; | |
19 | -import br.com.centralit.api.service.ConfiguracaoParametroSistemaService; | |
20 | -import br.com.centralit.api.service.DominioService; | |
21 | -import br.com.centralit.api.service.EntradaAlmoxarifadoItemService; | |
22 | -import br.com.centralit.api.service.EstruturaOrganizacionalService; | |
23 | -import br.com.centralit.api.service.InternacionalizacaoService; | |
24 | -import br.com.centralit.api.service.MaterialConsumoService; | |
25 | -import br.com.centralit.api.service.MaterialEstoqueSaldoMedioService; | |
26 | -import br.com.centralit.api.service.MovimentoEstoqueService; | |
27 | -import br.com.centralit.api.service.ParceiroService; | |
28 | -import br.com.centralit.api.service.RequisicaoConsumoService; | |
29 | -import br.com.centralit.api.service.UsuarioService; | |
30 | -import br.com.centralit.framework.exception.BusinessException; | |
31 | -import br.com.centralit.framework.exception.CodigoErro; | |
32 | -import br.com.centralit.framework.model.Dominio; | |
33 | -import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
34 | -import br.com.centralit.framework.util.UtilColecao; | |
35 | -import br.com.centralit.framework.util.UtilObjeto; | |
36 | - | |
37 | -/** | |
38 | - * <p> | |
39 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
40 | - * </p> | |
41 | - * | |
42 | - * <p> | |
43 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
44 | - * </p> | |
45 | - * | |
46 | - * <p> | |
47 | - * <b>Title: </b> | |
48 | - * </p> | |
49 | - * | |
50 | - * <p> | |
51 | - * <b>Description: </b> | |
52 | - * </p> | |
53 | - * | |
54 | - * <p> | |
55 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
56 | - * </p> | |
57 | - * | |
58 | - * <p> | |
59 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
60 | - * </p> | |
61 | - * | |
62 | - * @since 18/06/2015 - 17:40:42 | |
63 | - * | |
64 | - * @version 1.0.0 | |
65 | - * | |
66 | - * @author rogerio.costa | |
67 | - * | |
68 | - */ | |
69 | -@Service("baixaAlmoxarifadoService") | |
70 | -public class BaixaAlmoxarifadoServiceImpl extends GenericServiceImpl<BaixaAlmoxarifado, Long> implements BaixaAlmoxarifadoService { | |
71 | - | |
72 | - private static final String VALIDACAO_QUANTIDADE_SUPERIOR_SALDO = "VALIDACAO.QUANTIDADE_SUPERIOR_SALDO"; | |
73 | - | |
74 | - private static final String VALIDACAO_REMOCAO_BAIXA_ALMOXARIFADO = "VALIDACAO.REMOCAO_EDICAO_BAIXA_ALMOXARIFADO"; | |
75 | - | |
76 | - /** Atributo baixaAlmoxarifadoDao. */ | |
77 | - private final BaixaAlmoxarifadoDao baixaAlmoxarifadoDao; | |
78 | - | |
79 | - /** Atributo parceiroService. */ | |
80 | - @Autowired | |
81 | - private ParceiroService parceiroService; | |
82 | - | |
83 | - /** Atributo dominioService. */ | |
84 | - @Autowired | |
85 | - private DominioService dominioService; | |
86 | - | |
87 | - /** Atributo usuarioService. */ | |
88 | - @Autowired | |
89 | - private UsuarioService usuarioService; | |
90 | - | |
91 | - /** Atributo usuarioService. */ | |
92 | - @Autowired | |
93 | - private MaterialConsumoService materialConsumoService; | |
94 | - | |
95 | - /** Atributo movimentoEstoqueService. */ | |
96 | - @Autowired | |
97 | - private MovimentoEstoqueService movimentoEstoqueService; | |
98 | - | |
99 | - /** Atributo estruturaOrganizacionalService. */ | |
100 | - @Autowired | |
101 | - private EstruturaOrganizacionalService estruturaOrganizacionalService; | |
102 | - | |
103 | - /** Atributo requisicaoConsumoService. */ | |
104 | - @Autowired | |
105 | - private RequisicaoConsumoService requisicaoConsumoService; | |
106 | - | |
107 | - /** Atributo baixaAlmoxarifadoItemService. */ | |
108 | - @Autowired | |
109 | - private BaixaAlmoxarifadoItemService baixaAlmoxarifadoItemService; | |
110 | - | |
111 | - @Autowired | |
112 | - private EntradaAlmoxarifadoItemService entradaAlmoxarifadoItemService; | |
113 | - | |
114 | - @Autowired | |
115 | - private MaterialEstoqueSaldoMedioService materialEstoqueSaldoMedioService; | |
116 | - | |
117 | - @Autowired | |
118 | - private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService; | |
119 | - | |
120 | - @Autowired | |
121 | - private InternacionalizacaoService internacionalizacaoService; | |
122 | - | |
123 | - private Dominio idioma; | |
124 | - | |
125 | - @Autowired | |
126 | - public BaixaAlmoxarifadoServiceImpl( final BaixaAlmoxarifadoDao baixaAlmoxarifadoDao, @Qualifier("baixaAlmoxarifadoValidator") final Validator validator ) { | |
127 | - | |
128 | - this.dao = baixaAlmoxarifadoDao; | |
129 | - this.baixaAlmoxarifadoDao = baixaAlmoxarifadoDao; | |
130 | - this.validator = validator; | |
131 | - } | |
132 | - | |
133 | - @Override | |
134 | - public BaixaAlmoxarifado save(BaixaAlmoxarifado entity) { | |
135 | - | |
136 | - this.validarEntidade(entity, this.validator); | |
137 | - | |
138 | - this.montarObjetoBaixa(entity); | |
139 | - | |
140 | - entity = super.save(entity); | |
141 | - | |
142 | - configurarNumeroBaixa(entity); | |
143 | - | |
144 | - salvaTotaisBaixaItem(entity); | |
145 | - | |
146 | - entity = super.save(entity); | |
147 | - | |
148 | - //Esse metodo gera os movimentos no estoque no contabil | |
149 | - this.movimentoEstoqueService.gerarMovimentoBaixa(entity); | |
150 | - | |
151 | - return entity; | |
152 | - } | |
153 | - | |
154 | - @Override | |
155 | - public BaixaAlmoxarifado merge(BaixaAlmoxarifado entity) { | |
156 | - | |
157 | - this.validarEntidade(entity, this.validator); | |
158 | - | |
159 | - this.montarObjetoBaixa(entity); | |
160 | - | |
161 | - salvaTotaisBaixaItem(entity); | |
162 | - | |
163 | - entity = super.merge(entity); | |
164 | - | |
165 | - this.movimentoEstoqueService.atualizarMovimentoBaixa(entity); | |
166 | - | |
167 | - return entity; | |
168 | - } | |
169 | - | |
170 | - /** | |
171 | - * <p> | |
172 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
173 | - * </p> | |
174 | - * | |
175 | - * <p> | |
176 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
177 | - * </p> | |
178 | - * | |
179 | - * Método responsável por estornar a baixa | |
180 | - * | |
181 | - * @author rogerio.costa | |
182 | - * | |
183 | - * @return | |
184 | - */ | |
185 | - @Override | |
186 | - public void estornar(final BaixaAlmoxarifado baixaAlmoxarifado) { | |
187 | - | |
188 | - this.baixaAlmoxarifadoItemService.estornarItens(baixaAlmoxarifado.getBaixaItens()); | |
189 | - | |
190 | - } | |
191 | - | |
192 | - /** | |
193 | - * <p> | |
194 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
195 | - * </p> | |
196 | - * | |
197 | - * <p> | |
198 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
199 | - * </p> | |
200 | - * | |
201 | - * Método responsável por | |
202 | - * | |
203 | - * @author rogerio.costa | |
204 | - * | |
205 | - * @param baixa | |
206 | - */ | |
207 | - private void montarObjetoBaixa(final BaixaAlmoxarifado baixa) { | |
208 | - | |
209 | - baixa.setDominioSituacaoEstorno(this.dominioService.findByChaveAndCodigo(Dominio.TIPO_STATUS_BAIXA_ESTORNO, Dominio.TIPO_STATUS_SEM_ESTORNO)); | |
210 | - | |
211 | - // pode existir ou nao o destino, caso exista retira o erro de transient | |
212 | - if (UtilObjeto.isReferencia(baixa.getDestino())) { | |
213 | - | |
214 | - baixa.setDestino(this.parceiroService.find(baixa.getDestino().getId())); | |
215 | - } | |
216 | - | |
217 | - // pode existir ou nao o portador, caso exista retira o erro de transient | |
218 | - if (UtilObjeto.isReferencia(baixa.getAlmoxarifado())) { | |
219 | - | |
220 | - baixa.setAlmoxarifado(this.estruturaOrganizacionalService.find(baixa.getAlmoxarifado().getId())); | |
221 | - } | |
222 | - | |
223 | - Dominio dominioTipoBaixa = this.dominioService.findByChaveAndNome(Dominio.TIPO_BAIXA_ALMOXARIFADO, baixa.getDominioTipoBaixa().getNome()); | |
224 | - | |
225 | - baixa.setDominioTipoBaixa(UtilObjeto.isReferencia(dominioTipoBaixa) ? dominioTipoBaixa : baixa.getDominioTipoBaixa()); | |
226 | - | |
227 | - // cria vinculo da baixa com as observações | |
228 | - | |
229 | - if (UtilObjeto.isReferencia(baixa.getObservacoes())) { | |
230 | - | |
231 | - for (final BaixaObservacao obs : baixa.getObservacoes()) { | |
232 | - | |
233 | - obs.setAutor(this.usuarioService.find(obs.getAutor().getId())); | |
234 | - | |
235 | - obs.setBaixa(baixa); | |
236 | - } | |
237 | - } | |
238 | - | |
239 | - // cria vinculo da baixa com aos documentos | |
240 | - if (UtilObjeto.isReferencia(baixa.getDocumentos())) { | |
241 | - | |
242 | - for (final BaixaDocumento doc : baixa.getDocumentos()) { | |
243 | - | |
244 | - doc.setDominioTipoDocumento(this.dominioService.find(doc.getDominioTipoDocumento().getId())); | |
245 | - | |
246 | - if (UtilObjeto.isReferencia(doc.getEmitente())) { | |
247 | - | |
248 | - doc.setEmitente(this.parceiroService.find(doc.getEmitente().getId())); | |
249 | - } | |
250 | - | |
251 | - doc.setBaixa(baixa); | |
252 | - | |
253 | - } | |
254 | - } | |
255 | - | |
256 | - if (!UtilColecao.isVazio(baixa.getBaixaItens())) { | |
257 | - | |
258 | - // cria vinculo da baixa com as baixaItens | |
259 | - for (final BaixaAlmoxarifadoItem baixaItem : baixa.getBaixaItens()) { | |
260 | - | |
261 | - this.validarQtdItemAlmoxarifado(baixaItem); | |
262 | - | |
263 | - baixaItem.setBaixaAlmoxarifado(baixa); | |
264 | - | |
265 | - baixaItem.setMaterialConsumo(this.materialConsumoService.getReference(baixaItem.getMaterialConsumo().getId())); | |
266 | - } | |
267 | - } | |
268 | - | |
269 | - if(UtilObjeto.isReferencia(baixa.getId()) && baixa.getOrganizacao() == null){ | |
270 | - baixa.setOrganizacao(this.find(baixa.getId()).getOrganizacao()); | |
271 | - } | |
272 | - | |
273 | - } | |
274 | - | |
275 | - /** | |
276 | - * <p> | |
277 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
278 | - * </p> | |
279 | - * | |
280 | - * <p> | |
281 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
282 | - * </p> | |
283 | - * | |
284 | - * Método responsável por validara qtd do itemAlmoxarifado | |
285 | - * | |
286 | - * @author rogerio.costa | |
287 | - * | |
288 | - * @param baixaItem | |
289 | - */ | |
290 | - private void validarQtdItemAlmoxarifado(final BaixaAlmoxarifadoItem baixaItem) { | |
291 | - | |
292 | - if (UtilObjeto.isReferencia(baixaItem.getId())) { | |
293 | - | |
294 | - final BaixaAlmoxarifadoItem itemAtual = this.baixaAlmoxarifadoItemService.getReference(baixaItem.getId()); | |
295 | - | |
296 | - if (itemAtual.getQuantidade().compareTo(baixaItem.getQtdEstoque()) > 0 && baixaItem.getQuantidade().compareTo(itemAtual.getQuantidade()) > 0) { | |
297 | - | |
298 | - if (itemAtual.getQuantidade().add(baixaItem.getQtdEstoque()).compareTo(baixaItem.getQuantidade()) > 0) { | |
299 | - | |
300 | - throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
301 | - | |
302 | - } else { | |
303 | - if (baixaItem.getQuantidade().compareTo(itemAtual.getQuantidade().add(baixaItem.getQtdEstoque())) > 0) { | |
304 | - | |
305 | - throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
306 | - } | |
307 | - } | |
308 | - } else if (baixaItem.getQuantidade().compareTo(baixaItem.getQtdEstoque()) > 0 && baixaItem.getQuantidade().compareTo(itemAtual.getQuantidade().add(baixaItem.getQtdEstoque())) > 0) { | |
309 | - | |
310 | - throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
311 | - } | |
312 | - } else { | |
313 | - | |
314 | - if (baixaItem.getQuantidade().compareTo(baixaItem.getQtdEstoque()) > 0) { | |
315 | - | |
316 | - throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
317 | - } | |
318 | - } | |
319 | - } | |
320 | - | |
321 | - @Override | |
322 | - public boolean removeById(final Long id) { | |
323 | - | |
324 | - this.verificarVinculoRequisicaoPosteriorRemocao(id); | |
325 | - | |
326 | - final BaixaAlmoxarifado baixaAlmoxarifado = this.getReference(id); | |
327 | - | |
328 | - this.baixaAlmoxarifadoItemService.removeList((List<BaixaAlmoxarifadoItem>) baixaAlmoxarifado.getBaixaItens()); | |
329 | - | |
330 | - return super.removeById(id); | |
331 | - } | |
332 | - | |
333 | - /** | |
334 | - * <p> | |
335 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
336 | - * </p> | |
337 | - * | |
338 | - * <p> | |
339 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
340 | - * </p> | |
341 | - * | |
342 | - * Método responsável por | |
343 | - * | |
344 | - * @author rogerio.costa | |
345 | - * | |
346 | - * @param entity | |
347 | - */ | |
348 | - @Override | |
349 | - public void obterQtdEstoque(final BaixaAlmoxarifado entity) { | |
350 | - | |
351 | - this.baixaAlmoxarifadoItemService.obterQtdEstoque(entity.getBaixaItens()); | |
352 | - | |
353 | - } | |
354 | - | |
355 | - /** | |
356 | - * <p> | |
357 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
358 | - * </p> | |
359 | - * | |
360 | - * <p> | |
361 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
362 | - * </p> | |
363 | - * | |
364 | - * Método responsável por | |
365 | - * | |
366 | - * @author rogerio.costa | |
367 | - * | |
368 | - */ | |
369 | - @Override | |
370 | - public void verificarVinculoRequisicaoPosteriorRemocao(final Long idBaixa) { | |
371 | - | |
372 | - final BaixaAlmoxarifado baixaAlmoxarifado = this.getReference(idBaixa); | |
373 | - | |
374 | - if (!UtilColecao.isVazio(baixaAlmoxarifado.getBaixaItens())) { | |
375 | - | |
376 | - for (final BaixaAlmoxarifadoItem item : baixaAlmoxarifado.getBaixaItens()) { | |
377 | - | |
378 | - final boolean contemVinculoRequisicao = this.requisicaoConsumoService.contemVinculoMaterialPorDataEAlmoxarifado(item.getMaterialConsumo().getId(), baixaAlmoxarifado.getAlmoxarifado().getId(), baixaAlmoxarifado.getDataBaixa()); | |
379 | - | |
380 | - if (contemVinculoRequisicao) { | |
381 | - | |
382 | - throw new BusinessException(BaixaAlmoxarifadoServiceImpl.VALIDACAO_REMOCAO_BAIXA_ALMOXARIFADO, CodigoErro.REGRA_NEGOCIO.getValue()); | |
383 | - } | |
384 | - } | |
385 | - | |
386 | - } | |
387 | - | |
388 | - } | |
389 | - | |
390 | - /** | |
391 | - * <p> | |
392 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
393 | - * </p> | |
394 | - * | |
395 | - * <p> | |
396 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
397 | - * </p> | |
398 | - * | |
399 | - * Método responsável por settar o atributo numeroBaixa. | |
400 | - * | |
401 | - * @author luis.camargo | |
402 | - * | |
403 | - * @param entity | |
404 | - */ | |
405 | - private void configurarNumeroBaixa(BaixaAlmoxarifado entity) { | |
406 | - | |
407 | - BaixaAlmoxarifado ultimoRegistro = | |
408 | - (BaixaAlmoxarifado) baixaAlmoxarifadoDao.buscarUltimoRegistroComOrdenadoParametrizada("numeroBaixa", entity.getOrganizacao().getId()); | |
409 | - | |
410 | - Long sequencial = null; | |
411 | - if (UtilObjeto.isReferencia(ultimoRegistro)) { | |
412 | - sequencial = ultimoRegistro.getNumeroBaixa() == null ? null : Long.parseLong(ultimoRegistro.getNumeroBaixa()); | |
413 | - } | |
414 | - String codigo = configuracaoParametroSistemaService.gerarNumeroIdentificacao(sequencial, entity.getOrganizacao()); | |
415 | - | |
416 | - entity.setNumeroBaixa(codigo); | |
417 | - } | |
418 | - | |
419 | - private void salvaTotaisBaixaItem(BaixaAlmoxarifado baixa){ | |
420 | - if (!UtilColecao.isVazio(baixa.getBaixaItens())) { | |
421 | - | |
422 | - // salva os totais na baixa conforme metodo de avalicao monetaria | |
423 | - for (final BaixaAlmoxarifadoItem baixaItem : baixa.getBaixaItens()) { | |
424 | - | |
425 | - String tipoAvaliacao = this.configuracaoParametroSistemaService.getParametro("TIPO_AVALIACAO_MONETARIA_ESTOQUE", baixa.getOrganizacao().getId()).getValor(); | |
426 | - | |
427 | - if (tipoAvaliacao.equals(DominioAlmoxarifado.TIPO_AVALIACAO_MONETARIA_FIFO_NOME)){ | |
428 | - BigDecimal valorMovimentoFIFO = this.entradaAlmoxarifadoItemService.realizaMovimentoSaida(baixaItem.getMaterialConsumo(), baixaItem.getQuantidade()); | |
429 | - baixaItem.setTotal(valorMovimentoFIFO); | |
430 | - }else{ | |
431 | - BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoSaida(baixaItem.getMaterialConsumo(), baixaItem.getQuantidade()); | |
432 | - baixaItem.setTotal(valorMovimentoMediaMovel); | |
433 | - } | |
434 | - } | |
435 | - } | |
436 | - } | |
437 | - | |
438 | - public Dominio getIdioma() { | |
439 | - if(!UtilObjeto.isReferencia(idioma)){ | |
440 | - idioma = this.dominioService.findByChaveAndCodigo("tipoIdioma", Dominio.TIPO_IDIOMA_PT_BR_CODIGO); | |
441 | - } | |
442 | - return idioma; | |
443 | - } | |
444 | - | |
445 | -} | |
1 | +package br.com.centralit.api.service.impl; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.beans.factory.annotation.Qualifier; | |
8 | +import org.springframework.stereotype.Service; | |
9 | +import org.springframework.validation.Validator; | |
10 | + | |
11 | +import br.com.centralit.api.dao.BaixaAlmoxarifadoDao; | |
12 | +import br.com.centralit.api.model.BaixaAlmoxarifado; | |
13 | +import br.com.centralit.api.model.BaixaAlmoxarifadoItem; | |
14 | +import br.com.centralit.api.model.BaixaDocumento; | |
15 | +import br.com.centralit.api.model.BaixaObservacao; | |
16 | +import br.com.centralit.api.model.DominioAlmoxarifado; | |
17 | +import br.com.centralit.api.service.BaixaAlmoxarifadoItemService; | |
18 | +import br.com.centralit.api.service.BaixaAlmoxarifadoService; | |
19 | +import br.com.centralit.api.service.ConfiguracaoParametroSistemaService; | |
20 | +import br.com.centralit.api.service.DominioService; | |
21 | +import br.com.centralit.api.service.EntradaAlmoxarifadoItemService; | |
22 | +import br.com.centralit.api.service.EstruturaOrganizacionalService; | |
23 | +import br.com.centralit.api.service.InternacionalizacaoService; | |
24 | +import br.com.centralit.api.service.MaterialConsumoService; | |
25 | +import br.com.centralit.api.service.MovimentoEstoqueService; | |
26 | +import br.com.centralit.api.service.ParceiroService; | |
27 | +import br.com.centralit.api.service.RequisicaoConsumoService; | |
28 | +import br.com.centralit.api.service.UsuarioService; | |
29 | +import br.com.centralit.framework.exception.BusinessException; | |
30 | +import br.com.centralit.framework.exception.CodigoErro; | |
31 | +import br.com.centralit.framework.model.Dominio; | |
32 | +import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
33 | +import br.com.centralit.framework.util.UtilColecao; | |
34 | +import br.com.centralit.framework.util.UtilObjeto; | |
35 | + | |
36 | +/** | |
37 | + * <p> | |
38 | + * <img src="http://centralit.com.br/images/logo_central.png"> | |
39 | + * </p> | |
40 | + * | |
41 | + * <p> | |
42 | + * <b>Company: </b> Central IT - Governança Corporativa - | |
43 | + * </p> | |
44 | + * | |
45 | + * <p> | |
46 | + * <b>Title: </b> | |
47 | + * </p> | |
48 | + * | |
49 | + * <p> | |
50 | + * <b>Description: </b> | |
51 | + * </p> | |
52 | + * | |
53 | + * <p> | |
54 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
55 | + * </p> | |
56 | + * | |
57 | + * <p> | |
58 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
59 | + * </p> | |
60 | + * | |
61 | + * @since 18/06/2015 - 17:40:42 | |
62 | + * | |
63 | + * @version 1.0.0 | |
64 | + * | |
65 | + * @author rogerio.costa | |
66 | + * | |
67 | + */ | |
68 | +@Service("baixaAlmoxarifadoService") | |
69 | +public class BaixaAlmoxarifadoServiceImpl extends GenericServiceImpl<BaixaAlmoxarifado, Long> implements BaixaAlmoxarifadoService { | |
70 | + | |
71 | + private static final String VALIDACAO_QUANTIDADE_SUPERIOR_SALDO = "VALIDACAO.QUANTIDADE_SUPERIOR_SALDO"; | |
72 | + | |
73 | + private static final String VALIDACAO_REMOCAO_BAIXA_ALMOXARIFADO = "VALIDACAO.REMOCAO_EDICAO_BAIXA_ALMOXARIFADO"; | |
74 | + | |
75 | + /** Atributo baixaAlmoxarifadoDao. */ | |
76 | + private final BaixaAlmoxarifadoDao baixaAlmoxarifadoDao; | |
77 | + | |
78 | + /** Atributo parceiroService. */ | |
79 | + @Autowired | |
80 | + private ParceiroService parceiroService; | |
81 | + | |
82 | + /** Atributo dominioService. */ | |
83 | + @Autowired | |
84 | + private DominioService dominioService; | |
85 | + | |
86 | + /** Atributo usuarioService. */ | |
87 | + @Autowired | |
88 | + private UsuarioService usuarioService; | |
89 | + | |
90 | + /** Atributo usuarioService. */ | |
91 | + @Autowired | |
92 | + private MaterialConsumoService materialConsumoService; | |
93 | + | |
94 | + /** Atributo movimentoEstoqueService. */ | |
95 | + @Autowired | |
96 | + private MovimentoEstoqueService movimentoEstoqueService; | |
97 | + | |
98 | + /** Atributo estruturaOrganizacionalService. */ | |
99 | + @Autowired | |
100 | + private EstruturaOrganizacionalService estruturaOrganizacionalService; | |
101 | + | |
102 | + /** Atributo requisicaoConsumoService. */ | |
103 | + @Autowired | |
104 | + private RequisicaoConsumoService requisicaoConsumoService; | |
105 | + | |
106 | + /** Atributo baixaAlmoxarifadoItemService. */ | |
107 | + @Autowired | |
108 | + private BaixaAlmoxarifadoItemService baixaAlmoxarifadoItemService; | |
109 | + | |
110 | + @Autowired | |
111 | + private EntradaAlmoxarifadoItemService entradaAlmoxarifadoItemService; | |
112 | + | |
113 | + @Autowired | |
114 | + private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService; | |
115 | + | |
116 | + @Autowired | |
117 | + private InternacionalizacaoService internacionalizacaoService; | |
118 | + | |
119 | + private Dominio idioma; | |
120 | + | |
121 | + @Autowired | |
122 | + public BaixaAlmoxarifadoServiceImpl( final BaixaAlmoxarifadoDao baixaAlmoxarifadoDao, @Qualifier("baixaAlmoxarifadoValidator") final Validator validator ) { | |
123 | + | |
124 | + this.dao = baixaAlmoxarifadoDao; | |
125 | + this.baixaAlmoxarifadoDao = baixaAlmoxarifadoDao; | |
126 | + this.validator = validator; | |
127 | + } | |
128 | + | |
129 | + @Override | |
130 | + public BaixaAlmoxarifado save(BaixaAlmoxarifado entity) { | |
131 | + | |
132 | + this.validarEntidade(entity, this.validator); | |
133 | + | |
134 | + this.montarObjetoBaixa(entity); | |
135 | + | |
136 | + entity = super.save(entity); | |
137 | + | |
138 | + configurarNumeroBaixa(entity); | |
139 | + | |
140 | + salvaTotaisBaixaItem(entity); | |
141 | + | |
142 | + entity = super.save(entity); | |
143 | + | |
144 | + //Esse metodo gera os movimentos no estoque no contabil | |
145 | + this.movimentoEstoqueService.gerarMovimentoBaixa(entity); | |
146 | + | |
147 | + return entity; | |
148 | + } | |
149 | + | |
150 | + @Override | |
151 | + public BaixaAlmoxarifado merge(BaixaAlmoxarifado entity) { | |
152 | + | |
153 | + this.validarEntidade(entity, this.validator); | |
154 | + | |
155 | + this.montarObjetoBaixa(entity); | |
156 | + | |
157 | + salvaTotaisBaixaItem(entity); | |
158 | + | |
159 | + entity = super.merge(entity); | |
160 | + | |
161 | + this.movimentoEstoqueService.atualizarMovimentoBaixa(entity); | |
162 | + | |
163 | + return entity; | |
164 | + } | |
165 | + | |
166 | + /** | |
167 | + * <p> | |
168 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
169 | + * </p> | |
170 | + * | |
171 | + * <p> | |
172 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
173 | + * </p> | |
174 | + * | |
175 | + * Método responsável por estornar a baixa | |
176 | + * | |
177 | + * @author rogerio.costa | |
178 | + * | |
179 | + * @return | |
180 | + */ | |
181 | + @Override | |
182 | + public void estornar(final BaixaAlmoxarifado baixaAlmoxarifado) { | |
183 | + | |
184 | + this.baixaAlmoxarifadoItemService.estornarItens(baixaAlmoxarifado.getBaixaItens()); | |
185 | + | |
186 | + } | |
187 | + | |
188 | + /** | |
189 | + * <p> | |
190 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
191 | + * </p> | |
192 | + * | |
193 | + * <p> | |
194 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
195 | + * </p> | |
196 | + * | |
197 | + * Método responsável por | |
198 | + * | |
199 | + * @author rogerio.costa | |
200 | + * | |
201 | + * @param baixa | |
202 | + */ | |
203 | + private void montarObjetoBaixa(final BaixaAlmoxarifado baixa) { | |
204 | + | |
205 | + baixa.setDominioSituacaoEstorno(this.dominioService.findByChaveAndCodigo(Dominio.TIPO_STATUS_BAIXA_ESTORNO, Dominio.TIPO_STATUS_SEM_ESTORNO)); | |
206 | + | |
207 | + // pode existir ou nao o destino, caso exista retira o erro de transient | |
208 | + if (UtilObjeto.isReferencia(baixa.getDestino())) { | |
209 | + | |
210 | + baixa.setDestino(this.parceiroService.find(baixa.getDestino().getId())); | |
211 | + } | |
212 | + | |
213 | + // pode existir ou nao o portador, caso exista retira o erro de transient | |
214 | + if (UtilObjeto.isReferencia(baixa.getAlmoxarifado())) { | |
215 | + | |
216 | + baixa.setAlmoxarifado(this.estruturaOrganizacionalService.find(baixa.getAlmoxarifado().getId())); | |
217 | + } | |
218 | + | |
219 | + Dominio dominioTipoBaixa = this.dominioService.findByChaveAndNome(Dominio.TIPO_BAIXA_ALMOXARIFADO, baixa.getDominioTipoBaixa().getNome()); | |
220 | + | |
221 | + baixa.setDominioTipoBaixa(UtilObjeto.isReferencia(dominioTipoBaixa) ? dominioTipoBaixa : baixa.getDominioTipoBaixa()); | |
222 | + | |
223 | + // cria vinculo da baixa com as observações | |
224 | + | |
225 | + if (UtilObjeto.isReferencia(baixa.getObservacoes())) { | |
226 | + | |
227 | + for (final BaixaObservacao obs : baixa.getObservacoes()) { | |
228 | + | |
229 | + obs.setAutor(this.usuarioService.find(obs.getAutor().getId())); | |
230 | + | |
231 | + obs.setBaixa(baixa); | |
232 | + } | |
233 | + } | |
234 | + | |
235 | + // cria vinculo da baixa com aos documentos | |
236 | + if (UtilObjeto.isReferencia(baixa.getDocumentos())) { | |
237 | + | |
238 | + for (final BaixaDocumento doc : baixa.getDocumentos()) { | |
239 | + | |
240 | + doc.setDominioTipoDocumento(this.dominioService.find(doc.getDominioTipoDocumento().getId())); | |
241 | + | |
242 | + if (UtilObjeto.isReferencia(doc.getEmitente())) { | |
243 | + | |
244 | + doc.setEmitente(this.parceiroService.find(doc.getEmitente().getId())); | |
245 | + } | |
246 | + | |
247 | + doc.setBaixa(baixa); | |
248 | + | |
249 | + } | |
250 | + } | |
251 | + | |
252 | + if (!UtilColecao.isVazio(baixa.getBaixaItens())) { | |
253 | + | |
254 | + // cria vinculo da baixa com as baixaItens | |
255 | + for (final BaixaAlmoxarifadoItem baixaItem : baixa.getBaixaItens()) { | |
256 | + | |
257 | + this.validarQtdItemAlmoxarifado(baixaItem); | |
258 | + | |
259 | + baixaItem.setBaixaAlmoxarifado(baixa); | |
260 | + | |
261 | + baixaItem.setMaterialConsumo(this.materialConsumoService.getReference(baixaItem.getMaterialConsumo().getId())); | |
262 | + } | |
263 | + } | |
264 | + | |
265 | + if(UtilObjeto.isReferencia(baixa.getId()) && baixa.getOrganizacao() == null){ | |
266 | + baixa.setOrganizacao(this.find(baixa.getId()).getOrganizacao()); | |
267 | + } | |
268 | + | |
269 | + } | |
270 | + | |
271 | + /** | |
272 | + * <p> | |
273 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
274 | + * </p> | |
275 | + * | |
276 | + * <p> | |
277 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
278 | + * </p> | |
279 | + * | |
280 | + * Método responsável por validara qtd do itemAlmoxarifado | |
281 | + * | |
282 | + * @author rogerio.costa | |
283 | + * | |
284 | + * @param baixaItem | |
285 | + */ | |
286 | + private void validarQtdItemAlmoxarifado(final BaixaAlmoxarifadoItem baixaItem) { | |
287 | + | |
288 | + if (UtilObjeto.isReferencia(baixaItem.getId())) { | |
289 | + | |
290 | + final BaixaAlmoxarifadoItem itemAtual = this.baixaAlmoxarifadoItemService.getReference(baixaItem.getId()); | |
291 | + | |
292 | + if (itemAtual.getQuantidade().compareTo(baixaItem.getQtdEstoque()) > 0 && baixaItem.getQuantidade().compareTo(itemAtual.getQuantidade()) > 0) { | |
293 | + | |
294 | + if (itemAtual.getQuantidade().add(baixaItem.getQtdEstoque()).compareTo(baixaItem.getQuantidade()) > 0) { | |
295 | + | |
296 | + throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
297 | + | |
298 | + } else { | |
299 | + if (baixaItem.getQuantidade().compareTo(itemAtual.getQuantidade().add(baixaItem.getQtdEstoque())) > 0) { | |
300 | + | |
301 | + throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
302 | + } | |
303 | + } | |
304 | + } else if (baixaItem.getQuantidade().compareTo(baixaItem.getQtdEstoque()) > 0 && baixaItem.getQuantidade().compareTo(itemAtual.getQuantidade().add(baixaItem.getQtdEstoque())) > 0) { | |
305 | + | |
306 | + throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
307 | + } | |
308 | + } else { | |
309 | + | |
310 | + if (baixaItem.getQuantidade().compareTo(baixaItem.getQtdEstoque()) > 0) { | |
311 | + | |
312 | + throw new BusinessException(this.internacionalizacaoService.getTranslate(BaixaAlmoxarifadoServiceImpl.VALIDACAO_QUANTIDADE_SUPERIOR_SALDO, this.getIdioma()), CodigoErro.REGRA_NEGOCIO.getValue()); | |
313 | + } | |
314 | + } | |
315 | + } | |
316 | + | |
317 | + @Override | |
318 | + public boolean removeById(final Long id) { | |
319 | + | |
320 | + this.verificarVinculoRequisicaoPosteriorRemocao(id); | |
321 | + | |
322 | + final BaixaAlmoxarifado baixaAlmoxarifado = this.getReference(id); | |
323 | + | |
324 | + this.baixaAlmoxarifadoItemService.removeList((List<BaixaAlmoxarifadoItem>) baixaAlmoxarifado.getBaixaItens()); | |
325 | + | |
326 | + return super.removeById(id); | |
327 | + } | |
328 | + | |
329 | + /** | |
330 | + * <p> | |
331 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
332 | + * </p> | |
333 | + * | |
334 | + * <p> | |
335 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
336 | + * </p> | |
337 | + * | |
338 | + * Método responsável por | |
339 | + * | |
340 | + * @author rogerio.costa | |
341 | + * | |
342 | + * @param entity | |
343 | + */ | |
344 | + @Override | |
345 | + public void obterQtdEstoque(final BaixaAlmoxarifado entity) { | |
346 | + | |
347 | + this.baixaAlmoxarifadoItemService.obterQtdEstoque(entity.getBaixaItens()); | |
348 | + | |
349 | + } | |
350 | + | |
351 | + /** | |
352 | + * <p> | |
353 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
354 | + * </p> | |
355 | + * | |
356 | + * <p> | |
357 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
358 | + * </p> | |
359 | + * | |
360 | + * Método responsável por | |
361 | + * | |
362 | + * @author rogerio.costa | |
363 | + * | |
364 | + */ | |
365 | + @Override | |
366 | + public void verificarVinculoRequisicaoPosteriorRemocao(final Long idBaixa) { | |
367 | + | |
368 | + final BaixaAlmoxarifado baixaAlmoxarifado = this.getReference(idBaixa); | |
369 | + | |
370 | + if (!UtilColecao.isVazio(baixaAlmoxarifado.getBaixaItens())) { | |
371 | + | |
372 | + for (final BaixaAlmoxarifadoItem item : baixaAlmoxarifado.getBaixaItens()) { | |
373 | + | |
374 | + final boolean contemVinculoRequisicao = this.requisicaoConsumoService.contemVinculoMaterialPorDataEAlmoxarifado(item.getMaterialConsumo().getId(), baixaAlmoxarifado.getAlmoxarifado().getId(), baixaAlmoxarifado.getDataBaixa()); | |
375 | + | |
376 | + if (contemVinculoRequisicao) { | |
377 | + | |
378 | + throw new BusinessException(BaixaAlmoxarifadoServiceImpl.VALIDACAO_REMOCAO_BAIXA_ALMOXARIFADO, CodigoErro.REGRA_NEGOCIO.getValue()); | |
379 | + } | |
380 | + } | |
381 | + | |
382 | + } | |
383 | + | |
384 | + } | |
385 | + | |
386 | + /** | |
387 | + * <p> | |
388 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
389 | + * </p> | |
390 | + * | |
391 | + * <p> | |
392 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
393 | + * </p> | |
394 | + * | |
395 | + * Método responsável por settar o atributo numeroBaixa. | |
396 | + * | |
397 | + * @author luis.camargo | |
398 | + * | |
399 | + * @param entity | |
400 | + */ | |
401 | + private void configurarNumeroBaixa(BaixaAlmoxarifado entity) { | |
402 | + | |
403 | + BaixaAlmoxarifado ultimoRegistro = | |
404 | + (BaixaAlmoxarifado) baixaAlmoxarifadoDao.buscarUltimoRegistroComOrdenadoParametrizada("numeroBaixa", entity.getOrganizacao().getId()); | |
405 | + | |
406 | + Long sequencial = null; | |
407 | + if (UtilObjeto.isReferencia(ultimoRegistro)) { | |
408 | + sequencial = ultimoRegistro.getNumeroBaixa() == null ? null : Long.parseLong(ultimoRegistro.getNumeroBaixa()); | |
409 | + } | |
410 | + String codigo = configuracaoParametroSistemaService.gerarNumeroIdentificacao(sequencial, entity.getOrganizacao()); | |
411 | + | |
412 | + entity.setNumeroBaixa(codigo); | |
413 | + } | |
414 | + | |
415 | + private void salvaTotaisBaixaItem(BaixaAlmoxarifado baixa){ | |
416 | + if (!UtilColecao.isVazio(baixa.getBaixaItens())) { | |
417 | + | |
418 | + // salva os totais na baixa conforme metodo de avalicao monetaria | |
419 | + for (final BaixaAlmoxarifadoItem baixaItem : baixa.getBaixaItens()) { | |
420 | + | |
421 | + String tipoAvaliacao = this.configuracaoParametroSistemaService.getParametro("TIPO_AVALIACAO_MONETARIA_ESTOQUE", baixa.getOrganizacao().getId()).getValor(); | |
422 | + | |
423 | + if (tipoAvaliacao.equals(DominioAlmoxarifado.TIPO_AVALIACAO_MONETARIA_FIFO_NOME)){ | |
424 | + BigDecimal valorMovimentoFIFO = this.entradaAlmoxarifadoItemService.realizaMovimentoSaida(baixaItem.getMaterialConsumo(), baixaItem.getQuantidade()); | |
425 | + baixaItem.setTotal(valorMovimentoFIFO); | |
426 | + }else{ | |
427 | + //BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoSaida(baixaItem.getMaterialConsumo(), baixaItem.getQuantidade()); | |
428 | + //baixaItem.setTotal(valorMovimentoMediaMovel); | |
429 | + } | |
430 | + } | |
431 | + } | |
432 | + } | |
433 | + | |
434 | + public Dominio getIdioma() { | |
435 | + if(!UtilObjeto.isReferencia(idioma)){ | |
436 | + idioma = this.dominioService.findByChaveAndCodigo("tipoIdioma", Dominio.TIPO_IDIOMA_PT_BR_CODIGO); | |
437 | + } | |
438 | + return idioma; | |
439 | + } | |
440 | + | |
441 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/ConfiguracaoNotificacaoRessuprimentoServiceImpl.java
... | ... | @@ -423,7 +423,7 @@ public class ConfiguracaoNotificacaoRessuprimentoServiceImpl extends GenericServ |
423 | 423 | |
424 | 424 | BigDecimal qtdMaterialEstoque = this.materialConsumoService.getQuantidadeAtualMaterial(config.getMaterialConsumo().getId(), Long.parseLong(idOrganizacao)); |
425 | 425 | |
426 | - mensagemConfiguracao.append(ESTOQUE).append(config.getLocalEstoque().getAlmoxarifado().getCodigoENome()) | |
426 | + mensagemConfiguracao.append(ESTOQUE).append(config.getLocalEstoque().getEndereco().getEstoque().getAlmoxarifado().getCodigoENome()) | |
427 | 427 | .append(MATERIAL).append(config.getMaterialConsumo().getCodigoEDescricao()) |
428 | 428 | .append(QUANTIDADE).append(qtdMaterialEstoque).append("<br/><br/>"); |
429 | 429 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/EntradaAlmoxarifadoItemServiceImpl.java
... | ... | @@ -195,12 +195,13 @@ public class EntradaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<Entra |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * {@inheritDoc} |
198 | + * TODO implementar com nova regra | |
198 | 199 | */ |
199 | 200 | @Override |
200 | 201 | public BigDecimal realizaMovimentoSaida(MaterialConsumo materialConsumo, BigDecimal quantidadeMovimentada) { |
201 | 202 | BigDecimal retorno = BigDecimal.ZERO; |
202 | 203 | |
203 | - Collection<EntradaAlmoxarifadoItem> entradaAlmoxarifadoItems = this.obterEntradaItemComSaldoPorMaterial(materialConsumo.getId()); | |
204 | + /*Collection<EntradaAlmoxarifadoItem> entradaAlmoxarifadoItems = this.obterEntradaItemComSaldoPorMaterial(materialConsumo.getId()); | |
204 | 205 | |
205 | 206 | for (EntradaAlmoxarifadoItem itemEntrada : entradaAlmoxarifadoItems) { |
206 | 207 | if (itemEntrada.getQuantidadeSaldo().compareTo(quantidadeMovimentada) > 0) { |
... | ... | @@ -219,19 +220,20 @@ public class EntradaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<Entra |
219 | 220 | itemEntrada.setQuantidadeSaldo(BigDecimal.ZERO); |
220 | 221 | this.save(itemEntrada); |
221 | 222 | } |
222 | - } | |
223 | + }*/ | |
223 | 224 | |
224 | 225 | return retorno; |
225 | 226 | } |
226 | 227 | |
227 | 228 | /** |
228 | 229 | * {@inheritDoc} |
230 | + * TODO implementar com nova regra | |
229 | 231 | */ |
230 | 232 | @Override |
231 | 233 | public BigDecimal realizaMovimentoDevolucao(MaterialConsumo materialConsumo, BigDecimal quantidadeMovimentada) { |
232 | 234 | BigDecimal retorno = BigDecimal.ZERO; |
233 | 235 | |
234 | - Collection<EntradaAlmoxarifadoItem> entradaAlmoxarifadoItems = this.obterPorIdMaterial(materialConsumo.getId()); | |
236 | + /*Collection<EntradaAlmoxarifadoItem> entradaAlmoxarifadoItems = this.obterPorIdMaterial(materialConsumo.getId()); | |
235 | 237 | |
236 | 238 | for (EntradaAlmoxarifadoItem itemEntrada : entradaAlmoxarifadoItems) { |
237 | 239 | if (itemEntrada.getQuantidadeSaldo().compareTo(itemEntrada.getQuantidade()) < 0) { //Se a entrada tiver espaço eu realizo devolução na mesma |
... | ... | @@ -252,7 +254,7 @@ public class EntradaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<Entra |
252 | 254 | quantidadeMovimentada = quantidadeMovimentada.subtract(qntAMovimentar); |
253 | 255 | } |
254 | 256 | } |
255 | - } | |
257 | + }*/ | |
256 | 258 | |
257 | 259 | return retorno; |
258 | 260 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/EntradaAlmoxarifadoServiceImpl.java
1 | 1 | package br.com.centralit.api.service.impl; |
2 | 2 | |
3 | -import java.math.BigDecimal; | |
4 | 3 | import java.util.HashMap; |
5 | 4 | import java.util.Map; |
6 | 5 | |
... | ... | @@ -12,9 +11,9 @@ import org.springframework.validation.Validator; |
12 | 11 | import br.com.centralit.api.dao.EntradaAlmoxarifadoDao; |
13 | 12 | import br.com.centralit.api.model.BemAlmoxarifadoCaracteristica; |
14 | 13 | import br.com.centralit.api.model.EntradaAlmoxarifado; |
14 | +import br.com.centralit.api.model.EntradaAlmoxarifadoDocumento; | |
15 | 15 | import br.com.centralit.api.model.EntradaAlmoxarifadoItem; |
16 | -import br.com.centralit.api.model.EntradaDocumento; | |
17 | -import br.com.centralit.api.model.EntradaObservacao; | |
16 | +import br.com.centralit.api.model.EntradaAlmoxarifadoObservacao; | |
18 | 17 | import br.com.centralit.api.model.Fornecedor; |
19 | 18 | import br.com.centralit.api.service.ConfiguracaoParametroSistemaService; |
20 | 19 | import br.com.centralit.api.service.ContaContabilMovimentoService; |
... | ... | @@ -175,7 +174,7 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
175 | 174 | |
176 | 175 | } |
177 | 176 | |
178 | - for (EntradaAlmoxarifadoItem entradaAlmoxarifadoItem : entity.getEntradasIten()) { | |
177 | + for (EntradaAlmoxarifadoItem entradaAlmoxarifadoItem : entity.getEntradasItem()) { | |
179 | 178 | |
180 | 179 | entradaAlmoxarifadoItem.setMaterial(this.materialConsumoService.find(entradaAlmoxarifadoItem.getMaterial().getId())); |
181 | 180 | |
... | ... | @@ -183,10 +182,6 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
183 | 182 | |
184 | 183 | entradaAlmoxarifadoItem.setEntrada(entity); |
185 | 184 | |
186 | - entradaAlmoxarifadoItem.setQuantidadeSaldo(entradaAlmoxarifadoItem.getQuantidade()); | |
187 | - | |
188 | - this.calcularSobra(entradaAlmoxarifadoItem); | |
189 | - | |
190 | 185 | for (BemAlmoxarifadoCaracteristica bemAlmoxarifadoCaracteristica : entradaAlmoxarifadoItem.getCaracteristicas()) { |
191 | 186 | |
192 | 187 | bemAlmoxarifadoCaracteristica.setMaterialCaracteristica(this.materialCaracteristicaService.find(bemAlmoxarifadoCaracteristica.getMaterialCaracteristica().getId())); |
... | ... | @@ -198,7 +193,7 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
198 | 193 | |
199 | 194 | } |
200 | 195 | |
201 | - for (EntradaObservacao entradaObservacao : entity.getObservacoes()) { | |
196 | + for (EntradaAlmoxarifadoObservacao entradaObservacao : entity.getObservacoes()) { | |
202 | 197 | |
203 | 198 | entradaObservacao.setAutor(this.usuarioService.find(entradaObservacao.getAutor().getId())); |
204 | 199 | |
... | ... | @@ -206,7 +201,7 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
206 | 201 | |
207 | 202 | } |
208 | 203 | |
209 | - for (EntradaDocumento entradaDocumento : entity.getDocumentos()) { | |
204 | + for (EntradaAlmoxarifadoDocumento entradaDocumento : entity.getDocumentos()) { | |
210 | 205 | |
211 | 206 | entradaDocumento.setDominioTipoDocumento(this.dominioService.find(entradaDocumento.getDominioTipoDocumento().getId())); |
212 | 207 | |
... | ... | @@ -221,22 +216,6 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
221 | 216 | } |
222 | 217 | |
223 | 218 | /** |
224 | - * Método responsável por | |
225 | - * | |
226 | - * @author wilker.machado | |
227 | - * | |
228 | - * @param entradaAlmoxarifadoItem | |
229 | - */ | |
230 | - private void calcularSobra(EntradaAlmoxarifadoItem entradaAlmoxarifadoItem) { | |
231 | - | |
232 | - entradaAlmoxarifadoItem.setValorUnitario(entradaAlmoxarifadoItem.getValorTotal().divide(entradaAlmoxarifadoItem.getQuantidade(), 4, BigDecimal.ROUND_HALF_UP)); | |
233 | - | |
234 | - BigDecimal valorUnitarioXquantidade = entradaAlmoxarifadoItem.getQuantidade().multiply(entradaAlmoxarifadoItem.getValorUnitario()); | |
235 | - | |
236 | - entradaAlmoxarifadoItem.setValorSobra(entradaAlmoxarifadoItem.getValorTotal().subtract(valorUnitarioXquantidade)); | |
237 | - } | |
238 | - | |
239 | - /** | |
240 | 219 | * Método responsável por validar se a data de recebimento e menor que a data de cadastro da entrada |
241 | 220 | * |
242 | 221 | * @author wilker.machado |
... | ... | @@ -284,7 +263,7 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
284 | 263 | |
285 | 264 | this.movimentoEstoqueService.removerMovimentosEntrada(entity); |
286 | 265 | |
287 | - this.contaContabilMovimentoService.removerMovimentosEntrada(entity); | |
266 | + this.contaContabilMovimentoService.removerMovimentosEntradaAlmoxarifado(entity.getId()); | |
288 | 267 | |
289 | 268 | return super.remove(entity); |
290 | 269 | |
... | ... | @@ -335,7 +314,7 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
335 | 314 | EntradaAlmoxarifado entradaAlmoxarifado = this.find(idEntrada); |
336 | 315 | Map<String, String> listaValoresDocumento = new HashMap<String, String>(); |
337 | 316 | if(!UtilColecao.isVazio(entradaAlmoxarifado.getDocumentos())){ |
338 | - for (EntradaDocumento documento : entradaAlmoxarifado.getDocumentos()) { | |
317 | + for (EntradaAlmoxarifadoDocumento documento : entradaAlmoxarifado.getDocumentos()) { | |
339 | 318 | if(documento.getDominioTipoDocumento().getChave().equalsIgnoreCase(Dominio.TIPO_DOCUMENTO)){ |
340 | 319 | if(documento.getDominioTipoDocumento().getCodigo().longValue() == Dominio.CODIGO_DOCUMENTO_EMPENHO){ |
341 | 320 | listaValoresDocumento.put("empenho", documento.getNumero()); | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/EstruturaOrganizacionalAlmoxarifadoServiceImpl.java
... | ... | @@ -13,7 +13,7 @@ import br.com.centralit.api.model.EstruturaOrganizacionalAlmoxarifado; |
13 | 13 | import br.com.centralit.api.service.CentroCustoService; |
14 | 14 | import br.com.centralit.api.service.EstruturaOrganizacionalAlmoxarifadoService; |
15 | 15 | import br.com.centralit.api.service.EstruturaOrganizacionalService; |
16 | -import br.com.centralit.api.service.LocalEstoqueService; | |
16 | +import br.com.centralit.api.service.MaterialLocalEstoqueService; | |
17 | 17 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
18 | 18 | import br.com.centralit.framework.util.UtilObjeto; |
19 | 19 | |
... | ... | @@ -61,7 +61,7 @@ public class EstruturaOrganizacionalAlmoxarifadoServiceImpl extends GenericServi |
61 | 61 | |
62 | 62 | /** Atributo localEstoqueService. */ |
63 | 63 | @Autowired |
64 | - private LocalEstoqueService localEstoqueService; | |
64 | + private MaterialLocalEstoqueService localEstoqueService; | |
65 | 65 | |
66 | 66 | /** Atributo centroCustoService. */ |
67 | 67 | @Autowired |
... | ... | @@ -84,10 +84,6 @@ public class EstruturaOrganizacionalAlmoxarifadoServiceImpl extends GenericServi |
84 | 84 | |
85 | 85 | EstruturaOrganizacionalAlmoxarifado entitySaved = super.save(estruturaOrganizacionalAlmoxarifado); |
86 | 86 | |
87 | - if (entitySaved.getIsAlmoxarifado()){ | |
88 | - localEstoqueService.saveLocalEstoqueAlmoxarifado(String.valueOf(entitySaved.getEstruturaOrganizacional().getId())); | |
89 | - } | |
90 | - | |
91 | 87 | return entitySaved; |
92 | 88 | } |
93 | 89 | |
... | ... | @@ -100,10 +96,6 @@ public class EstruturaOrganizacionalAlmoxarifadoServiceImpl extends GenericServi |
100 | 96 | |
101 | 97 | EstruturaOrganizacionalAlmoxarifado entitySaved = super.save(estruturaOrganizacionalAlmoxarifado); |
102 | 98 | |
103 | - if (entitySaved.getIsAlmoxarifado()){ | |
104 | - localEstoqueService.saveLocalEstoqueAlmoxarifado(String.valueOf(entitySaved.getEstruturaOrganizacional().getId())); | |
105 | - } | |
106 | - | |
107 | 99 | return entitySaved; |
108 | 100 | } |
109 | 101 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/LocalEstoqueServiceImpl.java
1 | 1 | package br.com.centralit.api.service.impl; |
2 | 2 | |
3 | -import java.util.ArrayList; | |
4 | - | |
5 | 3 | import org.springframework.beans.factory.annotation.Autowired; |
6 | 4 | import org.springframework.beans.factory.annotation.Qualifier; |
7 | 5 | import org.springframework.stereotype.Service; |
... | ... | @@ -9,17 +7,13 @@ import org.springframework.validation.Validator; |
9 | 7 | |
10 | 8 | import br.com.centralit.api.dao.LocalEstoqueDao; |
11 | 9 | import br.com.centralit.api.model.EstruturaOrganizacional; |
12 | -import br.com.centralit.api.model.LocalEstoque; | |
13 | -import br.com.centralit.api.model.MaterialEstoqueSaldo; | |
10 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
14 | 11 | import br.com.centralit.api.service.EstruturaOrganizacionalService; |
15 | -import br.com.centralit.api.service.LocalEstoqueService; | |
12 | +import br.com.centralit.api.service.MaterialLocalEstoqueService; | |
16 | 13 | import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; |
17 | -import br.com.centralit.framework.util.UtilObjeto; | |
18 | - | |
19 | -import com.google.common.base.Strings; | |
20 | 14 | |
21 | 15 | @Service("localEstoqueService") |
22 | -public class LocalEstoqueServiceImpl extends GenericServiceImpl<LocalEstoque, Long> implements LocalEstoqueService { | |
16 | +public class LocalEstoqueServiceImpl extends GenericServiceImpl<MaterialLocalEstoque, Long> implements MaterialLocalEstoqueService { | |
23 | 17 | |
24 | 18 | /** Atributo localEstoqueDao. */ |
25 | 19 | private LocalEstoqueDao localEstoqueDao; |
... | ... | @@ -36,7 +30,7 @@ public class LocalEstoqueServiceImpl extends GenericServiceImpl<LocalEstoque, Lo |
36 | 30 | } |
37 | 31 | |
38 | 32 | @Override |
39 | - public LocalEstoque save(LocalEstoque entity) { | |
33 | + public MaterialLocalEstoque save(MaterialLocalEstoque entity) { | |
40 | 34 | |
41 | 35 | this.validarEntidade(entity, this.validator); |
42 | 36 | |
... | ... | @@ -44,7 +38,7 @@ public class LocalEstoqueServiceImpl extends GenericServiceImpl<LocalEstoque, Lo |
44 | 38 | } |
45 | 39 | |
46 | 40 | @Override |
47 | - public LocalEstoque merge(LocalEstoque entity) { | |
41 | + public MaterialLocalEstoque merge(MaterialLocalEstoque entity) { | |
48 | 42 | |
49 | 43 | this.validarEntidade(entity, this.validator); |
50 | 44 | |
... | ... | @@ -55,58 +49,9 @@ public class LocalEstoqueServiceImpl extends GenericServiceImpl<LocalEstoque, Lo |
55 | 49 | * {@inheritDoc} |
56 | 50 | */ |
57 | 51 | @Override |
58 | - public LocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado) { | |
52 | + public MaterialLocalEstoque buscarLocalEstoque(EstruturaOrganizacional almoxarifado) { | |
59 | 53 | |
60 | 54 | return this.localEstoqueDao.buscarLocalEstoque(almoxarifado); |
61 | 55 | } |
62 | - | |
63 | - /** | |
64 | - * <p> | |
65 | - * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
66 | - * </p> | |
67 | - * | |
68 | - * <p> | |
69 | - * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
70 | - * </p> | |
71 | - * | |
72 | - * Método responsável por salvar local estoque almoxarifado | |
73 | - * | |
74 | - * @author rogerio.cassimiro | |
75 | - * | |
76 | - * @param idEstruturaAlmoxarifado | |
77 | - * @return LocalEstoque | |
78 | - */ | |
79 | - @Override | |
80 | - public LocalEstoque saveLocalEstoqueAlmoxarifado(String idEstruturaAlmoxarifado) { | |
81 | - | |
82 | - if(!Strings.isNullOrEmpty(idEstruturaAlmoxarifado)) { | |
83 | - | |
84 | - EstruturaOrganizacional almoxarifado = this.estruturaOrganizacionalService.getReference(Long.parseLong(idEstruturaAlmoxarifado)); | |
85 | - | |
86 | - if(UtilObjeto.isReferencia(almoxarifado)) { | |
87 | - | |
88 | - LocalEstoque localEstoque = this.buscarLocalEstoque(almoxarifado); | |
89 | - | |
90 | - if (localEstoque == null) { | |
91 | - | |
92 | - localEstoque = new LocalEstoque(); | |
93 | - localEstoque.setHistoricoSaldo(new ArrayList<MaterialEstoqueSaldo>()); | |
94 | - | |
95 | - } else { | |
96 | - | |
97 | - localEstoque.setHistoricoSaldo(null); | |
98 | - } | |
99 | - | |
100 | - localEstoque.setAlmoxarifado(almoxarifado); | |
101 | - | |
102 | - return this.save(localEstoque); | |
103 | - | |
104 | - } | |
105 | - | |
106 | - } | |
107 | - | |
108 | - return null; | |
109 | - | |
110 | - } | |
111 | 56 | |
112 | 57 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/MaterialEstoqueSaldoMedioServiceImpl.java
... | ... | @@ -1,161 +0,0 @@ |
1 | -package br.com.centralit.api.service.impl; | |
2 | - | |
3 | -import java.math.BigDecimal; | |
4 | - | |
5 | -import org.springframework.beans.factory.annotation.Autowired; | |
6 | -import org.springframework.beans.factory.annotation.Qualifier; | |
7 | -import org.springframework.stereotype.Service; | |
8 | -import org.springframework.validation.Validator; | |
9 | - | |
10 | -import br.com.centralit.api.dao.MaterialEstoqueSaldoMedioDao; | |
11 | -import br.com.centralit.api.model.Material; | |
12 | -import br.com.centralit.api.model.MaterialConsumo; | |
13 | -import br.com.centralit.api.model.MaterialEstoqueSaldoMedio; | |
14 | -import br.com.centralit.api.service.MaterialConsumoService; | |
15 | -import br.com.centralit.api.service.MaterialEstoqueSaldoMedioService; | |
16 | -import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
17 | -import br.com.centralit.framework.util.UtilObjeto; | |
18 | - | |
19 | -/** | |
20 | - * <p> | |
21 | - * <img src="http://centralit.com.br/images/logo_central.png"> | |
22 | - * </p> | |
23 | - * | |
24 | - * <p> | |
25 | - * <b>Company: </b> Central IT - Governança Corporativa - | |
26 | - * </p> | |
27 | - * | |
28 | - * <p> | |
29 | - * <b>Title: </b> | |
30 | - * </p> | |
31 | - * | |
32 | - * <p> | |
33 | - * <b>Description: </b> | |
34 | - * </p> | |
35 | - * | |
36 | - * @since 23/06/2015 - 17:53:30 | |
37 | - * | |
38 | - * @version 1.0.0 | |
39 | - * | |
40 | - * @author geovane.filho | |
41 | - * | |
42 | - */ | |
43 | -@Service("materialEstoqueSaldoMedioService") | |
44 | -public class MaterialEstoqueSaldoMedioServiceImpl extends GenericServiceImpl<MaterialEstoqueSaldoMedio, Long> implements MaterialEstoqueSaldoMedioService { | |
45 | - | |
46 | - @Autowired | |
47 | - private MaterialEstoqueSaldoMedioDao materialEstoqueSaldoMedioDao; | |
48 | - | |
49 | - @Autowired | |
50 | - private MaterialConsumoService materialConsumoService; | |
51 | - | |
52 | - /** | |
53 | - * Responsável pela criação de novas instâncias desta classe. | |
54 | - * | |
55 | - * @param entradaAlmoxarifadoDao | |
56 | - * @param validator | |
57 | - */ | |
58 | - @Autowired | |
59 | - public MaterialEstoqueSaldoMedioServiceImpl( MaterialEstoqueSaldoMedioDao materialEstoqueSaldoMedioDao, @Qualifier("materialEstoqueSaldoMedioValidator") Validator validator ) { | |
60 | - this.dao = materialEstoqueSaldoMedioDao; | |
61 | - this.materialEstoqueSaldoMedioDao = materialEstoqueSaldoMedioDao; | |
62 | - this.validator = validator; | |
63 | - } | |
64 | - | |
65 | - /** | |
66 | - * {@inheritDoc} | |
67 | - */ | |
68 | - @Override | |
69 | - public void atualizaMaterialEstoque(Material material, BigDecimal quantidade, BigDecimal valorTotal) { | |
70 | - MaterialEstoqueSaldoMedio saldoMedio = this.materialEstoqueSaldoMedioDao.findByMaterial(material); | |
71 | - if (saldoMedio == null) { | |
72 | - saldoMedio = new MaterialEstoqueSaldoMedio(material); | |
73 | - } | |
74 | - | |
75 | - BigDecimal qntAtual = saldoMedio.getQuantidadeAtual(); | |
76 | - BigDecimal valorTotalAtual = BigDecimal.ZERO; | |
77 | - if(UtilObjeto.isReferencia(saldoMedio.getValorUnitarioMedio()) && UtilObjeto.isReferencia(saldoMedio.getRestoMedio())) { | |
78 | - valorTotalAtual = saldoMedio.getValorUnitarioMedio().multiply(saldoMedio.getQuantidadeAtual()).add(saldoMedio.getRestoMedio()); | |
79 | - } | |
80 | - | |
81 | - BigDecimal qntNova = qntAtual.add(quantidade); | |
82 | - BigDecimal valorTotalNovo = valorTotalAtual.add(valorTotal); | |
83 | - | |
84 | - BigDecimal valorUnitarioNovo = valorTotalNovo.divide(qntNova, 4, BigDecimal.ROUND_HALF_UP); | |
85 | - | |
86 | - BigDecimal valorUnitXquantidade = qntNova.multiply(valorUnitarioNovo); | |
87 | - BigDecimal valorRestoNovo = valorTotalNovo.subtract(valorUnitXquantidade); | |
88 | - | |
89 | - | |
90 | - saldoMedio.setQuantidadeAtual(qntNova); | |
91 | - saldoMedio.setValorUnitarioMedio(valorUnitarioNovo); | |
92 | - saldoMedio.setRestoMedio(valorRestoNovo); | |
93 | - | |
94 | - this.materialEstoqueSaldoMedioDao.save(saldoMedio); | |
95 | - } | |
96 | - | |
97 | - /** | |
98 | - * {@inheritDoc} | |
99 | - */ | |
100 | - @Override | |
101 | - public MaterialEstoqueSaldoMedio findByMaterial(Material idMaterial) { | |
102 | - return this.materialEstoqueSaldoMedioDao.findByMaterial(idMaterial); | |
103 | - } | |
104 | - | |
105 | - /** | |
106 | - * {@inheritDoc} | |
107 | - */ | |
108 | - @Override | |
109 | - public BigDecimal realizaMovimentoSaida(MaterialConsumo materialConsumo, BigDecimal quantidadeMovimentada) { | |
110 | - BigDecimal retorno = BigDecimal.ZERO; | |
111 | - | |
112 | - MaterialEstoqueSaldoMedio estoqueMedio = this.findByMaterial(materialConsumo); //Busco o saldo de estoque baseado na média móvel | |
113 | - | |
114 | - if (estoqueMedio.getQuantidadeAtual().compareTo(quantidadeMovimentada) > 0) { | |
115 | - retorno = retorno.add(estoqueMedio.getValorUnitarioMedio().multiply(quantidadeMovimentada)); | |
116 | - estoqueMedio.setQuantidadeAtual(estoqueMedio.getQuantidadeAtual().subtract(quantidadeMovimentada)); | |
117 | - this.save(estoqueMedio); | |
118 | - } else { | |
119 | - if(estoqueMedio.getValorUnitarioMedio() != null && estoqueMedio.getRestoMedio() != null){ | |
120 | - retorno = retorno.add((estoqueMedio.getValorUnitarioMedio().multiply(quantidadeMovimentada)).add(estoqueMedio.getRestoMedio())); | |
121 | - } | |
122 | - estoqueMedio.setQuantidadeAtual(estoqueMedio.getQuantidadeAtual().subtract(quantidadeMovimentada)); | |
123 | - this.save(estoqueMedio); | |
124 | - } | |
125 | - | |
126 | - return retorno; | |
127 | - } | |
128 | - | |
129 | - /** | |
130 | - * {@inheritDoc} | |
131 | - */ | |
132 | - @Override | |
133 | - public BigDecimal realizaMovimentoDevolucao(MaterialConsumo materialConsumo, BigDecimal quantidadeMovimentada) { | |
134 | - BigDecimal retorno = BigDecimal.ZERO; | |
135 | - | |
136 | - MaterialEstoqueSaldoMedio estoqueMedio = this.findByMaterial(materialConsumo); //Busco o saldo de estoque baseado na média móvel | |
137 | - | |
138 | - retorno = retorno.add(estoqueMedio.getValorUnitarioMedio().multiply(quantidadeMovimentada)); //Gero o valor monetario da movimentação sendo realizada | |
139 | - | |
140 | - if (estoqueMedio.getQuantidadeAtual().equals(BigDecimal.ZERO)) { //Se o saldo atual da quantidade em estoque for zero eu adiciono o resto na movimentação | |
141 | - retorno = retorno.add(estoqueMedio.getRestoMedio()); | |
142 | - } | |
143 | - | |
144 | - estoqueMedio.setQuantidadeAtual(estoqueMedio.getQuantidadeAtual().add(quantidadeMovimentada)); //Atualizo a quantidade atual do estoque | |
145 | - this.save(estoqueMedio); | |
146 | - | |
147 | - return retorno; | |
148 | - } | |
149 | - | |
150 | - public BigDecimal buscaValorUnitario(Long materialId){ | |
151 | - BigDecimal retorno = BigDecimal.ZERO; | |
152 | - retorno = this.materialEstoqueSaldoMedioDao.buscaValorUnitario(materialId); | |
153 | - return retorno; | |
154 | - } | |
155 | - | |
156 | - public BigDecimal buscaValorResto(Long materialId){ | |
157 | - BigDecimal retorno = BigDecimal.ZERO; | |
158 | - retorno = this.materialEstoqueSaldoMedioDao.buscaValorResto(materialId); | |
159 | - return retorno; | |
160 | - } | |
161 | -} |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/MaterialEstoqueServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +package br.com.centralit.api.service.impl; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.beans.factory.annotation.Qualifier; | |
5 | +import org.springframework.stereotype.Service; | |
6 | +import org.springframework.validation.Validator; | |
7 | + | |
8 | +import br.com.centralit.api.dao.MaterialEstoqueDao; | |
9 | +import br.com.centralit.api.model.MaterialEstoque; | |
10 | +import br.com.centralit.api.service.MaterialEstoqueService; | |
11 | +import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
12 | + | |
13 | +@Service("materialEstoqueService") | |
14 | +public class MaterialEstoqueServiceImpl extends GenericServiceImpl<MaterialEstoque, Long> implements MaterialEstoqueService { | |
15 | + | |
16 | + private MaterialEstoqueDao materialEstoqueDao; | |
17 | + | |
18 | + @Autowired | |
19 | + public MaterialEstoqueServiceImpl(MaterialEstoqueDao materialEstoqueDao, @Qualifier("materialEstoqueValidator") Validator validator) { | |
20 | + this.dao = materialEstoqueDao; | |
21 | + this.materialEstoqueDao = materialEstoqueDao; | |
22 | + this.validator = validator; | |
23 | + } | |
24 | +} | ... | ... |
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; |
... | ... | @@ -26,17 +27,17 @@ import br.com.centralit.api.model.DominioMaterial; |
26 | 27 | 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 | -import br.com.centralit.api.model.LocalEstoque; | |
30 | 30 | import br.com.centralit.api.model.MaterialConsumo; |
31 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
31 | 32 | import br.com.centralit.api.model.MovimentoEstoque; |
32 | 33 | import br.com.centralit.api.service.BaixaAlmoxarifadoItemService; |
33 | 34 | import br.com.centralit.api.service.ConfiguracaoParametroSistemaService; |
34 | 35 | import br.com.centralit.api.service.ContaContabilMovimentoService; |
35 | 36 | import br.com.centralit.api.service.DominioService; |
36 | 37 | import br.com.centralit.api.service.EntradaAlmoxarifadoItemService; |
37 | -import br.com.centralit.api.service.LocalEstoqueService; | |
38 | 38 | import br.com.centralit.api.service.MaterialConsumoService; |
39 | -import br.com.centralit.api.service.MaterialEstoqueSaldoMedioService; | |
39 | +import br.com.centralit.api.service.MaterialEstoqueService; | |
40 | +import br.com.centralit.api.service.MaterialLocalEstoqueService; | |
40 | 41 | import br.com.centralit.api.service.MovimentoEstoqueService; |
41 | 42 | import br.com.centralit.api.service.OrganizacaoService; |
42 | 43 | import br.com.centralit.framework.model.Dominio; |
... | ... | @@ -81,7 +82,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
81 | 82 | private MovimentoEstoqueDao movimentoEstoqueDao; |
82 | 83 | |
83 | 84 | @Autowired |
84 | - private LocalEstoqueService localEstoqueService; | |
85 | + private MaterialLocalEstoqueService materialLocalEstoqueService; | |
85 | 86 | |
86 | 87 | @Autowired |
87 | 88 | private DominioService dominioService; |
... | ... | @@ -89,9 +90,9 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
89 | 90 | /** Atributo entradaAlmoxarifadoItemService. */ |
90 | 91 | @Autowired |
91 | 92 | private EntradaAlmoxarifadoItemService entradaAlmoxarifadoItemService; |
92 | - | |
93 | + | |
93 | 94 | @Autowired |
94 | - private MaterialEstoqueSaldoMedioService materialEstoqueSaldoMedioService; | |
95 | + private MaterialEstoqueService materialEstoqueService; | |
95 | 96 | |
96 | 97 | /** Atributo baixaAlmoxarifadoItemService. */ |
97 | 98 | @Autowired |
... | ... | @@ -134,19 +135,25 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
134 | 135 | public void gerarMovimento(EntradaAlmoxarifado entradaAlmoxarifado) { |
135 | 136 | |
136 | 137 | Dominio tipoMovimentoEntrada = this.dominioService.findByChaveAndCodigo(DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE, DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE_ENTRADA); |
138 | + Dominio classeReferenciaEntItem = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ENTRADA_ALMOXARIFADO_ITEM); | |
137 | 139 | |
138 | 140 | List<MovimentoEstoque> movimentos = new ArrayList<MovimentoEstoque>(); |
139 | 141 | |
140 | - for (EntradaAlmoxarifadoItem entradaAlmoxarifadoItem : entradaAlmoxarifado.getEntradasIten()) { | |
142 | + for (EntradaAlmoxarifadoItem entradaAlmoxarifadoItem : entradaAlmoxarifado.getEntradasItem()) { | |
141 | 143 | |
142 | - MovimentoEstoque movimentoEstoque = new MovimentoEstoque(entradaAlmoxarifado.getDataRecebimento(), entradaAlmoxarifadoItem.getQuantidade(), entradaAlmoxarifadoItem.getValorTotal(), entradaAlmoxarifadoItem.getValorTotal(), tipoMovimentoEntrada); | |
144 | + MovimentoEstoque movimentoEstoque = new MovimentoEstoque(entradaAlmoxarifado.getDataRecebimento(), entradaAlmoxarifadoItem.getQuantidade(), entradaAlmoxarifadoItem.getValorTotal(), | |
145 | + entradaAlmoxarifadoItem.getValorTotal(), tipoMovimentoEntrada); | |
143 | 146 | |
144 | - movimentoEstoque.setEntradaAlmoxarifadoItem(entradaAlmoxarifadoItem); | |
145 | - movimentoEstoque.setLocalEstoque(this.localEstoqueService.buscarLocalEstoque(entradaAlmoxarifado.getAlmoxarifado())); | |
147 | + movimentoEstoque.setDominioClasseReferencia(classeReferenciaEntItem); | |
148 | + movimentoEstoque.setIdClasseReferencia(entradaAlmoxarifadoItem.getId()); | |
149 | + movimentoEstoque.setMaterialLocalEstoque(entradaAlmoxarifadoItem.getMaterialLocalEstoque()); | |
146 | 150 | movimentoEstoque.setMaterial(entradaAlmoxarifadoItem.getMaterial()); |
151 | + movimentoEstoque.setMaterialEstoque(entradaAlmoxarifadoItem.getMaterialLocalEstoque().getMaterialEstoque()); | |
152 | + | |
147 | 153 | movimentos.add(movimentoEstoque); |
148 | 154 | |
149 | - this.materialEstoqueSaldoMedioService.atualizaMaterialEstoque(movimentoEstoque.getMaterial(), movimentoEstoque.getQuantidade(), movimentoEstoque.getValorFIFO()); | |
155 | + //TODO Corrigir com nova versão | |
156 | + //this.materialEstoqueSaldoMedioService.atualizaMaterialEstoque(movimentoEstoque.getMaterial(), movimentoEstoque.getQuantidade(), movimentoEstoque.getValorFIFO()); | |
150 | 157 | Dominio tipoSaldoEntrada = new Dominio(); |
151 | 158 | if (UtilObjeto.isReferencia(entradaAlmoxarifado.getDominioTipoEntrada())){ |
152 | 159 | if (entradaAlmoxarifado.getDominioTipoEntrada().getCodigo() == Dominio.TIPO_ENTRADA_ALMOXARIFADO_EXTRA_ORCAMENTARIA_CODIGO){ |
... | ... | @@ -156,7 +163,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
156 | 163 | } |
157 | 164 | } |
158 | 165 | |
159 | - this.contaContabilMovimentoService.salvaMovimentoEntradaAlmoxarifado(entradaAlmoxarifadoItem.getMaterial().getContaContabil(), entradaAlmoxarifadoItem.getValorTotal(), entradaAlmoxarifadoItem.getId(), entradaAlmoxarifadoItem.getEntrada(), tipoSaldoEntrada); | |
166 | + this.contaContabilMovimentoService.salvaMovimentoEntradaAlmoxarifado(entradaAlmoxarifadoItem.getMaterial().getContaContabil(), entradaAlmoxarifadoItem.getValorTotal(), entradaAlmoxarifadoItem.getId(), tipoSaldoEntrada); | |
160 | 167 | } |
161 | 168 | |
162 | 169 | this.saveList(movimentos); |
... | ... | @@ -220,13 +227,22 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
220 | 227 | for (DevolucaoItem devolucaoItem : devolucao.getDevolucaoItens()) { |
221 | 228 | |
222 | 229 | BigDecimal valorMovimentoFIFO = this.entradaAlmoxarifadoItemService.realizaMovimentoDevolucao(devolucaoItem.getMaterialConsumo(), devolucaoItem.getQuantidade()); |
223 | - BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoDevolucao(devolucaoItem.getMaterialConsumo(), devolucaoItem.getQuantidade()); | |
224 | - | |
225 | - MovimentoEstoque movimentoEstoque = new MovimentoEstoque(devolucaoItem.getDevolucao().getDataDevolucao(), devolucaoItem.getQuantidade(), valorMovimentoFIFO, valorMovimentoMediaMovel, tipoMovimentoDevolucao); | |
226 | - | |
227 | - movimentoEstoque.setDevolucaoItem(devolucaoItem); | |
230 | + BigDecimal valorMovimentoMediaMovel = BigDecimal.ZERO;//BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoDevolucao(devolucaoItem.getMaterialConsumo(), devolucaoItem.getQuantidade()); | |
231 | + | |
232 | + | |
233 | + | |
234 | + MovimentoEstoque movimentoEstoque = new MovimentoEstoque(devolucaoItem.getDevolucao().getDataDevolucao(), devolucaoItem.getQuantidade(), valorMovimentoFIFO, valorMovimentoMediaMovel, | |
235 | + tipoMovimentoDevolucao); | |
236 | + | |
237 | + movimentoEstoque.setDominioClasseReferencia(classeReferenciaDevolucao); | |
238 | + movimentoEstoque.setIdClasseReferencia(devolucaoItem.getId()); | |
228 | 239 | |
229 | - movimentoEstoque.setLocalEstoque(this.localEstoqueService.buscarLocalEstoque(devolucao.getRequisicao().getAlmoxarifado())); | |
240 | + //TODO corrigir movimentação de devolução com versão nova | |
241 | + | |
242 | + /*movimentoEstoque.setLocalEstoque(this.materialLocalEstoqueService.buscarLocalEstoque(devolucao.getRequisicao().getAlmoxarifado())); | |
243 | + movimentoEstoque.setMaterialLocalEstoque(entradaAlmoxarifadoItem.getMaterialLocalEstoque()); | |
244 | + movimentoEstoque.setMaterial(entradaAlmoxarifadoItem.getMaterial()); | |
245 | + movimentoEstoque.setMaterialEstoque(entradaAlmoxarifadoItem.getMaterialLocalEstoque().getMaterialEstoque());*/ | |
230 | 246 | |
231 | 247 | movimentoEstoque.setMaterial(devolucaoItem.getMaterialConsumo()); |
232 | 248 | |
... | ... | @@ -266,17 +282,20 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
266 | 282 | |
267 | 283 | List<MovimentoEstoque> movimentos = new ArrayList<MovimentoEstoque>(); |
268 | 284 | |
269 | - LocalEstoque localEstoque = this.localEstoqueService.buscarLocalEstoque(baixaAlmoxarifado.getAlmoxarifado()); | |
285 | + MaterialLocalEstoque localEstoque = this.materialLocalEstoqueService.buscarLocalEstoque(baixaAlmoxarifado.getAlmoxarifado()); | |
270 | 286 | |
271 | 287 | for (BaixaAlmoxarifadoItem baixaAlmoxarifadoItem : baixaAlmoxarifado.getBaixaItens()) { |
272 | 288 | BigDecimal valorMovimentoFIFO = this.entradaAlmoxarifadoItemService.realizaMovimentoSaida(baixaAlmoxarifadoItem.getMaterialConsumo(), baixaAlmoxarifadoItem.getQuantidade()); |
273 | - BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoSaida(baixaAlmoxarifadoItem.getMaterialConsumo(), baixaAlmoxarifadoItem.getQuantidade()); | |
289 | + BigDecimal valorMovimentoMediaMovel = BigDecimal.ZERO;//BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoSaida(baixaAlmoxarifadoItem.getMaterialConsumo(), baixaAlmoxarifadoItem.getQuantidade()); | |
274 | 290 | |
275 | 291 | MovimentoEstoque movimentoEstoque = new MovimentoEstoque(baixaAlmoxarifadoItem.getBaixaAlmoxarifado().getDataBaixa(), baixaAlmoxarifadoItem.getQuantidade().multiply(BigDecimal.valueOf(-1)), |
276 | 292 | valorMovimentoFIFO.multiply(BigDecimal.valueOf(-1)), valorMovimentoMediaMovel.multiply(BigDecimal.valueOf(-1)), tipoMovimentoBaixa); |
277 | - movimentoEstoque.setBaixaAlmoxarifadoItem(baixaAlmoxarifadoItem); | |
293 | + | |
294 | + //TODO Corrigir movimento de baixa com versão nova | |
295 | + | |
296 | + /*movimentoEstoque.setBaixaAlmoxarifadoItem(baixaAlmoxarifadoItem); | |
278 | 297 | movimentoEstoque.setLocalEstoque(localEstoque); |
279 | - movimentoEstoque.setMaterial(baixaAlmoxarifadoItem.getMaterialConsumo()); | |
298 | + movimentoEstoque.setMaterial(baixaAlmoxarifadoItem.getMaterialConsumo());*/ | |
280 | 299 | |
281 | 300 | movimentos.add(movimentoEstoque); |
282 | 301 | |
... | ... | @@ -304,10 +323,13 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
304 | 323 | BigDecimal quantidade = movimentoEstoque.getQuantidade().abs(); |
305 | 324 | |
306 | 325 | this.entradaAlmoxarifadoItemService.realizaMovimentoDevolucao(material, quantidade); |
307 | - this.materialEstoqueSaldoMedioService.realizaMovimentoDevolucao(material, quantidade); | |
326 | + //this.materialEstoqueSaldoMedioService.realizaMovimentoDevolucao(material, quantidade); | |
308 | 327 | |
309 | 328 | Dominio classeReferencia = null; |
310 | 329 | Long idClasseReferencia = null; |
330 | + | |
331 | + //TODO corrigir remoção com nova versão de dominios | |
332 | + /* | |
311 | 333 | if (movimentoEstoque.getAtendimentoRequisicaoConsumoItem() != null) { |
312 | 334 | classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ATENDIMENTO_ALMOXARIFADO_ITEM); |
313 | 335 | idClasseReferencia = movimentoEstoque.getAtendimentoRequisicaoConsumoItem().getId(); |
... | ... | @@ -320,7 +342,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
320 | 342 | } else if (movimentoEstoque.getEntradaAlmoxarifadoItem() != null) { |
321 | 343 | classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ENTRADA_ALMOXARIFADO_ITEM); |
322 | 344 | idClasseReferencia = movimentoEstoque.getEntradaAlmoxarifadoItem().getId(); |
323 | - } | |
345 | + }*/ | |
324 | 346 | |
325 | 347 | ContaContabilMovimento movimento = this.contaContabilMovimentoService.findByContaAndClasseReferencia(material.getContaContabil(), classeReferencia, idClasseReferencia); |
326 | 348 | |
... | ... | @@ -364,14 +386,16 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
364 | 386 | } |
365 | 387 | |
366 | 388 | BigDecimal valorMovimentoFIFO = this.entradaAlmoxarifadoItemService.realizaMovimentoSaida(atendimentoRequisicaoConsumoItem.getMaterial(), atendimentoRequisicaoConsumoItem.getQuantidade()); |
367 | - BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoSaida(atendimentoRequisicaoConsumoItem.getMaterial(), atendimentoRequisicaoConsumoItem.getQuantidade()); | |
389 | + BigDecimal valorMovimentoMediaMovel = BigDecimal.ZERO;//BigDecimal valorMovimentoMediaMovel = this.materialEstoqueSaldoMedioService.realizaMovimentoSaida(atendimentoRequisicaoConsumoItem.getMaterial(), atendimentoRequisicaoConsumoItem.getQuantidade()); | |
368 | 390 | |
369 | 391 | MovimentoEstoque movimentoEstoque = new MovimentoEstoque(atendimento.getDataAtendimento(), atendimentoRequisicaoConsumoItem.getQuantidade().multiply(BigDecimal.valueOf(-1)), |
370 | 392 | valorMovimentoFIFO.multiply(BigDecimal.valueOf(-1)), valorMovimentoMediaMovel.multiply(BigDecimal.valueOf(-1)), tipoMovimento); //Movimentos negativos pois o valor esta saindo do estoque. |
371 | 393 | |
372 | - movimentoEstoque.setAtendimentoRequisicaoConsumoItem(atendimentoRequisicaoConsumoItem); | |
373 | - movimentoEstoque.setLocalEstoque(this.localEstoqueService.find(getUsuario().getOrganizacao().getId())); | |
374 | - movimentoEstoque.setMaterial(atendimentoRequisicaoConsumoItem.getMaterial()); | |
394 | + //TODO Corrigir movimento de atendimento com versão nova | |
395 | + | |
396 | + /*movimentoEstoque.setAtendimentoRequisicaoConsumoItem(atendimentoRequisicaoConsumoItem); | |
397 | + movimentoEstoque.setLocalEstoque(this.materialLocalEstoqueService.find(getUsuario().getOrganizacao().getId())); | |
398 | + movimentoEstoque.setMaterial(atendimentoRequisicaoConsumoItem.getMaterial());*/ | |
375 | 399 | |
376 | 400 | movimentos.add(movimentoEstoque); |
377 | 401 | |
... | ... | @@ -545,4 +569,12 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
545 | 569 | return this.movimentoEstoqueDao.buscaQuantidadeMovimentadaMaterialPorReferencia(materialId, dataReferencia, organizacaoId); |
546 | 570 | } |
547 | 571 | |
572 | + /** | |
573 | + * {@inheritDoc} | |
574 | + */ | |
575 | + @Override | |
576 | + public Collection<MovimentoEstoque> findAllByClasseReferencia(Dominio classeReferencia, Long idReferencia) { | |
577 | + return this.movimentoEstoqueDao.findAllByClasseReferencia(classeReferencia, idReferencia); | |
578 | + } | |
579 | + | |
548 | 580 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/validation/LocalEstoqueValidator.java
1 | 1 | package br.com.centralit.api.service.validation; |
2 | 2 | |
3 | -import br.com.centralit.api.model.LocalEstoque; | |
3 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
4 | 4 | import org.springframework.stereotype.Component; |
5 | 5 | import org.springframework.validation.Errors; |
6 | 6 | import org.springframework.validation.ValidationUtils; |
... | ... | @@ -14,7 +14,7 @@ public class LocalEstoqueValidator implements Validator { |
14 | 14 | @Override |
15 | 15 | public boolean supports(Class<?> clazz) { |
16 | 16 | |
17 | - return LocalEstoque.class.isAssignableFrom(clazz); | |
17 | + return MaterialLocalEstoque.class.isAssignableFrom(clazz); | |
18 | 18 | } |
19 | 19 | |
20 | 20 | @Override | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/validation/MaterialEstoqueSaldoMedioValidator.java
... | ... | @@ -1,33 +0,0 @@ |
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.MaterialEstoqueSaldoMedio; | |
9 | -import br.com.centralit.framework.exception.CodigoErro; | |
10 | - | |
11 | -@Component("materialEstoqueSaldoMedioValidator") | |
12 | -public class MaterialEstoqueSaldoMedioValidator implements Validator { | |
13 | - | |
14 | - @Override | |
15 | - public boolean supports(Class<?> clazz) { | |
16 | - | |
17 | - return MaterialEstoqueSaldoMedio.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 | - ValidationUtils.rejectIfEmpty(errors, "quantidadeAtual", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.QUANTIDADE_ATUAL"); | |
26 | - | |
27 | - ValidationUtils.rejectIfEmpty(errors, "valorUnitarioMedio", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.VALORUNITARIOMEDIO"); | |
28 | - | |
29 | - ValidationUtils.rejectIfEmpty(errors, "restoMedio", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.RESTOMEDIO"); | |
30 | - | |
31 | - } | |
32 | -} | |
33 | - |
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
... | ... | @@ -8,23 +8,23 @@ import org.springframework.web.bind.annotation.RequestParam; |
8 | 8 | import org.springframework.web.bind.annotation.ResponseBody; |
9 | 9 | |
10 | 10 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
11 | -import br.com.centralit.api.model.LocalEstoque; | |
11 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
12 | 12 | import br.com.centralit.api.model.MyMensagemRetorno; |
13 | 13 | import br.com.centralit.api.model.MyRetornoStatus; |
14 | -import br.com.centralit.api.service.LocalEstoqueService; | |
14 | +import br.com.centralit.api.service.MaterialLocalEstoqueService; | |
15 | 15 | import br.com.centralit.framework.controller.GenericController; |
16 | 16 | import br.com.centralit.framework.json.ResponseBodyWrapper; |
17 | 17 | import br.com.centralit.framework.util.UtilObjeto; |
18 | 18 | |
19 | 19 | @Controller |
20 | 20 | @RequestMapping("/rest/localEstoque") |
21 | -public class LocalEstoqueController extends GenericController<LocalEstoque> { | |
21 | +public class LocalEstoqueController extends GenericController<MaterialLocalEstoque> { | |
22 | 22 | |
23 | 23 | /** Atributo localEstoqueService. */ |
24 | - private LocalEstoqueService localEstoqueService; | |
24 | + private MaterialLocalEstoqueService localEstoqueService; | |
25 | 25 | |
26 | 26 | @Autowired |
27 | - public LocalEstoqueController( LocalEstoqueService localEstoqueService ) { | |
27 | + public LocalEstoqueController( MaterialLocalEstoqueService localEstoqueService ) { | |
28 | 28 | |
29 | 29 | super(localEstoqueService); |
30 | 30 | |
... | ... | @@ -36,41 +36,4 @@ public class LocalEstoqueController extends GenericController<LocalEstoque> { |
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 | - LocalEstoque 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 | } | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/MaterialEstoqueSaldoController.java
... | ... | @@ -11,8 +11,6 @@ import org.springframework.web.bind.annotation.ResponseBody; |
11 | 11 | |
12 | 12 | import br.com.centralit.api.model.Material; |
13 | 13 | import br.com.centralit.api.model.MaterialEstoqueSaldo; |
14 | -import br.com.centralit.api.model.MaterialEstoqueSaldoMedio; | |
15 | -import br.com.centralit.api.service.MaterialEstoqueSaldoMedioService; | |
16 | 14 | import br.com.centralit.api.service.MaterialEstoqueSaldoService; |
17 | 15 | import br.com.centralit.api.service.MovimentoEstoqueService; |
18 | 16 | import br.com.centralit.api.service.OrganizacaoService; |
... | ... | @@ -34,9 +32,6 @@ public class MaterialEstoqueSaldoController extends GenericController<MaterialEs |
34 | 32 | private MovimentoEstoqueService movimentoEstoqueService; |
35 | 33 | |
36 | 34 | @Autowired |
37 | - private MaterialEstoqueSaldoMedioService materialEstoqueSaldoMedioService; | |
38 | - | |
39 | - @Autowired | |
40 | 35 | public MaterialEstoqueSaldoController( MaterialEstoqueSaldoService materialEstoqueSaldoService ) { |
41 | 36 | |
42 | 37 | super(materialEstoqueSaldoService); |
... | ... | @@ -90,11 +85,12 @@ public class MaterialEstoqueSaldoController extends GenericController<MaterialEs |
90 | 85 | |
91 | 86 | Material material = new Material(); |
92 | 87 | material.setId(materialId); |
93 | - MaterialEstoqueSaldoMedio materialEstoqueSaldo = this.materialEstoqueSaldoMedioService.findByMaterial(material); | |
88 | + //MaterialEstoqueSaldoMedio materialEstoqueSaldo = this.materialEstoqueSaldoMedioService.findByMaterial(material); | |
94 | 89 | |
95 | - ResponseBodyWrapper responseBody = new ResponseBodyWrapper(materialEstoqueSaldo, Views.MaterialConsultaInfo.class); | |
90 | + //ResponseBodyWrapper responseBody = new ResponseBodyWrapper(materialEstoqueSaldo, Views.MaterialConsultaInfo.class); | |
96 | 91 | |
97 | - return responseBody; | |
92 | + //return responseBody; | |
93 | + return null; | |
98 | 94 | } |
99 | 95 | |
100 | 96 | } | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/MaterialEstoqueSaldoMedioController.java
... | ... | @@ -1,58 +0,0 @@ |
1 | -package br.com.centralit.controller; | |
2 | - | |
3 | -import java.math.BigDecimal; | |
4 | - | |
5 | -import org.springframework.beans.factory.annotation.Autowired; | |
6 | -import org.springframework.stereotype.Controller; | |
7 | -import org.springframework.web.bind.annotation.RequestMapping; | |
8 | -import org.springframework.web.bind.annotation.RequestMethod; | |
9 | -import org.springframework.web.bind.annotation.RequestParam; | |
10 | -import org.springframework.web.bind.annotation.ResponseBody; | |
11 | - | |
12 | -import br.com.centralit.api.model.Material; | |
13 | -import br.com.centralit.api.model.MaterialEstoqueSaldo; | |
14 | -import br.com.centralit.api.model.MaterialEstoqueSaldoMedio; | |
15 | -import br.com.centralit.api.service.MaterialEstoqueSaldoMedioService; | |
16 | -import br.com.centralit.api.service.MaterialEstoqueSaldoService; | |
17 | -import br.com.centralit.api.service.MovimentoEstoqueService; | |
18 | -import br.com.centralit.api.service.OrganizacaoService; | |
19 | -import br.com.centralit.framework.controller.GenericController; | |
20 | -import br.com.centralit.framework.json.ResponseBodyWrapper; | |
21 | -import br.com.centralit.framework.json.Views; | |
22 | -import br.com.centralit.framework.model.Organizacao; | |
23 | - | |
24 | -@Controller | |
25 | -@RequestMapping("/rest/materialEstoqueSaldoMedio") | |
26 | -public class MaterialEstoqueSaldoMedioController extends GenericController<MaterialEstoqueSaldoMedio> { | |
27 | - | |
28 | - private MaterialEstoqueSaldoMedioService materialEstoqueSaldoMedioService; | |
29 | - | |
30 | - @Autowired | |
31 | - private OrganizacaoService organizacaoService; | |
32 | - | |
33 | - @Autowired | |
34 | - private MovimentoEstoqueService movimentoEstoqueService; | |
35 | - | |
36 | - @Autowired | |
37 | - public MaterialEstoqueSaldoMedioController( MaterialEstoqueSaldoMedioService materialEstoqueSaldoMedioService ) { | |
38 | - | |
39 | - super(materialEstoqueSaldoMedioService); | |
40 | - this.materialEstoqueSaldoMedioService = materialEstoqueSaldoMedioService; | |
41 | - } | |
42 | - | |
43 | - @RequestMapping(value = "/buscaValorUnitario", method = RequestMethod.GET, produces = "application/json") | |
44 | - @ResponseBody | |
45 | - public BigDecimal buscaValorUnitario(@RequestParam(value = "materialId") Long materialId) { | |
46 | - | |
47 | - return this.materialEstoqueSaldoMedioService.buscaValorUnitario(materialId); | |
48 | - } | |
49 | - | |
50 | - @RequestMapping(value = "/buscaValorResto", method = RequestMethod.GET, produces = "application/json") | |
51 | - @ResponseBody | |
52 | - public BigDecimal buscaValorResto(@RequestParam(value = "materialId") Long materialId) { | |
53 | - | |
54 | - return this.materialEstoqueSaldoMedioService.buscaValorResto(materialId); | |
55 | - } | |
56 | - | |
57 | - | |
58 | -} |
cit-almoxarifado-web/src/main/resources/reports/entradaAlmoxarifado.jrxml
... | ... | @@ -29,19 +29,18 @@ |
29 | 29 | </box> |
30 | 30 | </style> |
31 | 31 | <subDataset name="New Dataset 1" uuid="6dbeeb5f-34bd-4536-9c6f-e65cbaf8240a"> |
32 | - <queryString language="SQL"> | |
33 | - <![CDATA[select ea.id as notaEntrada, | |
34 | - a.datacontabil as dataContabil, | |
35 | - d.nome as tipoEntrada, | |
36 | - p.nome as fornecedor, | |
37 | - eai.quantidade as quantidade, | |
38 | - eai.valorunitario as valorUnitario, | |
39 | - eai.valortotal as valorTotal | |
40 | - from entradaalmoxarifado ea | |
41 | - inner join entrada a on a.id = ea.id | |
42 | - inner join dominio d on d.id = a.dominiotipoentrada_id | |
43 | - inner join pessoa p on p.id = a.fornecedor_id | |
44 | - inner join entradaalmoxarifadoitem eai on eai.entrada_id = ea.id]]> | |
32 | + <queryString> | |
33 | + <![CDATA[SELECT ea.id AS notaEntrada, | |
34 | + ea.datacontabil AS dataContabil, | |
35 | + d.nome AS tipoEntrada, | |
36 | + p.nome AS fornecedor, | |
37 | + eai.quantidade AS quantidade, | |
38 | + eai.valorunitario AS valorUnitario, | |
39 | + eai.valortotal AS valorTotal | |
40 | +FROM entradaalmoxarifado ea | |
41 | + INNER JOIN dominio d ON d.id = ea.dominiotipoentrada_id | |
42 | + INNER JOIN pessoa p ON p.id = ea.fornecedor_id | |
43 | + INNER JOIN entradaalmoxarifadoitem eai ON eai.entrada_id = ea.id]]> | |
45 | 44 | </queryString> |
46 | 45 | <field name="notaentrada" class="java.lang.Long"/> |
47 | 46 | <field name="datacontabil" class="java.sql.Timestamp"/> |
... | ... | @@ -61,29 +60,30 @@ |
61 | 60 | <parameter name="idTipoRecebimento" class="java.lang.Long" isForPrompting="false"/> |
62 | 61 | <parameter name="nomeTipoRecebimento" class="java.lang.String"/> |
63 | 62 | <parameter name="query_filtro_tipoEntrada" class="java.lang.Long" isForPrompting="false"> |
64 | - <defaultValueExpression><![CDATA[($P{idTipoEntrada} == null ? " " : " and a.dominiotipoentrada_id = " + $P{idTipoEntrada} + " ")]]></defaultValueExpression> | |
63 | + <defaultValueExpression><![CDATA[($P{idTipoEntrada} == null ? " " : " and ea.dominiotipoentrada_id = " + $P{idTipoEntrada} + " ")]]></defaultValueExpression> | |
65 | 64 | </parameter> |
66 | 65 | <parameter name="query_filtro_tipoRecebimento" class="java.lang.String" isForPrompting="false"> |
67 | - <defaultValueExpression><![CDATA[($P{idTipoRecebimento} == null ? " " : " and a.dominiotiporecebimento_id = " + $P{idTipoRecebimento} + " ")]]></defaultValueExpression> | |
66 | + <defaultValueExpression><![CDATA[($P{idTipoRecebimento} == null ? " " : " and ea.dominiotiporecebimento_id = " + $P{idTipoRecebimento} + " ")]]></defaultValueExpression> | |
68 | 67 | </parameter> |
69 | 68 | <queryString> |
70 | - <![CDATA[select m.descricao as nomeMaterial, | |
71 | - ea.id as notaEntrada, | |
72 | - a.datacontabil as dataContabil, | |
73 | - d.descricao as tipoEntrada, | |
74 | - p.nome as fornecedor, | |
75 | - eai.quantidade as quantidade, | |
76 | - eai.valorunitario as valorUnitario, | |
77 | - eai.valortotal as valorTotal | |
78 | -from entradaalmoxarifado ea | |
79 | - inner join entrada a on a.id = ea.id and a.datainativo is null and a.datarecebimento between (TO_TIMESTAMP($P{dataInicio},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) and (TO_TIMESTAMP($P{dataFim},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) $P!{query_filtro_tipoEntrada} $P!{query_filtro_tipoRecebimento} | |
80 | - inner join dominio d on d.id = a.dominiotipoentrada_id | |
81 | - inner join parceiro parceiro on parceiro.id = a.fornecedor_id | |
82 | - inner join pessoa p on p.id = parceiro.pessoa_id | |
83 | - inner join entradaalmoxarifadoitem eai on eai.entrada_id = ea.id | |
84 | - inner join material m on m.id = eai.material_id and $X{IN,m.id,idsMateriais} | |
85 | -where ea.almoxarifado_id = $P{idAlmoxarifado} | |
86 | -order by nomeMaterial]]> | |
69 | + <![CDATA[SELECT m.descricao as nomeMaterial, | |
70 | + ea.id as notaEntrada, | |
71 | + ea.datacontabil as dataContabil, | |
72 | + d.descricao as tipoEntrada, | |
73 | + p.nome as fornecedor, | |
74 | + eai.quantidade as quantidade, | |
75 | + eai.valorunitario as valorUnitario, | |
76 | + eai.valortotal as valorTotal | |
77 | +FROM entradaalmoxarifado ea | |
78 | + INNER JOIN dominio d ON d.id = ea.dominiotipoentrada_id | |
79 | + INNER JOIN parceiro parceiro ON parceiro.id = ea.fornecedor_id | |
80 | + INNER JOIN pessoa p ON p.id = parceiro.pessoa_id | |
81 | + INNER JOIN entradaalmoxarifadoitem eai ON eai.entrada_id = ea.id | |
82 | + INNER JOIN material m ON m.id = eai.material_id AND $X{IN,m.id,idsMateriais} | |
83 | +WHERE ea.almoxarifado_id = $P{idAlmoxarifado} | |
84 | + AND ea.datarecebimento BETWEEN (TO_TIMESTAMP($P{dataInicio},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) AND (TO_TIMESTAMP($P{dataFim},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) | |
85 | + $P!{query_filtro_tipoEntrada} $P!{query_filtro_tipoRecebimento} | |
86 | +ORDER BY nomeMaterial]]> | |
87 | 87 | </queryString> |
88 | 88 | <field name="nomematerial" class="java.lang.String"/> |
89 | 89 | <field name="notaentrada" class="java.lang.Long"/> | ... | ... |
cit-almoxarifado-web/src/main/resources/reports/entradaMaterialAnaliticoEntrada.jrxml
... | ... | @@ -30,15 +30,15 @@ |
30 | 30 | <subDataset name="Documentos" uuid="261c7cba-602f-47c5-8ff0-0d489cec00a8"> |
31 | 31 | <parameter name="idEntrada" class="java.lang.Long"/> |
32 | 32 | <queryString> |
33 | - <![CDATA[select | |
34 | -ed.entrada_id as entradaid, | |
35 | -dm.descricao as tipodocumento, | |
36 | -d.numero as numerodocumento, | |
37 | -d.datacriacao as data | |
38 | -from entradadocumento ed | |
39 | -inner join documento d on ed.id = d.id | |
40 | -inner join dominio dm on d.dominiotipodocumento_id = dm.id | |
41 | -where ed.entrada_id = $P{idEntrada}]]> | |
33 | + <![CDATA[SELECT | |
34 | + ed.entrada_id AS entradaid, | |
35 | + dm.descricao AS tipodocumento, | |
36 | + d.numero AS numerodocumento, | |
37 | + d.datacriacao AS data | |
38 | +FROM entradaalmoxarifadodocumento ed | |
39 | + INNER JOIN documento d ON ed.id = d.id | |
40 | + INNER JOIN dominio dm ON d.dominiotipodocumento_id = dm.id | |
41 | +WHERE ed.entrada_id = $P{idEntrada}]]> | |
42 | 42 | </queryString> |
43 | 43 | <field name="entradaid" class="java.lang.Long"/> |
44 | 44 | <field name="tipodocumento" class="java.lang.String"/> |
... | ... | @@ -57,35 +57,35 @@ where ed.entrada_id = $P{idEntrada}]]> |
57 | 57 | <parameter name="dataInicio" class="java.lang.String" isForPrompting="false"/> |
58 | 58 | <parameter name="dataFim" class="java.lang.String" isForPrompting="false"/> |
59 | 59 | <queryString> |
60 | - <![CDATA[select | |
61 | - entrada.id as id, | |
62 | - entrada.codigo as notaEntrada, | |
63 | - entrada.datarecebimento as datarecebimento, | |
64 | - entrada.datacontabil as dataContabil, | |
65 | - dominio.descricao as tipoRecebimento, | |
66 | - pessoafisica.cpf as CPF, | |
67 | - pessoajuridica.cnpj as CNPJ, | |
68 | - pessoa.nome as fornecedor, | |
69 | - material.codigo as codigoMaterial, | |
70 | - material.descricao as nomeMaterial, | |
71 | - unidademedida.sigla as unidade, | |
72 | - contacontabil.codigo as contaContabil, | |
73 | - entradaalmoxarifadoitem.quantidade as quantidade, | |
74 | - entradaalmoxarifadoitem.valorunitario as valorUnitario, | |
75 | - entradaalmoxarifadoitem.valortotal as valorTotal | |
76 | -from entradaalmoxarifado entradaalmoxarifado | |
77 | - inner join entrada entrada on entrada.id = entradaalmoxarifado.id and entrada.datainativo is null and entrada.organizacao_id = $P{idOrganizacao} and entrada.datarecebimento between (TO_TIMESTAMP($P{dataInicio},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) and (TO_TIMESTAMP($P{dataFim},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) | |
78 | - inner join dominio dominio on dominio.id = entrada.dominiotiporecebimento_id | |
79 | - inner join parceiro parceiro on parceiro.id = entrada.fornecedor_id | |
80 | - inner join pessoa pessoa on pessoa.id = parceiro.pessoa_id | |
81 | - left join pessoajuridica pessoajuridica on pessoa.id = pessoajuridica.pessoa_id | |
82 | - left join pessoafisica pessoafisica on pessoa.id = pessoafisica.pessoa_id | |
83 | - inner join entradaalmoxarifadoitem entradaalmoxarifadoitem on entradaalmoxarifadoitem.entrada_id = entradaalmoxarifado.id | |
84 | - left join unidademedida unidademedida on entradaalmoxarifadoitem.unidademedidaentrada_id = unidademedida.id | |
85 | - inner join material material on material.id = entradaalmoxarifadoitem.material_id | |
86 | - left join contacontabil contacontabil on material.contacontabil_id = contacontabil.id | |
87 | -where entradaalmoxarifado.almoxarifado_id = $P{idAlmoxarifado} | |
88 | -order by notaEntrada]]> | |
60 | + <![CDATA[SELECT | |
61 | + entradaalmoxarifado.id AS id, | |
62 | + entradaalmoxarifado.codigo AS notaEntrada, | |
63 | + entradaalmoxarifado.datarecebimento AS datarecebimento, | |
64 | + entradaalmoxarifado.datacontabil AS dataContabil, | |
65 | + dominio.descricao AS tipoRecebimento, | |
66 | + pessoafisica.cpf AS CPF, | |
67 | + pessoajuridica.cnpj AS CNPJ, | |
68 | + pessoa.nome AS fornecedor, | |
69 | + material.codigo AS codigoMaterial, | |
70 | + material.descricao AS nomeMaterial, | |
71 | + unidademedida.sigla AS unidade, | |
72 | + contacontabil.codigo AS contaContabil, | |
73 | + entradaalmoxarifadoitem.quantidade AS quantidade, | |
74 | + entradaalmoxarifadoitem.valorunitario AS valorUnitario, | |
75 | + entradaalmoxarifadoitem.valortotal AS valorTotal | |
76 | +FROM entradaalmoxarifado entradaalmoxarifado | |
77 | + INNER JOIN dominio dominio ON dominio.id = entradaalmoxarifado.dominiotiporecebimento_id | |
78 | + INNER JOIN parceiro parceiro ON parceiro.id = entradaalmoxarifado.fornecedor_id | |
79 | + INNER JOIN pessoa pessoa ON pessoa.id = parceiro.pessoa_id | |
80 | + LEFT JOIN pessoajuridica pessoajuridica ON pessoa.id = pessoajuridica.pessoa_id | |
81 | + LEFT JOIN pessoafisica pessoafisica ON pessoa.id = pessoafisica.pessoa_id | |
82 | + INNER JOIN entradaalmoxarifadoitem entradaalmoxarifadoitem ON entradaalmoxarifadoitem.entrada_id = entradaalmoxarifado.id | |
83 | + LEFT JOIN unidademedida unidademedida ON entradaalmoxarifadoitem.unidademedidaentrada_id = unidademedida.id | |
84 | + INNER JOIN material material ON material.id = entradaalmoxarifadoitem.material_id | |
85 | + LEFT JOIN contacontabil contacontabil ON material.contacontabil_id = contacontabil.id | |
86 | +WHERE entradaalmoxarifado.almoxarifado_id = $P{idAlmoxarifado} AND entradaalmoxarifado.datainativo IS NULL AND entradaalmoxarifado.organizacao_id = $P{idOrganizacao} | |
87 | + AND entradaalmoxarifado.datarecebimento BETWEEN (TO_TIMESTAMP($P{dataInicio},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) AND (TO_TIMESTAMP($P{dataFim},'YYYY-MM-DD HH24:MI:SS')::timestamp without time zone) | |
88 | +ORDER BY notaEntrada]]> | |
89 | 89 | </queryString> |
90 | 90 | <field name="id" class="java.lang.Long"/> |
91 | 91 | <field name="notaentrada" class="java.lang.String"/> | ... | ... |
cit-almoxarifado-web/src/main/resources/reports/entradaMaterialNotaRecebimento.jrxml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="entradaMaterialAnaliticoEntrada" language="groovy" pageWidth="802" pageHeight="555" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="5ed15610-1772-4ec5-9238-b8bb4567a519"> |
3 | 3 | <property name="ireport.zoom" value="1.6500000000000008"/> |
4 | - <property name="ireport.x" value="192"/> | |
4 | + <property name="ireport.x" value="25"/> | |
5 | 5 | <property name="ireport.y" value="0"/> |
6 | 6 | <style name="table"> |
7 | 7 | <box> |
... | ... | @@ -34,19 +34,18 @@ |
34 | 34 | <defaultValueExpression><![CDATA[]]></defaultValueExpression> |
35 | 35 | </parameter> |
36 | 36 | <queryString> |
37 | - <![CDATA[select | |
38 | - contacontabil.codigo as contaContabil, | |
39 | - contacontabil.descricao as nomeConta, | |
40 | - sum(entradaalmoxarifadoitem.quantidade) as quantidade, | |
41 | - sum(entradaalmoxarifadoitem.valortotal) as valorTotal | |
42 | -from entradaalmoxarifado entradaalmoxarifado | |
43 | - inner join entrada entrada on entrada.id = entradaalmoxarifado.id | |
44 | - inner join entradaalmoxarifadoitem entradaalmoxarifadoitem on entradaalmoxarifadoitem.entrada_id = entradaalmoxarifado.id | |
45 | - inner join material material on material.id = entradaalmoxarifadoitem.material_id | |
46 | - left join contacontabil contacontabil on material.contacontabil_id = contacontabil.id | |
47 | -where entradaalmoxarifado.id = $P{idEntrada} | |
48 | -group by contacontabil, nomeConta | |
49 | -order by contacontabil]]> | |
37 | + <![CDATA[SELECT | |
38 | + contacontabil.codigo AS contaContabil, | |
39 | + contacontabil.descricao AS nomeConta, | |
40 | + sum(entradaalmoxarifadoitem.quantidade) AS quantidade, | |
41 | + sum(entradaalmoxarifadoitem.valortotal) AS valorTotal | |
42 | +FROM entradaalmoxarifado entradaalmoxarifado | |
43 | + INNER JOIN entradaalmoxarifadoitem entradaalmoxarifadoitem ON entradaalmoxarifadoitem.entrada_id = entradaalmoxarifado.id | |
44 | + INNER JOIN material material ON material.id = entradaalmoxarifadoitem.material_id | |
45 | + LEFT JOIN contacontabil contacontabil ON material.contacontabil_id = contacontabil.id | |
46 | +WHERE entradaalmoxarifado.id = $P{idEntrada} | |
47 | +GROUP BY contacontabil, nomeConta | |
48 | +ORDER BY contacontabil]]> | |
50 | 49 | </queryString> |
51 | 50 | <field name="contacontabil" class="java.lang.String"/> |
52 | 51 | <field name="nomeconta" class="java.lang.String"/> |
... | ... | @@ -66,39 +65,38 @@ order by contacontabil]]> |
66 | 65 | <parameter name="processoEntrada" class="java.lang.String"/> |
67 | 66 | <parameter name="cpf" class="java.lang.String"/> |
68 | 67 | <queryString> |
69 | - <![CDATA[select | |
70 | - estruturaorganizacional.nome as nomeAlmoxarifado, | |
71 | - entrada.id as id, | |
72 | - entrada.codigo as notaEntrada, | |
73 | - entrada.datarecebimento as datarecebimento, | |
74 | - entrada.datacontabil as dataContabil, | |
75 | - dominio.descricao as tipoRecebimento, | |
76 | - pessoafisica.cpf as CPF, | |
77 | - pessoajuridica.cnpj as CNPJ, | |
78 | - pessoa.nome as fornecedor, | |
79 | - material.codigo as codigoMaterial, | |
80 | - material.descricao as nomeMaterial, | |
81 | - unidademedida.sigla as unidade, | |
82 | - contacontabil.codigo as contaContabil, | |
83 | - entradaalmoxarifadoitem.quantidade as quantidade, | |
84 | - entradaalmoxarifadoitem.valorunitario as valorUnitario, | |
85 | - entradaalmoxarifadoitem.valortotal as valorTotal, | |
86 | - dominioFin.descricao as finalidadeCompra | |
87 | -from entradaalmoxarifado entradaalmoxarifado | |
88 | - inner join entrada entrada on entrada.id = entradaalmoxarifado.id | |
89 | - inner join dominio dominio on dominio.id = entrada.dominiotiporecebimento_id | |
90 | - inner join parceiro parceiro on parceiro.id = entrada.fornecedor_id | |
91 | - inner join pessoa pessoa on pessoa.id = parceiro.pessoa_id | |
92 | - left join pessoajuridica pessoajuridica on pessoa.id = pessoajuridica.pessoa_id | |
93 | - left join pessoafisica pessoafisica on pessoa.id = pessoafisica.pessoa_id | |
94 | - inner join entradaalmoxarifadoitem entradaalmoxarifadoitem on entradaalmoxarifadoitem.entrada_id = entradaalmoxarifado.id | |
95 | - LEFT join dominio dominioFin on dominioFin.id = entradaalmoxarifado.dominiofinalidade_id | |
96 | - left join unidademedida unidademedida on entradaalmoxarifadoitem.unidademedidaentrada_id = unidademedida.id | |
97 | - inner join material material on material.id = entradaalmoxarifadoitem.material_id | |
98 | - left join contacontabil contacontabil on material.contacontabil_id = contacontabil.id | |
99 | - inner join estruturaorganizacional estruturaorganizacional on entradaalmoxarifado.almoxarifado_id = estruturaorganizacional.id | |
100 | -where entradaalmoxarifado.id = $P{idEntrada} | |
101 | -order by notaEntrada]]> | |
68 | + <![CDATA[SELECT | |
69 | + estruturaorganizacional.nome AS nomeAlmoxarifado, | |
70 | + entradaalmoxarifado.id AS id, | |
71 | + entradaalmoxarifado.codigo AS notaEntrada, | |
72 | + entradaalmoxarifado.datarecebimento AS datarecebimento, | |
73 | + entradaalmoxarifado.datacontabil AS dataContabil, | |
74 | + dominio.descricao AS tipoRecebimento, | |
75 | + pessoafisica.cpf AS CPF, | |
76 | + pessoajuridica.cnpj AS CNPJ, | |
77 | + pessoa.nome AS fornecedor, | |
78 | + material.codigo AS codigoMaterial, | |
79 | + material.descricao AS nomeMaterial, | |
80 | + unidademedida.sigla AS unidade, | |
81 | + contacontabil.codigo AS contaContabil, | |
82 | + entradaalmoxarifadoitem.quantidade AS quantidade, | |
83 | + entradaalmoxarifadoitem.valorunitario AS valorUnitario, | |
84 | + entradaalmoxarifadoitem.valortotal AS valorTotal, | |
85 | + dominioFin.descricao AS finalidadeCompra | |
86 | +FROM entradaalmoxarifado entradaalmoxarifado | |
87 | + INNER JOIN dominio dominio ON dominio.id = entradaalmoxarifado.dominiotiporecebimento_id | |
88 | + INNER JOIN parceiro parceiro ON parceiro.id = entradaalmoxarifado.fornecedor_id | |
89 | + INNER JOIN pessoa pessoa ON pessoa.id = parceiro.pessoa_id | |
90 | + LEFT JOIN pessoajuridica pessoajuridica ON pessoa.id = pessoajuridica.pessoa_id | |
91 | + LEFT JOIN pessoafisica pessoafisica ON pessoa.id = pessoafisica.pessoa_id | |
92 | + INNER JOIN entradaalmoxarifadoitem entradaalmoxarifadoitem ON entradaalmoxarifadoitem.entrada_id = entradaalmoxarifado.id | |
93 | + LEFT JOIN dominio dominioFin ON dominioFin.id = entradaalmoxarifado.dominiofinalidade_id | |
94 | + LEFT JOIN unidademedida unidademedida ON entradaalmoxarifadoitem.unidademedidaentrada_id = unidademedida.id | |
95 | + INNER JOIN material material ON material.id = entradaalmoxarifadoitem.material_id | |
96 | + LEFT JOIN contacontabil contacontabil ON material.contacontabil_id = contacontabil.id | |
97 | + INNER JOIN estruturaorganizacional estruturaorganizacional ON entradaalmoxarifado.almoxarifado_id = estruturaorganizacional.id | |
98 | +WHERE entradaalmoxarifado.id = $P{idEntrada} | |
99 | +ORDER BY notaEntrada]]> | |
102 | 100 | </queryString> |
103 | 101 | <field name="nomealmoxarifado" class="java.lang.String"/> |
104 | 102 | <field name="id" class="java.lang.Long"/> | ... | ... |
cit-almoxarifado-web/src/test/java/br/com/centralit/controller/impl/LocalEstoqueControllerTest.java
... | ... | @@ -15,20 +15,20 @@ import br.com.centralit.framework.model.Filter; |
15 | 15 | import br.com.centralit.framework.model.SearchParams; |
16 | 16 | |
17 | 17 | import br.com.centralit.api.dao.LocalEstoqueDao; |
18 | -import br.com.centralit.api.model.LocalEstoque; | |
19 | -import br.com.centralit.api.service.LocalEstoqueService; | |
18 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
19 | +import br.com.centralit.api.service.MaterialLocalEstoqueService; | |
20 | 20 | import br.com.centralit.controller.LocalEstoqueController; |
21 | 21 | |
22 | 22 | @WebAppConfiguration |
23 | 23 | @ContextConfiguration("/spring/applicationContext-test.xml") |
24 | 24 | @RunWith(SpringJUnit4ClassRunner.class) |
25 | -public class LocalEstoqueControllerTest extends GenericControllerTestImpl<LocalEstoque> { | |
25 | +public class LocalEstoqueControllerTest extends GenericControllerTestImpl<MaterialLocalEstoque> { | |
26 | 26 | |
27 | 27 | @Mock |
28 | 28 | private LocalEstoqueController localEstoqueController; |
29 | 29 | |
30 | 30 | @Autowired |
31 | - private LocalEstoqueService localEstoqueService; | |
31 | + private MaterialLocalEstoqueService localEstoqueService; | |
32 | 32 | |
33 | 33 | @Autowired |
34 | 34 | private LocalEstoqueDao localEstoqueDao; | ... | ... |