Commit 51a91f60b7f24ee2da8e4c0d3b9f467285a0d04c
1 parent
fc244a73
Exists in
master
[Redmine Atendimento #4740]Endereço Estoque
Showing
24 changed files
with
1654 additions
and
6 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/EnderecoEstoqueDao.java
0 → 100644
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/EstoqueDao.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.com.centralit.api.dao; | |
2 | + | |
3 | +import br.com.centralit.api.model.Estoque; | |
4 | +import br.com.centralit.framework.dao.arquitetura.CitGenericDAO; | |
5 | + | |
6 | +public interface EstoqueDao extends CitGenericDAO { | |
7 | + | |
8 | + Estoque findEstoquePorAlmoxarifadoId(Long idAlmoxarifado);} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/impl/EnderecoEstoqueDaoHibernate.java
0 → 100644
... | ... | @@ -0,0 +1,43 @@ |
1 | +package br.com.centralit.api.dao.impl; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.stereotype.Repository; | |
6 | + | |
7 | +import br.com.centralit.api.dao.EnderecoEstoqueDao; | |
8 | +import br.com.centralit.api.model.EnderecoEstoque; | |
9 | +import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | |
10 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | |
11 | +import br.com.centralit.framework.model.arquitetura.PersistentObject; | |
12 | + | |
13 | +@Repository("enderecoEstoqueDao") | |
14 | +public class EnderecoEstoqueDaoHibernate extends CitGenericDAOImpl implements EnderecoEstoqueDao { | |
15 | + | |
16 | + public EnderecoEstoqueDaoHibernate() { | |
17 | + super(EnderecoEstoque.class); | |
18 | + } | |
19 | + | |
20 | + @Override | |
21 | + public List<PersistentObject> findAutoComplete(String chave, String valor) { | |
22 | + | |
23 | + SearchSeven searchSeven = new SearchSeven(this.persistentClass); | |
24 | + | |
25 | + searchSeven.addFilterILike(chave, "%" + valor + "%"); | |
26 | + | |
27 | + searchSeven.addFilterEqual("acomodaMaterial", Boolean.FALSE); | |
28 | + | |
29 | + searchSeven.setMaxResults(10); | |
30 | + | |
31 | + return this.search(searchSeven); | |
32 | + } | |
33 | + | |
34 | + @Override | |
35 | + public boolean enderecoEstoqueSuperiorVinculado(Long idEnderecoEstoque) { | |
36 | + | |
37 | + SearchSeven searchSeven = new SearchSeven(this.persistentClass); | |
38 | + | |
39 | + searchSeven.addFilterEqual("endeEstoqSuperior.id", idEnderecoEstoque); | |
40 | + | |
41 | + return this.count(searchSeven) > 0 ? Boolean.TRUE : Boolean.FALSE; | |
42 | + } | |
43 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/dao/impl/EstoqueDaoHibernate.java
0 → 100644
... | ... | @@ -0,0 +1,26 @@ |
1 | +package br.com.centralit.api.dao.impl; | |
2 | + | |
3 | +import org.springframework.stereotype.Repository; | |
4 | + | |
5 | +import br.com.centralit.api.dao.EstoqueDao; | |
6 | +import br.com.centralit.api.model.Estoque; | |
7 | +import br.com.centralit.framework.dao.arquitetura.CitGenericDAOImpl; | |
8 | +import br.com.centralit.framework.dao.arquitetura.SearchSeven; | |
9 | + | |
10 | +@Repository("estoqueDao") | |
11 | +public class EstoqueDaoHibernate extends CitGenericDAOImpl implements EstoqueDao { | |
12 | + | |
13 | + public EstoqueDaoHibernate() { | |
14 | + super(Estoque.class); | |
15 | + } | |
16 | + | |
17 | + @Override | |
18 | + public Estoque findEstoquePorAlmoxarifadoId(Long idAlmoxarifado) { | |
19 | + | |
20 | + SearchSeven searchSeven = new SearchSeven(); | |
21 | + | |
22 | + searchSeven.addFilterEqual("almoxarifado.id", idAlmoxarifado); | |
23 | + | |
24 | + return searchUnique(searchSeven); | |
25 | + } | |
26 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EnderecoEstoque.java
0 → 100644
... | ... | @@ -0,0 +1,231 @@ |
1 | +package br.com.centralit.api.model; | |
2 | + | |
3 | +import java.util.Collection; | |
4 | + | |
5 | +import javax.persistence.CascadeType; | |
6 | +import javax.persistence.Column; | |
7 | +import javax.persistence.Entity; | |
8 | +import javax.persistence.FetchType; | |
9 | +import javax.persistence.GeneratedValue; | |
10 | +import javax.persistence.GenerationType; | |
11 | +import javax.persistence.Id; | |
12 | +import javax.persistence.ManyToOne; | |
13 | +import javax.persistence.OneToMany; | |
14 | +import javax.persistence.Table; | |
15 | + | |
16 | +import com.fasterxml.jackson.annotation.JsonView; | |
17 | + | |
18 | +import br.com.centralit.framework.json.Views; | |
19 | +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
20 | + | |
21 | +/** | |
22 | + * | |
23 | + * <p> | |
24 | + * <img src="http://centralit.com.br/images/logo_central.png"> | |
25 | + * </p> | |
26 | + * | |
27 | + * <p> | |
28 | + * <b>Company: </b> Central IT - Governança Corporativa - | |
29 | + * </p> | |
30 | + * | |
31 | + * <p> | |
32 | + * <b>Title: </b> | |
33 | + * </p> | |
34 | + * | |
35 | + * <p> | |
36 | + * <b>Description: </b> | |
37 | + * </p> | |
38 | + * | |
39 | + * <p> | |
40 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
41 | + * </p> | |
42 | + * | |
43 | + * <p> | |
44 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
45 | + * </p> | |
46 | + * | |
47 | + * @since 29/04/2016 - 09:14:17 | |
48 | + * | |
49 | + * @version 1.0.0 | |
50 | + * | |
51 | + * @author geovane.filho | |
52 | + * | |
53 | + */ | |
54 | +@Entity | |
55 | +@Table(name = "alm_es_enderecoestoque") | |
56 | +public class EnderecoEstoque extends PersistentObjectAuditOrganizacao { | |
57 | + | |
58 | + /** Atributo serialVersionUID. */ | |
59 | + private static final long serialVersionUID = -7073316896345286446L; | |
60 | + | |
61 | + /** Atributo id. */ | |
62 | + @Id | |
63 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
64 | + @JsonView({ Views.GenericView.class }) | |
65 | + private Long id; | |
66 | + | |
67 | + /** Atributo entrada. */ | |
68 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
69 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
70 | + private Estoque estoque; | |
71 | + | |
72 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
73 | + private Estoque estoqueInativo; | |
74 | + | |
75 | + @Column(length = 30, nullable = false, updatable = false, unique = true) | |
76 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
77 | + private String codigo; | |
78 | + | |
79 | + @Column(name = "sigla", length = 30, nullable = false, updatable = true) | |
80 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
81 | + private String sigla; | |
82 | + | |
83 | + @Column(name = "descricao", length = 400) | |
84 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
85 | + private String descricao; | |
86 | + | |
87 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
88 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
89 | + private EnderecoEstoque endeEstoqSuperior; | |
90 | + | |
91 | + @Column(name = "acomodaMaterial") | |
92 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
93 | + private Boolean acomodaMaterial; | |
94 | + | |
95 | + @Column(name = "enderTodoMaterial") | |
96 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
97 | + private Boolean enderTodoMaterial; | |
98 | + | |
99 | + /** Atributo materiais. */ | |
100 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "endereco", cascade = CascadeType.ALL) | |
101 | + private Collection<MaterialLocalEstoque> materiais; | |
102 | + | |
103 | + /** | |
104 | + * Retorna o valor do atributo <code>id</code> | |
105 | + * | |
106 | + * @return <code>Long</code> | |
107 | + */ | |
108 | + public Long getId() { | |
109 | + | |
110 | + return id; | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * Define o valor do atributo <code>id</code>. | |
115 | + * | |
116 | + * @param id | |
117 | + */ | |
118 | + public void setId(Long id) { | |
119 | + | |
120 | + this.id = id; | |
121 | + } | |
122 | + | |
123 | + /** | |
124 | + * Retorna o valor do atributo <code>estoque</code> | |
125 | + * | |
126 | + * @return <code>Estoque</code> | |
127 | + */ | |
128 | + public Estoque getEstoque() { | |
129 | + | |
130 | + return estoque; | |
131 | + } | |
132 | + | |
133 | + /** | |
134 | + * Define o valor do atributo <code>estoque</code>. | |
135 | + * | |
136 | + * @param estoque | |
137 | + */ | |
138 | + public void setEstoque(Estoque estoque) { | |
139 | + | |
140 | + this.estoque = estoque; | |
141 | + } | |
142 | + | |
143 | + /** | |
144 | + * Retorna o valor do atributo <code>estoqueInativo</code> | |
145 | + * | |
146 | + * @return <code>Estoque</code> | |
147 | + */ | |
148 | + public Estoque getEstoqueInativo() { | |
149 | + | |
150 | + return estoqueInativo; | |
151 | + } | |
152 | + | |
153 | + /** | |
154 | + * Define o valor do atributo <code>estoqueInativo</code>. | |
155 | + * | |
156 | + * @param estoqueInativo | |
157 | + */ | |
158 | + public void setEstoqueInativo(Estoque estoqueInativo) { | |
159 | + | |
160 | + this.estoqueInativo = estoqueInativo; | |
161 | + } | |
162 | + | |
163 | + /** | |
164 | + * Retorna o valor do atributo <code>materiais</code> | |
165 | + * | |
166 | + * @return <code>Collection<MaterialLocalEstoque></code> | |
167 | + */ | |
168 | + public Collection<MaterialLocalEstoque> getMateriais() { | |
169 | + | |
170 | + return materiais; | |
171 | + } | |
172 | + | |
173 | + /** | |
174 | + * Define o valor do atributo <code>materiais</code>. | |
175 | + * | |
176 | + * @param materiais | |
177 | + */ | |
178 | + public void setMateriais(Collection<MaterialLocalEstoque> materiais) { | |
179 | + | |
180 | + this.materiais = materiais; | |
181 | + } | |
182 | + | |
183 | + public String getCodigo() { | |
184 | + return codigo; | |
185 | + } | |
186 | + | |
187 | + public void setCodigo(String codigo) { | |
188 | + this.codigo = codigo; | |
189 | + } | |
190 | + | |
191 | + public String getDescricao() { | |
192 | + return descricao; | |
193 | + } | |
194 | + | |
195 | + public void setDescricao(String descricao) { | |
196 | + this.descricao = descricao; | |
197 | + } | |
198 | + | |
199 | + public EnderecoEstoque getEndeEstoqSuperior() { | |
200 | + return endeEstoqSuperior; | |
201 | + } | |
202 | + | |
203 | + public void setEndeEstoqSuperior(EnderecoEstoque endeEstoqSuperior) { | |
204 | + this.endeEstoqSuperior = endeEstoqSuperior; | |
205 | + } | |
206 | + | |
207 | + public Boolean getEnderTodoMaterial() { | |
208 | + return enderTodoMaterial; | |
209 | + } | |
210 | + | |
211 | + public void setEnderTodoMaterial(Boolean enderTodoMaterial) { | |
212 | + this.enderTodoMaterial = enderTodoMaterial; | |
213 | + } | |
214 | + | |
215 | + public Boolean getAcomodaMaterial() { | |
216 | + return acomodaMaterial; | |
217 | + } | |
218 | + | |
219 | + public void setAcomodaMaterial(Boolean acomodaMaterial) { | |
220 | + this.acomodaMaterial = acomodaMaterial; | |
221 | + } | |
222 | + | |
223 | + public String getSigla() { | |
224 | + return sigla; | |
225 | + } | |
226 | + | |
227 | + public void setSigla(String sigla) { | |
228 | + this.sigla = sigla; | |
229 | + } | |
230 | + | |
231 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/Estoque.java
0 → 100644
... | ... | @@ -0,0 +1,126 @@ |
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 | +import javax.persistence.Table; | |
14 | + | |
15 | +import br.com.centralit.api.framework.json.ViewsAdmMateriais; | |
16 | +import br.com.centralit.api.framework.json.ViewsAlmoxarifado; | |
17 | +import br.com.centralit.framework.json.Views; | |
18 | +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
19 | + | |
20 | +import com.fasterxml.jackson.annotation.JsonView; | |
21 | + | |
22 | +/** | |
23 | + * | |
24 | + * <p> | |
25 | + * <img src="http://centralit.com.br/images/logo_central.png"> | |
26 | + * </p> | |
27 | + * | |
28 | + * <p> | |
29 | + * <b>Company: </b> Central IT - Governança Corporativa - | |
30 | + * </p> | |
31 | + * | |
32 | + * <p> | |
33 | + * <b>Title: </b> | |
34 | + * </p> | |
35 | + * | |
36 | + * <p> | |
37 | + * <b>Description: </b> | |
38 | + * </p> | |
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 | + * @since 29/04/2016 - 09:06:28 | |
49 | + * | |
50 | + * @version 1.0.0 | |
51 | + * | |
52 | + * @author geovane.filho | |
53 | + * | |
54 | + */ | |
55 | +@Entity | |
56 | +@Table(name = "alm_estoque") | |
57 | +public class Estoque extends PersistentObjectAuditOrganizacao { | |
58 | + | |
59 | + /** Atributo serialVersionUID. */ | |
60 | + private static final long serialVersionUID = 583158275027529648L; | |
61 | + | |
62 | + /** Atributo id. */ | |
63 | + @Id | |
64 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
65 | + @JsonView({ Views.GenericView.class }) | |
66 | + private Long id; | |
67 | + | |
68 | + /** Atributo almoxarifado. */ | |
69 | + @OneToOne(fetch = FetchType.LAZY, optional = false) | |
70 | + @JsonView({ ViewsAdmMateriais.LocalEstoqueAutoCompleteView.class, | |
71 | + ViewsAlmoxarifado.ConfiguracaoRessuprimentoEditView.class, Views.MaterialConsultaInfo.class, Views.EnderecoEstoqueView.class }) | |
72 | + private EstruturaOrganizacional almoxarifado; | |
73 | + | |
74 | + /** Atributo locais. */ | |
75 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "estoque", cascade = CascadeType.ALL) | |
76 | + private Collection<EnderecoEstoque> locais; | |
77 | + | |
78 | + /** | |
79 | + * Retorna o valor do atributo <code>id</code> | |
80 | + * | |
81 | + * @return <code>Long</code> | |
82 | + */ | |
83 | + public Long getId() { | |
84 | + | |
85 | + return id; | |
86 | + } | |
87 | + | |
88 | + /** | |
89 | + * Define o valor do atributo <code>id</code>. | |
90 | + * | |
91 | + * @param id | |
92 | + */ | |
93 | + public void setId(Long id) { | |
94 | + | |
95 | + this.id = id; | |
96 | + } | |
97 | + | |
98 | + /** | |
99 | + * Retorna o valor do atributo <code>almoxarifado</code> | |
100 | + * | |
101 | + * @return <code>EstruturaOrganizacional</code> | |
102 | + */ | |
103 | + public EstruturaOrganizacional getAlmoxarifado() { | |
104 | + | |
105 | + return almoxarifado; | |
106 | + } | |
107 | + | |
108 | + /** | |
109 | + * Define o valor do atributo <code>almoxarifado</code>. | |
110 | + * | |
111 | + * @param almoxarifado | |
112 | + */ | |
113 | + public void setAlmoxarifado(EstruturaOrganizacional almoxarifado) { | |
114 | + | |
115 | + this.almoxarifado = almoxarifado; | |
116 | + } | |
117 | + | |
118 | + public Collection<EnderecoEstoque> getLocais() { | |
119 | + return locais; | |
120 | + } | |
121 | + | |
122 | + public void setLocais(Collection<EnderecoEstoque> locais) { | |
123 | + this.locais = locais; | |
124 | + } | |
125 | + | |
126 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoque.java
0 → 100644
... | ... | @@ -0,0 +1,96 @@ |
1 | +package br.com.centralit.api.model; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.Collection; | |
5 | + | |
6 | +import javax.persistence.CascadeType; | |
7 | +import javax.persistence.Column; | |
8 | +import javax.persistence.Entity; | |
9 | +import javax.persistence.FetchType; | |
10 | +import javax.persistence.GeneratedValue; | |
11 | +import javax.persistence.GenerationType; | |
12 | +import javax.persistence.Id; | |
13 | +import javax.persistence.OneToMany; | |
14 | +import javax.persistence.OneToOne; | |
15 | +import javax.persistence.Table; | |
16 | + | |
17 | +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
18 | + | |
19 | +/** | |
20 | + * | |
21 | + * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | |
22 | + * | |
23 | + * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | |
24 | + * | |
25 | + * <p><b>Title: </b></p> | |
26 | + * | |
27 | + * <p><b>Description: </b></p> | |
28 | + * | |
29 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
30 | + * | |
31 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
32 | + * | |
33 | + * @since 29/04/2016 - 09:41:49 | |
34 | + * | |
35 | + * @version 1.0.0 | |
36 | + * | |
37 | + * @author geovane.filho | |
38 | + * | |
39 | + */ | |
40 | +@Entity | |
41 | +@Table(name = "alm_materialestoque") | |
42 | +public class MaterialEstoque extends PersistentObjectAuditOrganizacao { | |
43 | + | |
44 | + /** Atributo serialVersionUID. */ | |
45 | + private static final long serialVersionUID = 1170228299223134768L; | |
46 | + | |
47 | + /** Atributo id. */ | |
48 | + @Id | |
49 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
50 | + private Long id; | |
51 | + | |
52 | + /** Atributo material. */ | |
53 | + @OneToOne(fetch = FetchType.LAZY, optional = false) | |
54 | + private MaterialConsumo material; | |
55 | + | |
56 | + /** Atributo locaisEstoque. */ | |
57 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "materialEstoque", cascade = CascadeType.ALL) | |
58 | + private Collection<MaterialLocalEstoque> locaisEstoque; | |
59 | + | |
60 | + /** Atributo valorUnitarioMedio. */ | |
61 | + @Column(precision = 20, scale = 4) | |
62 | + private BigDecimal valorUnitarioMedio; | |
63 | + | |
64 | + /** Atributo restoMedio. */ | |
65 | + @Column(precision = 20, scale = 4) | |
66 | + private BigDecimal restoMedio; | |
67 | + | |
68 | + /** Atributo itensFifo. */ | |
69 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "materialEstoque", cascade = CascadeType.ALL) | |
70 | + private Collection<MaterialEstoqueFIFOItem> itensFifo; | |
71 | + | |
72 | + /** Atributo movimentos. */ | |
73 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "materialEstoque", cascade = CascadeType.ALL) | |
74 | + private Collection<MovimentoEstoque> movimentos; | |
75 | + | |
76 | + /** | |
77 | + * Retorna o valor do atributo <code>id</code> | |
78 | + * | |
79 | + * @return <code>Long</code> | |
80 | + */ | |
81 | + public Long getId() { | |
82 | + | |
83 | + return id; | |
84 | + } | |
85 | + | |
86 | + /** | |
87 | + * Define o valor do atributo <code>id</code>. | |
88 | + * | |
89 | + * @param id | |
90 | + */ | |
91 | + public void setId(Long id) { | |
92 | + | |
93 | + this.id = id; | |
94 | + } | |
95 | + | |
96 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialEstoqueFIFOItem.java
0 → 100644
... | ... | @@ -0,0 +1,278 @@ |
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.FetchType; | |
8 | +import javax.persistence.GeneratedValue; | |
9 | +import javax.persistence.GenerationType; | |
10 | +import javax.persistence.Id; | |
11 | +import javax.persistence.ManyToOne; | |
12 | +import javax.persistence.OneToOne; | |
13 | +import javax.persistence.Table; | |
14 | + | |
15 | +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
16 | + | |
17 | +/** | |
18 | + * | |
19 | + * <p><img src="http://centralit.com.br/images/logo_central.png"></p> | |
20 | + * | |
21 | + * <p><b>Company: </b> Central IT - Governança Corporativa - </p> | |
22 | + * | |
23 | + * <p><b>Title: </b></p> | |
24 | + * | |
25 | + * <p><b>Description: </b></p> | |
26 | + * | |
27 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
28 | + * | |
29 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
30 | + * | |
31 | + * @since 29/04/2016 - 15:55:15 | |
32 | + * | |
33 | + * @version 1.0.0 | |
34 | + * | |
35 | + * @author geovane.filho | |
36 | + * | |
37 | + */ | |
38 | +@Entity | |
39 | +@Table(name = "alm_me_fifoitem") | |
40 | +public class MaterialEstoqueFIFOItem extends PersistentObjectAuditOrganizacao { | |
41 | + | |
42 | + /** Atributo serialVersionUID. */ | |
43 | + private static final long serialVersionUID = 1170228299223134768L; | |
44 | + | |
45 | + /** Atributo id. */ | |
46 | + @Id | |
47 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
48 | + private Long id; | |
49 | + | |
50 | + /** Atributo material. */ | |
51 | + @OneToOne(fetch = FetchType.LAZY, optional = false) | |
52 | + private MaterialConsumo material; | |
53 | + | |
54 | + /** Atributo materialEstoque. */ | |
55 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
56 | + private MaterialEstoque materialEstoque; | |
57 | + | |
58 | + /** Atributo materialEstoqueInativo. */ | |
59 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
60 | + private MaterialEstoque materialEstoqueInativo; | |
61 | + | |
62 | + /** Atributo quantidadeInicial. */ | |
63 | + @Column(precision = 20, scale = 4, nullable = false) | |
64 | + private BigDecimal quantidadeInicial; | |
65 | + | |
66 | + /** Atributo quantidadeRestante. */ | |
67 | + @Column(precision = 20, scale = 4, nullable = false) | |
68 | + private BigDecimal quantidadeRestante; | |
69 | + | |
70 | + /** Atributo valorUnitario. */ | |
71 | + @Column(precision = 20, scale = 4, nullable = false) | |
72 | + private BigDecimal valorUnitario; | |
73 | + | |
74 | + /** Atributo valorSobra. */ | |
75 | + @Column(precision = 20, scale = 4, nullable = false) | |
76 | + private BigDecimal valorSobra; | |
77 | + | |
78 | + /** Atributo valorTotal. */ | |
79 | + @Column(precision = 20, scale = 4, nullable = false) | |
80 | + private BigDecimal valorTotal; | |
81 | + | |
82 | + /** | |
83 | + * Retorna o valor do atributo <code>id</code> | |
84 | + * | |
85 | + * @return <code>Long</code> | |
86 | + */ | |
87 | + public Long getId() { | |
88 | + | |
89 | + return id; | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * Define o valor do atributo <code>id</code>. | |
94 | + * | |
95 | + * @param id | |
96 | + */ | |
97 | + public void setId(Long id) { | |
98 | + | |
99 | + this.id = id; | |
100 | + } | |
101 | + | |
102 | + | |
103 | + /** | |
104 | + * Retorna o valor do atributo <code>material</code> | |
105 | + * | |
106 | + * @return <code>MaterialConsumo</code> | |
107 | + */ | |
108 | + public MaterialConsumo getMaterial() { | |
109 | + | |
110 | + return material; | |
111 | + } | |
112 | + | |
113 | + | |
114 | + /** | |
115 | + * Define o valor do atributo <code>material</code>. | |
116 | + * | |
117 | + * @param material | |
118 | + */ | |
119 | + public void setMaterial(MaterialConsumo material) { | |
120 | + | |
121 | + this.material = material; | |
122 | + } | |
123 | + | |
124 | + | |
125 | + | |
126 | + /** | |
127 | + * Retorna o valor do atributo <code>materialEstoque</code> | |
128 | + * | |
129 | + * @return <code>MaterialEstoque</code> | |
130 | + */ | |
131 | + public MaterialEstoque getMaterialEstoque() { | |
132 | + | |
133 | + return materialEstoque; | |
134 | + } | |
135 | + | |
136 | + | |
137 | + /** | |
138 | + * Define o valor do atributo <code>materialEstoque</code>. | |
139 | + * | |
140 | + * @param materialEstoque | |
141 | + */ | |
142 | + public void setMaterialEstoque(MaterialEstoque materialEstoque) { | |
143 | + | |
144 | + this.materialEstoque = materialEstoque; | |
145 | + } | |
146 | + | |
147 | + | |
148 | + /** | |
149 | + * Retorna o valor do atributo <code>materialEstoqueInativo</code> | |
150 | + * | |
151 | + * @return <code>MaterialEstoque</code> | |
152 | + */ | |
153 | + public MaterialEstoque getMaterialEstoqueInativo() { | |
154 | + | |
155 | + return materialEstoqueInativo; | |
156 | + } | |
157 | + | |
158 | + | |
159 | + /** | |
160 | + * Define o valor do atributo <code>materialEstoqueInativo</code>. | |
161 | + * | |
162 | + * @param materialEstoqueInativo | |
163 | + */ | |
164 | + public void setMaterialEstoqueInativo(MaterialEstoque materialEstoqueInativo) { | |
165 | + | |
166 | + this.materialEstoqueInativo = materialEstoqueInativo; | |
167 | + } | |
168 | + | |
169 | + /** | |
170 | + * Retorna o valor do atributo <code>quantidadeInicial</code> | |
171 | + * | |
172 | + * @return <code>BigDecimal</code> | |
173 | + */ | |
174 | + public BigDecimal getQuantidadeInicial() { | |
175 | + | |
176 | + return quantidadeInicial; | |
177 | + } | |
178 | + | |
179 | + | |
180 | + /** | |
181 | + * Define o valor do atributo <code>quantidadeInicial</code>. | |
182 | + * | |
183 | + * @param quantidadeInicial | |
184 | + */ | |
185 | + public void setQuantidadeInicial(BigDecimal quantidadeInicial) { | |
186 | + | |
187 | + this.quantidadeInicial = quantidadeInicial; | |
188 | + } | |
189 | + | |
190 | + | |
191 | + /** | |
192 | + * Retorna o valor do atributo <code>quantidadeRestante</code> | |
193 | + * | |
194 | + * @return <code>BigDecimal</code> | |
195 | + */ | |
196 | + public BigDecimal getQuantidadeRestante() { | |
197 | + | |
198 | + return quantidadeRestante; | |
199 | + } | |
200 | + | |
201 | + | |
202 | + /** | |
203 | + * Define o valor do atributo <code>quantidadeRestante</code>. | |
204 | + * | |
205 | + * @param quantidadeRestante | |
206 | + */ | |
207 | + public void setQuantidadeRestante(BigDecimal quantidadeRestante) { | |
208 | + | |
209 | + this.quantidadeRestante = quantidadeRestante; | |
210 | + } | |
211 | + | |
212 | + | |
213 | + /** | |
214 | + * Retorna o valor do atributo <code>valorUnitario</code> | |
215 | + * | |
216 | + * @return <code>BigDecimal</code> | |
217 | + */ | |
218 | + public BigDecimal getValorUnitario() { | |
219 | + | |
220 | + return valorUnitario; | |
221 | + } | |
222 | + | |
223 | + | |
224 | + /** | |
225 | + * Define o valor do atributo <code>valorUnitario</code>. | |
226 | + * | |
227 | + * @param valorUnitario | |
228 | + */ | |
229 | + public void setValorUnitario(BigDecimal valorUnitario) { | |
230 | + | |
231 | + this.valorUnitario = valorUnitario; | |
232 | + } | |
233 | + | |
234 | + | |
235 | + /** | |
236 | + * Retorna o valor do atributo <code>valorSobra</code> | |
237 | + * | |
238 | + * @return <code>BigDecimal</code> | |
239 | + */ | |
240 | + public BigDecimal getValorSobra() { | |
241 | + | |
242 | + return valorSobra; | |
243 | + } | |
244 | + | |
245 | + | |
246 | + /** | |
247 | + * Define o valor do atributo <code>valorSobra</code>. | |
248 | + * | |
249 | + * @param valorSobra | |
250 | + */ | |
251 | + public void setValorSobra(BigDecimal valorSobra) { | |
252 | + | |
253 | + this.valorSobra = valorSobra; | |
254 | + } | |
255 | + | |
256 | + | |
257 | + /** | |
258 | + * Retorna o valor do atributo <code>valorTotal</code> | |
259 | + * | |
260 | + * @return <code>BigDecimal</code> | |
261 | + */ | |
262 | + public BigDecimal getValorTotal() { | |
263 | + | |
264 | + return valorTotal; | |
265 | + } | |
266 | + | |
267 | + | |
268 | + /** | |
269 | + * Define o valor do atributo <code>valorTotal</code>. | |
270 | + * | |
271 | + * @param valorTotal | |
272 | + */ | |
273 | + public void setValorTotal(BigDecimal valorTotal) { | |
274 | + | |
275 | + this.valorTotal = valorTotal; | |
276 | + } | |
277 | + | |
278 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MaterialLocalEstoque.java
0 → 100644
... | ... | @@ -0,0 +1,230 @@ |
1 | +package br.com.centralit.api.model; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | + | |
5 | +import javax.persistence.Entity; | |
6 | +import javax.persistence.FetchType; | |
7 | +import javax.persistence.GeneratedValue; | |
8 | +import javax.persistence.GenerationType; | |
9 | +import javax.persistence.Id; | |
10 | +import javax.persistence.ManyToOne; | |
11 | +import javax.persistence.OneToOne; | |
12 | +import javax.persistence.Table; | |
13 | + | |
14 | +import com.fasterxml.jackson.annotation.JsonView; | |
15 | + | |
16 | +import br.com.centralit.framework.json.Views; | |
17 | +import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; | |
18 | + | |
19 | +/** | |
20 | + * | |
21 | + * <p> | |
22 | + * <img src="http://centralit.com.br/images/logo_central.png"> | |
23 | + * </p> | |
24 | + * | |
25 | + * <p> | |
26 | + * <b>Company: </b> Central IT - Governança Corporativa - | |
27 | + * </p> | |
28 | + * | |
29 | + * <p> | |
30 | + * <b>Title: </b> | |
31 | + * </p> | |
32 | + * | |
33 | + * <p> | |
34 | + * <b>Description: </b> | |
35 | + * </p> | |
36 | + * | |
37 | + * <p> | |
38 | + * <b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a> | |
39 | + * </p> | |
40 | + * | |
41 | + * <p> | |
42 | + * <b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a> | |
43 | + * </p> | |
44 | + * | |
45 | + * @since 29/04/2016 - 09:06:28 | |
46 | + * | |
47 | + * @version 1.0.0 | |
48 | + * | |
49 | + * @author geovane.filho | |
50 | + * | |
51 | + */ | |
52 | +@Entity | |
53 | +@Table(name = "alm_me_localestoque") | |
54 | +public class MaterialLocalEstoque 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 materialEstoque. */ | |
66 | + @OneToOne(fetch = FetchType.LAZY, optional = false) | |
67 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
68 | + private MaterialEstoque materialEstoque; | |
69 | + | |
70 | + /** Atributo materialEstoqueInativo. */ | |
71 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
72 | + private MaterialEstoque materialEstoqueInativo; | |
73 | + | |
74 | + /** Atributo endereco. */ | |
75 | + @OneToOne(fetch = FetchType.LAZY, optional = false) | |
76 | + private EnderecoEstoque endereco; | |
77 | + | |
78 | + /** Atributo enderecoInativo. */ | |
79 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
80 | + private EnderecoEstoque enderecoInativo; | |
81 | + | |
82 | + /** Atributo quantidade. */ | |
83 | + @JsonView({ Views.EnderecoEstoqueView.class }) | |
84 | + private BigDecimal quantidade; | |
85 | + | |
86 | + /** Atributo unidadeMedidaEntrada. */ | |
87 | + @ManyToOne(fetch = FetchType.LAZY, optional = false) | |
88 | + private UnidadeMedida unidadeMedidaEntrada; | |
89 | + | |
90 | + /** | |
91 | + * Retorna o valor do atributo <code>id</code> | |
92 | + * | |
93 | + * @return <code>Long</code> | |
94 | + */ | |
95 | + public Long getId() { | |
96 | + | |
97 | + return id; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * Define o valor do atributo <code>id</code>. | |
102 | + * | |
103 | + * @param id | |
104 | + */ | |
105 | + public void setId(Long id) { | |
106 | + | |
107 | + this.id = id; | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * Retorna o valor do atributo <code>endereco</code> | |
112 | + * | |
113 | + * @return <code>EnderecoEstoque</code> | |
114 | + */ | |
115 | + public EnderecoEstoque getEndereco() { | |
116 | + | |
117 | + return endereco; | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * Define o valor do atributo <code>endereco</code>. | |
122 | + * | |
123 | + * @param endereco | |
124 | + */ | |
125 | + public void setEndereco(EnderecoEstoque endereco) { | |
126 | + | |
127 | + this.endereco = endereco; | |
128 | + } | |
129 | + | |
130 | + /** | |
131 | + * Retorna o valor do atributo <code>enderecoInativo</code> | |
132 | + * | |
133 | + * @return <code>EnderecoEstoque</code> | |
134 | + */ | |
135 | + public EnderecoEstoque getEnderecoInativo() { | |
136 | + | |
137 | + return enderecoInativo; | |
138 | + } | |
139 | + | |
140 | + /** | |
141 | + * Define o valor do atributo <code>enderecoInativo</code>. | |
142 | + * | |
143 | + * @param enderecoInativo | |
144 | + */ | |
145 | + public void setEnderecoInativo(EnderecoEstoque enderecoInativo) { | |
146 | + | |
147 | + this.enderecoInativo = enderecoInativo; | |
148 | + } | |
149 | + | |
150 | + /** | |
151 | + * Retorna o valor do atributo <code>quantidade</code> | |
152 | + * | |
153 | + * @return <code>BigDecimal</code> | |
154 | + */ | |
155 | + public BigDecimal getQuantidade() { | |
156 | + | |
157 | + return quantidade; | |
158 | + } | |
159 | + | |
160 | + /** | |
161 | + * Define o valor do atributo <code>quantidade</code>. | |
162 | + * | |
163 | + * @param quantidade | |
164 | + */ | |
165 | + public void setQuantidade(BigDecimal quantidade) { | |
166 | + | |
167 | + this.quantidade = quantidade; | |
168 | + } | |
169 | + | |
170 | + /** | |
171 | + * Retorna o valor do atributo <code>unidadeMedidaEntrada</code> | |
172 | + * | |
173 | + * @return <code>UnidadeMedida</code> | |
174 | + */ | |
175 | + public UnidadeMedida getUnidadeMedidaEntrada() { | |
176 | + | |
177 | + return unidadeMedidaEntrada; | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * Define o valor do atributo <code>unidadeMedidaEntrada</code>. | |
182 | + * | |
183 | + * @param unidadeMedidaEntrada | |
184 | + */ | |
185 | + public void setUnidadeMedidaEntrada(UnidadeMedida unidadeMedidaEntrada) { | |
186 | + | |
187 | + this.unidadeMedidaEntrada = unidadeMedidaEntrada; | |
188 | + } | |
189 | + | |
190 | + /** | |
191 | + * Retorna o valor do atributo <code>materialEstoque</code> | |
192 | + * | |
193 | + * @return <code>MaterialEstoque</code> | |
194 | + */ | |
195 | + public MaterialEstoque getMaterialEstoque() { | |
196 | + | |
197 | + return materialEstoque; | |
198 | + } | |
199 | + | |
200 | + /** | |
201 | + * Define o valor do atributo <code>materialEstoque</code>. | |
202 | + * | |
203 | + * @param materialEstoque | |
204 | + */ | |
205 | + public void setMaterialEstoque(MaterialEstoque materialEstoque) { | |
206 | + | |
207 | + this.materialEstoque = materialEstoque; | |
208 | + } | |
209 | + | |
210 | + /** | |
211 | + * Retorna o valor do atributo <code>materialEstoqueInativo</code> | |
212 | + * | |
213 | + * @return <code>MaterialEstoque</code> | |
214 | + */ | |
215 | + public MaterialEstoque getMaterialEstoqueInativo() { | |
216 | + | |
217 | + return materialEstoqueInativo; | |
218 | + } | |
219 | + | |
220 | + /** | |
221 | + * Define o valor do atributo <code>materialEstoqueInativo</code>. | |
222 | + * | |
223 | + * @param materialEstoqueInativo | |
224 | + */ | |
225 | + public void setMaterialEstoqueInativo(MaterialEstoque materialEstoqueInativo) { | |
226 | + | |
227 | + this.materialEstoqueInativo = materialEstoqueInativo; | |
228 | + } | |
229 | + | |
230 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/MovimentoEstoque.java
... | ... | @@ -125,10 +125,14 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
125 | 125 | |
126 | 126 | /** Atributo requisicao. */ |
127 | 127 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
128 | - @JoinColumn(name="atendimentoreqconsumoitem_id") | |
128 | + @JoinColumn(name = "atendimentoreqconsumoitem_id") | |
129 | 129 | @JsonView({ Views.MaterialConsultaInfo.class }) |
130 | 130 | private AtendimentoRequisicaoConsumoItem atendimentoRequisicaoConsumoItem; |
131 | 131 | |
132 | + /** Atributo materialEstoque. */ | |
133 | + @ManyToOne(fetch = FetchType.LAZY, optional = true) | |
134 | + private MaterialEstoque materialEstoque; | |
135 | + | |
132 | 136 | /** |
133 | 137 | * Responsável pela criação de novas instâncias desta classe. |
134 | 138 | */ |
... | ... | @@ -146,7 +150,8 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
146 | 150 | * @param valorMedia |
147 | 151 | * @param tipoMovimento |
148 | 152 | */ |
149 | - public MovimentoEstoque( Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, Dominio tipoMovimento ) { | |
153 | + public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, | |
154 | + Dominio tipoMovimento) { | |
150 | 155 | |
151 | 156 | super(); |
152 | 157 | this.dataMovimento = dataMovimento; |
... | ... | @@ -167,7 +172,8 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
167 | 172 | * @param localEstoque |
168 | 173 | * @param material |
169 | 174 | */ |
170 | - public MovimentoEstoque( Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, Dominio tipoMovimento, LocalEstoque localEstoque, Material material ) { | |
175 | + public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, | |
176 | + Dominio tipoMovimento, LocalEstoque localEstoque, Material material) { | |
171 | 177 | |
172 | 178 | this(dataMovimento, quantidade, valorFIFO, valorMedia, tipoMovimento); |
173 | 179 | this.localEstoque = localEstoque; |
... | ... | @@ -184,7 +190,9 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
184 | 190 | * @param tipoMovimento |
185 | 191 | * @param baixaAlmoxarifadoItem |
186 | 192 | */ |
187 | - public MovimentoEstoque( Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, Dominio tipoMovimento, BaixaAlmoxarifadoItem baixaAlmoxarifadoItem, LocalEstoque localEstoque, Material material, EntradaAlmoxarifadoItem entradaAlmoxarifadoItem ) { | |
193 | + public MovimentoEstoque(Calendar dataMovimento, BigDecimal quantidade, BigDecimal valorFIFO, BigDecimal valorMedia, | |
194 | + Dominio tipoMovimento, BaixaAlmoxarifadoItem baixaAlmoxarifadoItem, LocalEstoque localEstoque, | |
195 | + Material material, EntradaAlmoxarifadoItem entradaAlmoxarifadoItem) { | |
188 | 196 | |
189 | 197 | this.dataMovimento = dataMovimento; |
190 | 198 | this.quantidade = quantidade; |
... | ... | @@ -458,5 +466,12 @@ public class MovimentoEstoque extends PersistentObjectAuditOrganizacao { |
458 | 466 | this.valorMedia = valorMedia; |
459 | 467 | } |
460 | 468 | |
469 | + public MaterialEstoque getMaterialEstoque() { | |
470 | + return materialEstoque; | |
471 | + } | |
472 | + | |
473 | + public void setMaterialEstoque(MaterialEstoque materialEstoque) { | |
474 | + this.materialEstoque = materialEstoque; | |
475 | + } | |
461 | 476 | |
462 | 477 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/EnderecoEstoqueService.java
0 → 100644
... | ... | @@ -0,0 +1,10 @@ |
1 | +package br.com.centralit.api.service; | |
2 | + | |
3 | +import br.com.centralit.api.model.EnderecoEstoque; | |
4 | +import br.com.centralit.framework.service.arquitetura.GenericService; | |
5 | + | |
6 | +public interface EnderecoEstoqueService extends GenericService<EnderecoEstoque, Long> { | |
7 | + | |
8 | + boolean enderecoEstoqueSuperiorVinculado(Long id); | |
9 | + | |
10 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/EstoqueService.java
0 → 100644
... | ... | @@ -0,0 +1,10 @@ |
1 | +package br.com.centralit.api.service; | |
2 | + | |
3 | +import br.com.centralit.api.model.Estoque; | |
4 | +import br.com.centralit.framework.service.arquitetura.GenericService; | |
5 | + | |
6 | +public interface EstoqueService extends GenericService<Estoque, Long> { | |
7 | + | |
8 | + Estoque findEstoquePorAlmoxarifadoId(Long idAlmoxarifado); | |
9 | + | |
10 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/EnderecoEstoqueServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,135 @@ |
1 | +package br.com.centralit.api.service.impl; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.List; | |
6 | + | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.beans.factory.annotation.Qualifier; | |
9 | +import org.springframework.stereotype.Service; | |
10 | +import org.springframework.validation.Validator; | |
11 | + | |
12 | +import br.com.centralit.api.dao.EnderecoEstoqueDao; | |
13 | +import br.com.centralit.api.model.EnderecoEstoque; | |
14 | +import br.com.centralit.api.model.Estoque; | |
15 | +import br.com.centralit.api.model.MaterialLocalEstoque; | |
16 | +import br.com.centralit.api.service.ConfiguracaoParametroSistemaService; | |
17 | +import br.com.centralit.api.service.EnderecoEstoqueService; | |
18 | +import br.com.centralit.api.service.EstoqueService; | |
19 | +import br.com.centralit.framework.exception.BusinessException; | |
20 | +import br.com.centralit.framework.exception.CodigoErro; | |
21 | +import br.com.centralit.framework.model.arquitetura.PersistentObject; | |
22 | +import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
23 | +import br.com.centralit.framework.util.UtilColecao; | |
24 | +import br.com.centralit.framework.util.UtilObjeto; | |
25 | + | |
26 | +@Service("enderecoEstoqueService") | |
27 | +public class EnderecoEstoqueServiceImpl extends GenericServiceImpl<EnderecoEstoque, Long> implements EnderecoEstoqueService { | |
28 | + | |
29 | + private EnderecoEstoqueDao enderecoEstoqueDao; | |
30 | + | |
31 | + @Autowired | |
32 | + private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService; | |
33 | + | |
34 | + @Autowired | |
35 | + private EstoqueService estoqueService; | |
36 | + | |
37 | + @Autowired | |
38 | + public EnderecoEstoqueServiceImpl(EnderecoEstoqueDao enderecoEstoqueDao, @Qualifier("enderecoEstoqueValidator") Validator validator) { | |
39 | + this.dao = enderecoEstoqueDao; | |
40 | + this.enderecoEstoqueDao = enderecoEstoqueDao; | |
41 | + this.validator = validator; | |
42 | + } | |
43 | + | |
44 | + public EnderecoEstoque save(EnderecoEstoque enderecoEstoque){ | |
45 | + | |
46 | + this.validarEntidade(enderecoEstoque, this.validator); | |
47 | + montaEnderecoEstoqueObject(enderecoEstoque); | |
48 | + this.enderecoEstoqueDao.save(enderecoEstoque); | |
49 | + | |
50 | + return enderecoEstoque; | |
51 | + } | |
52 | + | |
53 | + private void montaEnderecoEstoqueObject(EnderecoEstoque enderecoEstoque) { | |
54 | + | |
55 | + configurarCodigo(enderecoEstoque); | |
56 | + | |
57 | + Estoque estoque = this.estoqueService.findEstoquePorAlmoxarifadoId(enderecoEstoque.getEstoque().getAlmoxarifado().getId()); | |
58 | + | |
59 | + if(enderecoEstoque.getAcomodaMaterial() == null){ | |
60 | + enderecoEstoque.setAcomodaMaterial(Boolean.FALSE); | |
61 | + } | |
62 | + | |
63 | + if(enderecoEstoque.getEnderTodoMaterial() == null){ | |
64 | + enderecoEstoque.setEnderTodoMaterial(Boolean.FALSE); | |
65 | + } | |
66 | + | |
67 | + if(!UtilObjeto.isReferencia(estoque)){ | |
68 | + estoque = new Estoque(); | |
69 | + estoque.setAlmoxarifado(enderecoEstoque.getEstoque().getAlmoxarifado()); | |
70 | + List<EnderecoEstoque> listEndereco = new ArrayList<EnderecoEstoque>(); | |
71 | + listEndereco.add(enderecoEstoque); | |
72 | + estoque.setLocais(listEndereco); | |
73 | + estoque = this.estoqueService.save(estoque); | |
74 | + | |
75 | + enderecoEstoque.setEstoque(estoque); | |
76 | + }else{ | |
77 | + enderecoEstoque.setEstoque(estoque); | |
78 | + } | |
79 | + | |
80 | + } | |
81 | + | |
82 | + public EnderecoEstoque merge(EnderecoEstoque enderecoEstoque) { | |
83 | + | |
84 | + if(enderecoEstoque.getAcomodaMaterial()){ | |
85 | + if(this.enderecoEstoqueSuperiorVinculado(enderecoEstoque.getId())){ | |
86 | + throw new BusinessException("ALMOXARIFADO.VALIDACAO.NAO_PERMITIDO_ENDERECO_ESTOQUE_ACOMODA_MATERIAL", CodigoErro.REGRA_NEGOCIO.getValue()); | |
87 | + } | |
88 | + } | |
89 | + | |
90 | + this.validarEntidade(enderecoEstoque, this.validator); | |
91 | + super.save(enderecoEstoque); | |
92 | + return enderecoEstoque; | |
93 | + } | |
94 | + | |
95 | + @Override | |
96 | + public boolean remove(EnderecoEstoque entity) { | |
97 | + | |
98 | + if (!UtilColecao.isVazio(entity.getMateriais())) { | |
99 | + for (MaterialLocalEstoque materialLocalEstoque : entity.getMateriais()) { | |
100 | + if(materialLocalEstoque.getQuantidade() != null && !materialLocalEstoque.getQuantidade().equals(new BigDecimal("0"))){ | |
101 | + throw new BusinessException("ALMOXARIFADO.VALIDACAO.REMOVER_ENDERECO_ESTOQUE_NEGADA", CodigoErro.REGRA_NEGOCIO.getValue()); | |
102 | + } | |
103 | + } | |
104 | + | |
105 | + } | |
106 | + | |
107 | + return super.remove(entity); | |
108 | + } | |
109 | + | |
110 | + @Override | |
111 | + public List<PersistentObject> findAutoComplete(String chave, String valor) { | |
112 | + | |
113 | + return this.enderecoEstoqueDao.findAutoComplete(chave, valor); | |
114 | + } | |
115 | + | |
116 | + private void configurarCodigo(EnderecoEstoque entity) { | |
117 | + | |
118 | + if (!UtilObjeto.isReferencia(entity.getOrganizacao())) { | |
119 | + entity.setOrganizacao(this.getUsuario().getOrganizacao()); | |
120 | + } | |
121 | + EnderecoEstoque ultimoRegistro = (EnderecoEstoque) enderecoEstoqueDao.buscarUltimoRegistroComOrdenadoParametrizada("codigo", entity.getOrganizacao().getId()); | |
122 | + Long sequencial = null; | |
123 | + if (UtilObjeto.isReferencia(ultimoRegistro)) { | |
124 | + sequencial = ultimoRegistro.getCodigo() == null ? null : Long.parseLong(ultimoRegistro.getCodigo()); | |
125 | + } | |
126 | + String codigo = configuracaoParametroSistemaService.gerarNumeroIdentificacaoSeguencial(sequencial); | |
127 | + entity.setCodigo(codigo); | |
128 | + } | |
129 | + | |
130 | + @Override | |
131 | + public boolean enderecoEstoqueSuperiorVinculado(Long id) { | |
132 | + return this.enderecoEstoqueDao.enderecoEstoqueSuperiorVinculado(id); | |
133 | + } | |
134 | + | |
135 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/EstoqueServiceImpl.java
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +package br.com.centralit.api.service.impl; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Service; | |
5 | + | |
6 | +import br.com.centralit.api.dao.EstoqueDao; | |
7 | +import br.com.centralit.api.model.Estoque; | |
8 | +import br.com.centralit.api.service.EstoqueService; | |
9 | +import br.com.centralit.framework.service.arquitetura.GenericServiceImpl; | |
10 | + | |
11 | +@Service("estoqueService") | |
12 | +public class EstoqueServiceImpl extends GenericServiceImpl<Estoque, Long> implements EstoqueService { | |
13 | + | |
14 | + private EstoqueDao estoqueDao; | |
15 | + | |
16 | + @Autowired | |
17 | + public EstoqueServiceImpl(EstoqueDao estoqueDao) { | |
18 | + this.dao = estoqueDao; | |
19 | + this.estoqueDao = estoqueDao; | |
20 | + } | |
21 | + | |
22 | + @Override | |
23 | + public Estoque findEstoquePorAlmoxarifadoId(Long idAlmoxarifado) { | |
24 | + return this.estoqueDao.findEstoquePorAlmoxarifadoId(idAlmoxarifado); | |
25 | + } | |
26 | + | |
27 | +} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/InicializarAlmoxarifadoServiceImpl.java
... | ... | @@ -17,10 +17,10 @@ import br.com.centralit.api.service.MenuFileService; |
17 | 17 | import br.com.centralit.api.service.MenuService; |
18 | 18 | import br.com.centralit.api.service.ModuloService; |
19 | 19 | import br.com.centralit.api.service.PaginaService; |
20 | -import br.com.centralit.framework.model.UtilStartup; | |
21 | 20 | import br.com.centralit.framework.model.Menu; |
22 | 21 | import br.com.centralit.framework.model.MenuFile; |
23 | 22 | import br.com.centralit.framework.model.Pagina; |
23 | +import br.com.centralit.framework.model.UtilStartup; | |
24 | 24 | import br.com.centralit.framework.util.UtilObjeto; |
25 | 25 | |
26 | 26 | @Service("InicializarAlmoxarifadoService") |
... | ... | @@ -192,6 +192,15 @@ public class InicializarAlmoxarifadoServiceImpl extends UtilStartup{ |
192 | 192 | List<MenuFile> filesMenuFileInfoMenu = this.gerarArquivosMenu(menuInfoMaterial, CIT_ALMOXARIFADO_WEB_ANGULAR_CUSTOM, "InfoMaterial", true, false, true); |
193 | 193 | menuInfoMaterial.setIncludes(filesMenuFileInfoMenu); |
194 | 194 | this.menuService.mergeIfNotExist(menuInfoMaterial); |
195 | + | |
196 | + // Menu Endereco Estoque | |
197 | + Pagina pgEnderecoEstoque = new Pagina("Endereço de Estoque", "/cit-almoxarifado-web/html/enderecoEstoque/enderecoEstoque.html"); | |
198 | + pgEnderecoEstoque = this.paginaService.saveIfNotExist(pgEnderecoEstoque); | |
199 | + Menu menuEnderecoEstoque = new Menu("Endereço de Estoque", pgEnderecoEstoque, menuAlmoxarifado, null, 8, null, null, null, null, moduloSelecionado); | |
200 | + List<MenuFile> filesMenuFileEnderecoEstoque = this.gerarArquivosMenu(menuEnderecoEstoque, CIT_ALMOXARIFADO_WEB_ANGULAR_CUSTOM, "EnderecoEstoque", true, true, true); | |
201 | + menuEnderecoEstoque.setIncludes(filesMenuFileEnderecoEstoque); | |
202 | + this.menuService.mergeIfNotExist(menuEnderecoEstoque); | |
203 | + | |
195 | 204 | |
196 | 205 | /* |
197 | 206 | * Paginas e menus relatorios Submenu Relatórios almoxarifado | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/validation/EnderecoEstoqueValidator.java
0 → 100644
... | ... | @@ -0,0 +1,29 @@ |
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.EnderecoEstoque; | |
9 | +import br.com.centralit.framework.exception.CodigoErro; | |
10 | + | |
11 | +@Component("enderecoEstoqueValidator") | |
12 | +public class EnderecoEstoqueValidator implements Validator { | |
13 | + | |
14 | + @Override | |
15 | + public boolean supports(Class<?> clazz) { | |
16 | + | |
17 | + return EnderecoEstoque.class.isAssignableFrom(clazz); | |
18 | + } | |
19 | + | |
20 | + @Override | |
21 | + public void validate(Object target, Errors errors) { | |
22 | + | |
23 | + ValidationUtils.rejectIfEmpty(errors, "estoque.almoxarifado", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "ALMOXARIFADO.LABEL.ALMOXARIFADO"); | |
24 | + | |
25 | + ValidationUtils.rejectIfEmpty(errors, "descricao", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.DESCRICAO"); | |
26 | + | |
27 | + } | |
28 | +} | |
29 | + | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/EnderecoEstoqueController.java
0 → 100644
... | ... | @@ -0,0 +1,44 @@ |
1 | +package br.com.centralit.controller; | |
2 | + | |
3 | +import org.springframework.beans.factory.annotation.Autowired; | |
4 | +import org.springframework.stereotype.Controller; | |
5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
6 | +import org.springframework.web.bind.annotation.RequestMethod; | |
7 | +import org.springframework.web.bind.annotation.RequestParam; | |
8 | +import org.springframework.web.bind.annotation.ResponseBody; | |
9 | + | |
10 | +import br.com.centralit.api.model.EnderecoEstoque; | |
11 | +import br.com.centralit.api.service.EnderecoEstoqueService; | |
12 | +import br.com.centralit.framework.controller.GenericController; | |
13 | +import br.com.centralit.framework.json.ResponseBodyWrapper; | |
14 | +import br.com.centralit.framework.json.Views; | |
15 | +import br.com.centralit.framework.json.Views.EnderecoEstoqueView; | |
16 | + | |
17 | +@Controller | |
18 | +@RequestMapping("/rest/enderecoEstoque") | |
19 | +public class EnderecoEstoqueController extends GenericController<EnderecoEstoque>{ | |
20 | + | |
21 | + private EnderecoEstoqueService enderecoEstoqueService; | |
22 | + | |
23 | + @Autowired | |
24 | + public EnderecoEstoqueController(EnderecoEstoqueService enderecoEstoqueService) { | |
25 | + super(enderecoEstoqueService); | |
26 | + this.enderecoEstoqueService = enderecoEstoqueService; | |
27 | + } | |
28 | + | |
29 | + @RequestMapping(value = "/findAutoComplete", method = RequestMethod.GET, produces = "application/json") | |
30 | + @ResponseBody | |
31 | + public ResponseBodyWrapper findAutoComplete(@RequestParam(value = "chave") String chave, @RequestParam(value = "valor") String valor) { | |
32 | + | |
33 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(this.enderecoEstoqueService.findAutoComplete(chave, valor), getAutoCompleteView()); | |
34 | + | |
35 | + return responseBody; | |
36 | + } | |
37 | + | |
38 | + @Override | |
39 | + public Class<EnderecoEstoqueView> getEditView() { | |
40 | + | |
41 | + return Views.EnderecoEstoqueView.class; | |
42 | + } | |
43 | + | |
44 | +} | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/listener/StartupListenerAlmoxarifado.java
... | ... | @@ -291,6 +291,13 @@ public class StartupListenerAlmoxarifado extends UtilStartup implements Applicat |
291 | 291 | |
292 | 292 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.VALORUNITARIOMEDIO", "Valor unitário médio", dominio, modulo)); |
293 | 293 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.RESTOMEDIO", "Resto médio", dominio, modulo)); |
294 | + | |
295 | + //Endereco Estoque | |
296 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.ENDERECO_ESTOQUE", "Endereço de Estoque", dominio, modulo)); | |
297 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.ENDERECO_SUPERIOR", "Endereço Superior", dominio, modulo)); | |
298 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.ENDERECO_SUPERIOR_DESCRICAO", "Desc. Endereço Superior", dominio, modulo)); | |
299 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.ACOMODA_MATERIAL", "Acomoda Materiais", dominio, modulo)); | |
300 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.LABEL.ENDERECO_ESTOQUE_TODOS_MATERIAL", "Adicionar endereço para todos os materiais", dominio, modulo)); | |
294 | 301 | |
295 | 302 | } |
296 | 303 | |
... | ... | @@ -312,7 +319,8 @@ public class StartupListenerAlmoxarifado extends UtilStartup implements Applicat |
312 | 319 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.VALIDACAO.ERRO_EDICAO_EXISTE_MOVIMENTACAO", "Não foi possível realizar a edição pois existe movimentações após o atendimento", dominio, modulo)); |
313 | 320 | |
314 | 321 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.VALIDACAO.QUANTIDADE_ZERADA_NEGATIVA", "A quantidade a atender está zerada ou vazia do seguinte material: ", dominio, modulo)); |
315 | - | |
322 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.VALIDACAO.REMOVER_ENDERECO_ESTOQUE_NEGADA", "O endereço não pode ser removido, pois está vinculado a um material de consumo", dominio, modulo)); | |
323 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.VALIDACAO.NAO_PERMITIDO_ENDERECO_ESTOQUE_ACOMODA_MATERIAL", "Não foi permitido atualizar o registro, o endereço em questão é um endereço superior de outros endereços, logo não é possivel indicar o endereço como uma acomodação de materiais.", dominio, modulo)); | |
316 | 324 | |
317 | 325 | } |
318 | 326 | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EnderecoEstoqueController.js
0 → 100644
... | ... | @@ -0,0 +1,119 @@ |
1 | +'use strict'; | |
2 | + | |
3 | +citApp.controller('EnderecoEstoqueController', ['$scope', 'EnderecoEstoqueRepository', '$translate', '$timeout', 'EstruturaOrganizacionalAlmoxarifadoRepository', | |
4 | + function EnderecoEstoqueController($scope, EnderecoEstoqueRepository, $translate, $timeout, EstruturaOrganizacionalAlmoxarifadoRepository) { | |
5 | + | |
6 | + $scope.resetForm = function() { | |
7 | + $scope.bloquearAcomodacaoMaterial = false; | |
8 | + $scope.bloquearAcomodacaoMaterial = false; | |
9 | + $scope.enderecoEstoque = {}; | |
10 | + EstruturaOrganizacionalAlmoxarifadoRepository.getAlmoxarifadoPadrao($scope.usuarioLogado.organizacao.id).then(function(result){ | |
11 | + $scope.estruturaAlmoxarifadoPadrao = {}; | |
12 | + if(result.originalElement.estruturaOrganizacional){ | |
13 | + $scope.enderecoEstoque = { estoque : {almoxarifado : result.originalElement.estruturaOrganizacional}}; | |
14 | + } | |
15 | + $scope.edit = true; | |
16 | + $timeout(function(){ | |
17 | + $scope.enderecoEstoqueForm.$submitted = false; | |
18 | + $scope.enderecoEstoqueForm.$setPristine(); | |
19 | + }); | |
20 | + }); | |
21 | + }; | |
22 | + | |
23 | + // Atualiza pagina de pesquisa | |
24 | + $scope.atualizaPaginaPesquisa = function () { | |
25 | + angular.element('#searchEnderecoEstoque').scope().fetchResult(); | |
26 | + }; | |
27 | + | |
28 | + // MODAL QUE CONFIRMA REMOVER DA CIDADE | |
29 | + $scope.remove = function(enderecoEstoque){ | |
30 | + $scope.enderecoEstoque = enderecoEstoque; | |
31 | + $scope.$openModalConfirm({ | |
32 | + message: $translate.instant('MSG.CONFIRMA_EXCLUSAO'), | |
33 | + callback: function () { | |
34 | + EnderecoEstoqueRepository.remove($scope.enderecoEstoque).then(function() { | |
35 | + | |
36 | + $scope.$modalConfirmInstance.dismiss('cancel'); | |
37 | + $scope.showAlert("success", $translate.instant('MSG.REGISTRO_EXCLUIDO')); | |
38 | + angular.element('#searchEnderecoEstoque').scope().fetchResult(); | |
39 | + | |
40 | + $scope.resetForm(); | |
41 | + }); | |
42 | + } | |
43 | + }); | |
44 | + }; | |
45 | + | |
46 | + // SALVA O EnderecoEstoque | |
47 | + $scope.saveOrUpdate = function(){ | |
48 | + $scope.enderecoEstoqueForm.$submitted = true; | |
49 | + | |
50 | + //verifica se o formulario está valido para salvar | |
51 | + if($scope.enderecoEstoqueForm.$valid){ | |
52 | + | |
53 | + $scope.setLoadingSalva(true); | |
54 | + | |
55 | + EnderecoEstoqueRepository.save($scope.enderecoEstoque).then(function(result) { | |
56 | + $scope.enderecoEstoque = result.originalElement; | |
57 | + $scope.showAlert("success", $translate.instant('MSG.REGISTRO_SALVO')); | |
58 | + $scope.enderecoEstoqueForm.$submitted = false; | |
59 | + | |
60 | + $scope.$showPageSearchWorkspace($scope.workspace); | |
61 | + angular.element('#searchEnderecoEstoque').scope().fetchResult(); | |
62 | + | |
63 | + }); | |
64 | + $scope.setLoading(false); | |
65 | + }else{ | |
66 | + //Mensagem de erro de campos obrigatorios não preenchidos | |
67 | + $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'), " ", false); | |
68 | + } | |
69 | + }; | |
70 | + | |
71 | + $scope.getEnderecoEstoque = function(enderecoEstoque, edit){ | |
72 | + $scope.setLoadingGet(true); | |
73 | + | |
74 | + EnderecoEstoqueRepository.get(enderecoEstoque.id).then(function(result) { | |
75 | + $scope.enderecoEstoque = result.originalElement; | |
76 | + $scope.edit = edit; | |
77 | + $scope.verificaBloquearAcomodacaoMaterial(); | |
78 | + $scope.verificaBloquearEnderecoTotalMaterial(); | |
79 | + $scope.setLoading(false); | |
80 | + }); | |
81 | + }; | |
82 | + | |
83 | + $scope.findAutoCompleteAlmoxarifado = function(value){ | |
84 | + return EstruturaOrganizacionalAlmoxarifadoRepository.listarEstruturasOrganizacionaisAlmoxarifadoPorOrganizacao(value, $scope.usuarioLogado.organizacao.id).then(function(result) { | |
85 | + return result; | |
86 | + }); | |
87 | + }; | |
88 | + | |
89 | + $scope.findAutoCompleteEnderecoSuperior = function(value){ | |
90 | + return EnderecoEstoqueRepository.findAutoComplete('codigo', value).then(function(result) { | |
91 | + return result; | |
92 | + }); | |
93 | + }; | |
94 | + | |
95 | + $scope.validaEnderecoTodosMaterial = function(){ | |
96 | + $timeout(function(){ | |
97 | + if($scope.enderecoEstoque.enderTodoMaterial){ | |
98 | + $scope.showAlert('warning', $translate.instant('ALMOXARIFADO.VALIDACAO.ENDERECO_ESTOQUE_TODOS_MATERIAIS'), " ", false); | |
99 | + } | |
100 | + }); | |
101 | + } | |
102 | + | |
103 | + $scope.verificaBloquearAcomodacaoMaterial = function(){ | |
104 | + if(!$scope.edit){ | |
105 | + $scope.bloquearAcomodacaoMaterial = true; | |
106 | + }else if($scope.enderecoEstoque.materiais && $scope.enderecoEstoque.materiais.length > 0 && $scope.enderecoEstoque.id){ | |
107 | + $scope.bloquearAcomodacaoMaterial = true; | |
108 | + } | |
109 | + }; | |
110 | + | |
111 | + $scope.verificaBloquearEnderecoTotalMaterial = function(){ | |
112 | + if(!$scope.edit){ | |
113 | + $scope.bloquearEnderecoTotalMaterial = true; | |
114 | + }else if($scope.enderecoEstoque.enderTodoMaterial && $scope.enderecoEstoque.id){ | |
115 | + $scope.bloquearEnderecoTotalMaterial = true; | |
116 | + } | |
117 | + }; | |
118 | + | |
119 | +}]); | |
0 | 120 | \ No newline at end of file | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EnderecoEstoqueListController.js
0 → 100644
... | ... | @@ -0,0 +1,43 @@ |
1 | +'use strict'; | |
2 | + | |
3 | +citApp.controller('EnderecoEstoqueListController', ['$scope', 'EnderecoEstoqueRepository', '$translate', '$timeout', 'DominioRepository', | |
4 | + function EnderecoEstoqueListController($scope, EnderecoEstoqueRepository, $translate, $timeout, DominioRepository) { | |
5 | + $scope.$showAdvancedFilters = false; | |
6 | + | |
7 | + $scope.resetForm = function() { | |
8 | + angular.element("#editEnderecoEstoque").scope().resetForm(); | |
9 | + }; | |
10 | + | |
11 | + $scope.headers = [ | |
12 | + {title : $translate.instant('LABEL.CODIGO'), value : 'codigo', tamanho : 15} , | |
13 | + {title : $translate.instant('LABEL.DESCRICAO'), value : 'descricao' }, | |
14 | + {title : $translate.instant('ALMOXARIFADO.LABEL.ENDERECO_SUPERIOR_DESCRICAO'), value : 'endeEstoqSuperior.descricao' }, | |
15 | + {title : $translate.instant('ALMOXARIFADO.LABEL.ACOMODA_MATERIAL'), value : 'acomodaMaterial'} | |
16 | + ]; | |
17 | + | |
18 | + $scope.filterCriteria = { | |
19 | + start : 1, | |
20 | + dir : 'asc', | |
21 | + sort : 'id', | |
22 | + limit : 10, | |
23 | + fields: ['id', 'codigo', 'descricao', 'endeEstoqSuperior.descricao', 'acomodaMaterial'], | |
24 | + filters : [ {type: 'numeric', field: 'id', comparison: 'in', notFilter : true}, | |
25 | + {type : 'numeric-range', field : 'codigo' } , | |
26 | + {type : 'string', field : 'descricao' } , | |
27 | + {type : 'string', field : 'endeEstoqSuperior.descricao' } , | |
28 | + {type : 'boolean', field : 'acomodaMaterial' } | |
29 | + ] | |
30 | + }; | |
31 | + | |
32 | + // ABRI EnderecoEstoque SELECIONADA | |
33 | + $scope.abrirVisualizar = function(edit){ | |
34 | + var enderecoEstoque = $scope.enderecoEstoqueChecked; | |
35 | + | |
36 | + if(!enderecoEstoque) { | |
37 | + $scope.showAlert('warning', !edit ? $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_VISUALIZACAO') : $translate.instant('MSG.SELECIONE_UM_ITEM_PARA_EDICAO')); | |
38 | + return; | |
39 | + } | |
40 | + angular.element('#editEnderecoEstoque').scope().getEnderecoEstoque(enderecoEstoque, edit); | |
41 | + $scope.$showPageEditWorkspace($scope.workspace); | |
42 | + }; | |
43 | +}]); | |
0 | 44 | \ No newline at end of file | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/repository/EnderecoEstoqueRepository.js
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +'use strict'; | |
2 | + | |
3 | +citApp.factory('EnderecoEstoqueRepository', ['RestangularAlmoxarifado', 'AbstractRepository', function (restangularAlmoxarifado, AbstractRepository) { | |
4 | + | |
5 | + function EnderecoEstoqueRepository() { | |
6 | + AbstractRepository.call(this, restangularAlmoxarifado, 'rest/enderecoEstoque'); | |
7 | + } | |
8 | + | |
9 | + AbstractRepository.extend(EnderecoEstoqueRepository); | |
10 | + | |
11 | + return new EnderecoEstoqueRepository(); | |
12 | +}]); | ... | ... |
cit-almoxarifado-web/src/main/webapp/html/enderecoEstoque/enderecoEstoque.html
0 → 100644
cit-almoxarifado-web/src/main/webapp/html/enderecoEstoque/enderecoEstoqueEdit.html
0 → 100644
... | ... | @@ -0,0 +1,94 @@ |
1 | +<div id="editEnderecoEstoque" class="page-content clearfix" ng-controller="EnderecoEstoqueController"> | |
2 | + <div class="bar-buttons-action fixed"> | |
3 | + <div class="row"> | |
4 | + <div class="col-sm-8 text-left"> | |
5 | + | |
6 | + <button class="btn btn-clear" ng-click="saveOrUpdate()" ng-show="edit"> | |
7 | + <i class="fa fa-save green"></i> <translate>LABEL.SALVAR</translate> | |
8 | + </button> | |
9 | + | |
10 | + <button class="btn btn-clear" ng-click="limparLocalEstoque()" ng-show="enderecoEstoque.id === undefined"> | |
11 | + <i class="fa fa-eraser yellow-dark"></i> <translate>LABEL.LIMPAR</translate> | |
12 | + </button> | |
13 | + | |
14 | + <button class="btn btn-clear" ng-show="!edit" ng-click="edit = true"> | |
15 | + <i class="fa fa-pencil blue"></i> | |
16 | + <translate>LABEL.EDITAR</translate> | |
17 | + </button> | |
18 | + | |
19 | + <button class="btn btn-clear" ng-click="remove(enderecoEstoque);" ng-show="enderecoEstoque.id !== undefined"> | |
20 | + <i class="fa fa-times red"></i> <translate>LABEL.REMOVER</translate> | |
21 | + </button> | |
22 | + | |
23 | + <bloquear-desbloquear ng-model="enderecoEstoque" ng-repository="LocalEstoqueRepository" ng-edit="edit" form="enderecoEstoqueForm"></bloquear-desbloquear> | |
24 | + | |
25 | + <button class="btn btn-clear" ng-click="$showPageSearchWorkspace(workspace); atualizaPaginaPesquisa();"> | |
26 | + <i class="fa fa-search"></i> <translate>LABEL.PESQUISAR</translate> | |
27 | + </button> | |
28 | + | |
29 | + </div><!-- .col --> | |
30 | + | |
31 | + <div class="col-sm-4 text-right"> | |
32 | + | |
33 | + <favorito/> | |
34 | + | |
35 | + <help-button workspace="workspace" /> | |
36 | + | |
37 | + </div><!-- .col --> | |
38 | + </div><!-- .row --> | |
39 | + </div><!-- .bar-buttons-action --> | |
40 | + | |
41 | + <breadcrumb ng-workspace="workspace"></breadcrumb> | |
42 | + | |
43 | + <form name="enderecoEstoqueForm"> | |
44 | + <p> | |
45 | + <small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small> | |
46 | + </p> | |
47 | + | |
48 | + <fieldset> | |
49 | + | |
50 | + <legend><translate>ALMOXARIFADO.LABEL.ENDERECO_ESTOQUE</translate></legend> | |
51 | + | |
52 | + <div class="row"> | |
53 | + <div class="col-md-8"> | |
54 | + <auto-complete ng-id="enderecoEstoque.estoque.almoxarifado" ng-label="ALMOXARIFADO.LABEL.ALMOXARIFADO" ng-model="enderecoEstoque.estoque.almoxarifado" form="enderecoEstoqueForm" ng-obrigatorio="true" ng-disabled="!edit" ng-find="findAutoCompleteAlmoxarifado(value)" ng-item="item.nome" /> | |
55 | + </div> | |
56 | + <div class="col-md-4"> | |
57 | + <label-input ng-type="text" ng-id="enderecoEstoque.codigo" ng-label="LABEL.CODIGO" ng-model="enderecoEstoque.codigo" form="enderecoEstoqueForm" ng-disabled="true" /> | |
58 | + </div> | |
59 | + </div> | |
60 | + | |
61 | + <div class="row"> | |
62 | + <div class="col-md-8"> | |
63 | + <label-input ng-type="text" ng-id="enderecoEstoque.descricao" ng-label="LABEL.DESCRICAO" ng-model="enderecoEstoque.descricao" form="enderecoEstoqueForm" ng-obrigatorio="true" ng-disabled="!edit" ng-custom-maxlength="400"/> | |
64 | + </div> | |
65 | + <div class="col-md-4"> | |
66 | + <label-input ng-type="text" ng-id="enderecoEstoque.sigla" ng-label="LABEL.SIGLA" ng-model="enderecoEstoque.sigla" form="enderecoEstoqueForm" ng-disabled="!edit" ng-custom-maxlength="400"/> | |
67 | + </div> | |
68 | + </div> | |
69 | + | |
70 | + <div class="row"> | |
71 | + <div class="col-md-8"> | |
72 | + <auto-complete ng-id="enderecoEstoque.endeEstoqSuperior" ng-label="ALMOXARIFADO.LABEL.ENDERECO_SUPERIOR" ng-model="enderecoEstoque.endeEstoqSuperior" form="enderecoEstoqueForm" ng-disabled="!edit" ng-find="findAutoCompleteEnderecoSuperior(value)" ng-item="item.codigo + ' / ' + item.descricao" /> | |
73 | + </div> | |
74 | + <div class="col-sm-4"> | |
75 | + <label-input-checkbox ng-model="enderecoEstoque.acomodaMaterial" ng-disabled="bloquearAcomodacaoMaterial" ng-label="ALMOXARIFADO.LABEL.ACOMODA_MATERIAL" form="enderecoEstoqueForm"/> | |
76 | + </div> | |
77 | + </div> | |
78 | + | |
79 | + <div class="row"> | |
80 | + <div class="col-sm-12"> | |
81 | + <label-input-checkbox ng-model="enderecoEstoque.enderTodoMaterial" ng-disabled="bloquearEnderecoTotalMaterial" ng-label="ALMOXARIFADO.LABEL.ENDERECO_ESTOQUE_TODOS_MATERIAL" form="enderecoEstoqueForm" ng-custom-change="validaEnderecoTodosMaterial()"/> | |
82 | + </div> | |
83 | + </div> | |
84 | + | |
85 | + </fieldset> | |
86 | + </form> | |
87 | +</div><!-- .page-content --> | |
88 | + | |
89 | + | |
90 | + | |
91 | + | |
92 | + | |
93 | + | |
94 | + | ... | ... |
cit-almoxarifado-web/src/main/webapp/html/enderecoEstoque/enderecoEstoqueList.html
0 → 100644
... | ... | @@ -0,0 +1,46 @@ |
1 | +<div id="searchEnderecoEstoque" class="page-content" ng-controller="EnderecoEstoqueListController"> | |
2 | + <div class="bar-buttons-action fixed"> | |
3 | + <div class="row"> | |
4 | + <div class="col-sm-8 text-left"> | |
5 | + | |
6 | + <button class="btn btn-clear" ng-click="$showPageEditWorkspace(workspace); resetForm();"> | |
7 | + <i class="fa fa-plus-circle yellow-dark"></i> | |
8 | + <translate>LABEL.CADASTRAR</translate> | |
9 | + </button> | |
10 | + | |
11 | + <button class="btn btn-clear" ng-click="abrirVisualizar(false);"> | |
12 | + <i class="fa fa-search blue"></i> | |
13 | + <translate>LABEL.VISUALIZAR</translate> | |
14 | + </button> | |
15 | + | |
16 | + <button class="btn btn-clear" ng-click="abrirVisualizar(true);"> | |
17 | + <i class="fa fa-pencil blue"></i> | |
18 | + <translate>LABEL.EDITAR</translate> | |
19 | + </button> | |
20 | + | |
21 | + <button class="btn btn-clear" ng-click="remove();"> | |
22 | + <i class="fa fa-times red"></i> | |
23 | + <translate>LABEL.REMOVER</translate> | |
24 | + </button> | |
25 | + | |
26 | + <span class="divider-vertical"></span> | |
27 | + | |
28 | + <filtros ng-filter="filterCriteria" ng-workspace="workspace"></filtros> | |
29 | + | |
30 | + </div><!-- .col --> | |
31 | + | |
32 | + <div class="col-sm-4 text-right"> | |
33 | + | |
34 | + <favorito/> | |
35 | + | |
36 | + <help-button workspace="workspace" /> | |
37 | + | |
38 | + </div><!-- .col --> | |
39 | + </div><!-- .row --> | |
40 | + </div><!-- .bar-buttons-action --> | |
41 | + | |
42 | + <breadcrumb ng-workspace="workspace"></breadcrumb> | |
43 | + | |
44 | + <list-view ng-lista="enderecoEstoqueList" ng-repository="EnderecoEstoqueRepository" ng-headers="headers" ng-exibir-boolean-sim-nao="true" ng-filter-criteria="filterCriteria" ng-item-selecionado="enderecoEstoqueChecked"></list-view> | |
45 | + | |
46 | +</div><!-- .page-content --> | ... | ... |
-
mentioned in commit 95af43d977db6810720378ef53cae11e1f5af76a