Commit fbbfa82f860a2cfa8514b2e47a04307db34f1225
1 parent
503ef8c8
Exists in
master
Redmine #3948 - alteracoes rma (merge branch 3498)
Showing
11 changed files
with
162 additions
and
30 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/BaixaAlmoxarifado.java
... | ... | @@ -12,6 +12,9 @@ import javax.persistence.OneToMany; |
12 | 12 | import javax.persistence.Temporal; |
13 | 13 | import javax.persistence.TemporalType; |
14 | 14 | |
15 | +import org.hibernate.envers.Audited; | |
16 | +import org.hibernate.envers.NotAudited; | |
17 | + | |
15 | 18 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
16 | 19 | import br.com.centralit.framework.json.JsonCalendarSimpleDateDeserializer; |
17 | 20 | import br.com.centralit.framework.json.JsonCalendarSimpleDateSerializer; |
... | ... | @@ -53,6 +56,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
53 | 56 | * @author rogerio.costa |
54 | 57 | * |
55 | 58 | */ |
59 | +@Audited | |
56 | 60 | @Entity |
57 | 61 | public class BaixaAlmoxarifado extends Baixa { |
58 | 62 | |
... | ... | @@ -88,6 +92,7 @@ public class BaixaAlmoxarifado extends Baixa { |
88 | 92 | public Parceiro destino; |
89 | 93 | |
90 | 94 | /** Atributo beixaItens. */ |
95 | + @NotAudited | |
91 | 96 | @OneToMany(fetch = FetchType.LAZY, mappedBy = "baixaAlmoxarifado", cascade = CascadeType.ALL) |
92 | 97 | @JsonView({ ViewsAdmMateriais.BaixaAlmoxarifadoListView.class }) |
93 | 98 | private Collection<BaixaAlmoxarifadoItem> baixaItens; | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/MovimentoEstoqueService.java
... | ... | @@ -4,8 +4,10 @@ import java.math.BigDecimal; |
4 | 4 | import java.util.Calendar; |
5 | 5 | |
6 | 6 | import br.com.centralit.api.model.AtendimentoRequisicaoConsumo; |
7 | +import br.com.centralit.api.model.AtendimentoRequisicaoConsumoItem; | |
7 | 8 | import br.com.centralit.api.model.BaixaAlmoxarifado; |
8 | 9 | import br.com.centralit.api.model.Devolucao; |
10 | +import br.com.centralit.api.model.DevolucaoItem; | |
9 | 11 | import br.com.centralit.api.model.EntradaAlmoxarifado; |
10 | 12 | import br.com.centralit.api.model.EstruturaOrganizacional; |
11 | 13 | import br.com.centralit.api.model.MaterialConsumo; |
... | ... | @@ -162,5 +164,31 @@ public interface MovimentoEstoqueService extends GenericService<MovimentoEstoque |
162 | 164 | * @return |
163 | 165 | */ |
164 | 166 | public BigDecimal buscaQuantidadeMovimentadaMaterialPorReferencia(Long materialId, Calendar dataReferencia, Long organizacaoId); |
167 | + | |
168 | + /** | |
169 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
170 | + * | |
171 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
172 | + * | |
173 | + * Método responsável por remover os movimentos de determinado atendimento item | |
174 | + * | |
175 | + * @author juliana.barbosa | |
176 | + * | |
177 | + * @param entity | |
178 | + */ | |
179 | + public void removerMovimentosAtendimentoItem(AtendimentoRequisicaoConsumoItem entity); | |
180 | + | |
181 | + /** | |
182 | + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p> | |
183 | + * | |
184 | + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p> | |
185 | + * | |
186 | + * Método responsável por remover movimentos de devolucao | |
187 | + * | |
188 | + * @author juliana.barbosa | |
189 | + * | |
190 | + * @param entity | |
191 | + */ | |
192 | + public void removerMovimentosDevolucao(DevolucaoItem entity); | |
165 | 193 | |
166 | 194 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/AtendimentoRequisicaoConsumoItemServiceImpl.java
... | ... | @@ -13,6 +13,7 @@ import br.com.centralit.api.model.AtendimentoRequisicaoConsumoItem; |
13 | 13 | import br.com.centralit.api.model.RequisicaoConsumo; |
14 | 14 | import br.com.centralit.api.model.RequisicaoConsumoItem; |
15 | 15 | import br.com.centralit.api.service.AtendimentoRequisicaoConsumoItemService; |
16 | +import br.com.centralit.api.service.ContaContabilMovimentoService; | |
16 | 17 | import br.com.centralit.api.service.MaterialConsumoService; |
17 | 18 | import br.com.centralit.api.service.MovimentoEstoqueService; |
18 | 19 | import br.com.centralit.api.service.RequisicaoConsumoItemService; |
... | ... | @@ -62,6 +63,9 @@ public class AtendimentoRequisicaoConsumoItemServiceImpl extends GenericServiceI |
62 | 63 | |
63 | 64 | @Autowired |
64 | 65 | private RequisicaoConsumoService requisicaoConsumoService; |
66 | + | |
67 | + @Autowired | |
68 | + private ContaContabilMovimentoService contaContabilMovimentoService; | |
65 | 69 | |
66 | 70 | /** |
67 | 71 | * Responsável pela criação de novas instâncias desta classe. |
... | ... | @@ -119,6 +123,11 @@ public class AtendimentoRequisicaoConsumoItemServiceImpl extends GenericServiceI |
119 | 123 | |
120 | 124 | throw new BusinessException(VALIDACAO_ERRO_EXCLUSAO_EXISTE_MOVIMENTACAO, CodigoErro.REGRA_NEGOCIO.getValue()); |
121 | 125 | } |
126 | + | |
127 | + //Remove movimentos do estoque | |
128 | + this.movimentoEstoqueService.removerMovimentosAtendimentoItem(entity); | |
129 | + //Remove movimentos contacontabil | |
130 | + this.contaContabilMovimentoService.removerMovimentosAtendimento(entity.getId()); | |
122 | 131 | |
123 | 132 | return super.remove(entity); |
124 | 133 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/AtendimentoRequisicaoConsumoServiceImpl.java
... | ... | @@ -17,6 +17,7 @@ import br.com.centralit.api.model.AtendimentoRequisicaoConsumoItem; |
17 | 17 | import br.com.centralit.api.model.DominioAlmoxarifado; |
18 | 18 | import br.com.centralit.api.service.AtendimentoRequisicaoConsumoItemService; |
19 | 19 | import br.com.centralit.api.service.AtendimentoRequisicaoConsumoService; |
20 | +import br.com.centralit.api.service.ContaContabilMovimentoService; | |
20 | 21 | import br.com.centralit.api.service.DominioService; |
21 | 22 | import br.com.centralit.api.service.MaterialConsumoService; |
22 | 23 | import br.com.centralit.api.service.MovimentoEstoqueService; |
... | ... | @@ -94,6 +95,9 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl< |
94 | 95 | |
95 | 96 | @Autowired |
96 | 97 | private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService; |
98 | + | |
99 | + @Autowired | |
100 | + private ContaContabilMovimentoService contaContabilMovimentoService; | |
97 | 101 | |
98 | 102 | /** |
99 | 103 | * Responsável pela criação de novas instâncias desta classe. |
... | ... | @@ -175,11 +179,15 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl< |
175 | 179 | |
176 | 180 | AtendimentoRequisicaoConsumo atendimentoRequisicaoConsumo = super.merge(atendimento); |
177 | 181 | |
182 | + //Apaga movimentos de estoque | |
178 | 183 | this.movimentoEstoqueService.removerMovimentosAtendimento(atendimentoRequisicaoConsumo); |
179 | - | |
184 | + | |
185 | + //Apaga movimentos contabeis | |
186 | + for (AtendimentoRequisicaoConsumoItem atendimentoItem : entity.getAtendimentoRequisicaoConsumoItems()){ | |
187 | + this.contaContabilMovimentoService.removerMovimentosAtendimento(atendimentoItem.getId()); | |
188 | + } | |
180 | 189 | this.movimentoEstoqueService.gerarMovimentoAtendimento(atendimentoRequisicaoConsumo); |
181 | - | |
182 | - } | |
190 | + } | |
183 | 191 | |
184 | 192 | } |
185 | 193 | |
... | ... | @@ -328,6 +336,9 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl< |
328 | 336 | |
329 | 337 | prontaParaAtendimento = Boolean.FALSE; |
330 | 338 | } |
339 | + | |
340 | + //Remove movimentos contacontabil | |
341 | + this.contaContabilMovimentoService.removerMovimentosAtendimento(atendimentoRequisicaoConsumoItem.getId()); | |
331 | 342 | } |
332 | 343 | |
333 | 344 | if (prontaParaAtendimento) { |
... | ... | @@ -339,6 +350,7 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl< |
339 | 350 | entity.getRequisicaoConsumo().setTipoStatusRequisicao(this.dominioService.findByChaveAndCodigo(DominioAlmoxarifado.TIPO_STATUS_REQUISICAO, DominioAlmoxarifado.TIPO_STATUS_ATENDIDA_PARCIALMENTE)); |
340 | 351 | } |
341 | 352 | |
353 | + //Remove movimentos estoque | |
342 | 354 | this.movimentoEstoqueService.removerMovimentosAtendimento(entity); |
343 | 355 | |
344 | 356 | return super.remove(entity); | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/BaixaAlmoxarifadoItemServiceImpl.java
... | ... | @@ -16,6 +16,7 @@ import br.com.centralit.api.model.DominioAlmoxarifado; |
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; |
19 | +import br.com.centralit.api.service.ContaContabilMovimentoService; | |
19 | 20 | import br.com.centralit.api.service.DominioService; |
20 | 21 | import br.com.centralit.api.service.MaterialConsumoService; |
21 | 22 | import br.com.centralit.api.service.MovimentoEstoqueService; |
... | ... | @@ -78,6 +79,9 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
78 | 79 | |
79 | 80 | @Autowired |
80 | 81 | private DominioService dominioService; |
82 | + | |
83 | + @Autowired | |
84 | + private ContaContabilMovimentoService contaContabilMovimentoService; | |
81 | 85 | |
82 | 86 | /** |
83 | 87 | * Responsável pela criação de novas instâncias desta classe. |
... | ... | @@ -124,6 +128,7 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
124 | 128 | this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) baixaAlmoxarifadoItem.getMovimentos()); |
125 | 129 | |
126 | 130 | } |
131 | + this.contaContabilMovimentoService.removerMovimentosBaixa(baixaAlmoxarifadoItem.getId()); | |
127 | 132 | } else { |
128 | 133 | |
129 | 134 | throw new BusinessException(MSG_INFORME_DATA_ESTORNO, CodigoErro.REGRA_NEGOCIO.getValue()); |
... | ... | @@ -198,8 +203,8 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
198 | 203 | if (!UtilColecao.isVazio(baixaAlmoxarifadoItem.getMovimentos())) { |
199 | 204 | |
200 | 205 | this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) baixaAlmoxarifadoItem.getMovimentos()); |
201 | - | |
202 | 206 | } |
207 | + this.contaContabilMovimentoService.removerMovimentosBaixa(baixaAlmoxarifadoItem.getId()); | |
203 | 208 | } |
204 | 209 | |
205 | 210 | super.removeList(listEntity); |
... | ... | @@ -213,8 +218,9 @@ public class BaixaAlmoxarifadoItemServiceImpl extends GenericServiceImpl<BaixaAl |
213 | 218 | if (!UtilColecao.isVazio(baixaAlmoxarifadoItem.getMovimentos())) { |
214 | 219 | |
215 | 220 | this.movimentoEstoqueService.removeList((List<MovimentoEstoque>) baixaAlmoxarifadoItem.getMovimentos()); |
216 | - | |
217 | 221 | } |
222 | + | |
223 | + this.contaContabilMovimentoService.removerMovimentosBaixa(id); | |
218 | 224 | |
219 | 225 | baixaAlmoxarifadoItem.setBaixaRemocao(baixaAlmoxarifadoItem.getBaixaAlmoxarifado()); |
220 | 226 | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/BaixaAlmoxarifadoServiceImpl.java
... | ... | @@ -132,13 +132,14 @@ public class BaixaAlmoxarifadoServiceImpl extends GenericServiceImpl<BaixaAlmoxa |
132 | 132 | this.montarObjetoBaixa(entity); |
133 | 133 | |
134 | 134 | entity = super.save(entity); |
135 | - | |
135 | + | |
136 | 136 | configurarNumeroBaixa(entity); |
137 | 137 | |
138 | 138 | salvaTotaisBaixaItem(entity); |
139 | 139 | |
140 | 140 | entity = super.save(entity); |
141 | 141 | |
142 | + //Esse metodo gera os movimentos no estoque no contabil | |
142 | 143 | this.movimentoEstoqueService.gerarMovimentoBaixa(entity); |
143 | 144 | |
144 | 145 | return entity; | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/DevolucaoItemServiceImpl.java
... | ... | @@ -7,7 +7,14 @@ import org.springframework.validation.Validator; |
7 | 7 | |
8 | 8 | |
9 | 9 | |
10 | + | |
11 | + | |
12 | + | |
13 | + | |
14 | + | |
15 | +import br.com.centralit.api.service.ContaContabilMovimentoService; | |
10 | 16 | import br.com.centralit.api.service.DevolucaoItemService; |
17 | +import br.com.centralit.api.service.MovimentoEstoqueService; | |
11 | 18 | import br.com.centralit.api.dao.DevolucaoItemDao; |
12 | 19 | import br.com.centralit.api.model.Devolucao; |
13 | 20 | import br.com.centralit.api.model.DevolucaoItem; |
... | ... | @@ -20,6 +27,12 @@ import br.com.centralit.framework.util.UtilObjeto; |
20 | 27 | public class DevolucaoItemServiceImpl extends GenericServiceImpl<DevolucaoItem, Long> implements DevolucaoItemService { |
21 | 28 | |
22 | 29 | private DevolucaoItemDao devolucaoItemDao; |
30 | + | |
31 | + @Autowired | |
32 | + public MovimentoEstoqueService movimentoEstoqueService; | |
33 | + | |
34 | + @Autowired | |
35 | + public ContaContabilMovimentoService contaContabilMovimentoService; | |
23 | 36 | |
24 | 37 | @Autowired |
25 | 38 | public DevolucaoItemServiceImpl(DevolucaoItemDao devolucaoItemDao, @Qualifier("devolucaoItemValidator") Validator validator) { |
... | ... | @@ -73,4 +86,27 @@ public class DevolucaoItemServiceImpl extends GenericServiceImpl<DevolucaoItem, |
73 | 86 | |
74 | 87 | } |
75 | 88 | } |
89 | + | |
90 | + @Override | |
91 | + public boolean remove(DevolucaoItem entity) { | |
92 | + | |
93 | + //Remove movimentos estoque | |
94 | + this.movimentoEstoqueService.removerMovimentosDevolucao(entity); | |
95 | + //Remove movimentos contacontabil | |
96 | + this.contaContabilMovimentoService.removerMovimentosDevolucao(entity.getId()); | |
97 | + | |
98 | + return super.remove(entity); | |
99 | + } | |
100 | + | |
101 | + @Override | |
102 | + public boolean removeById(Long id) { | |
103 | + DevolucaoItem dev = this.find(id); | |
104 | + | |
105 | + //Remove movimentos estoque | |
106 | + this.movimentoEstoqueService.removerMovimentosDevolucao(dev); | |
107 | + //Remove movimentos contacontabil | |
108 | + this.contaContabilMovimentoService.removerMovimentosDevolucao(dev.getId()); | |
109 | + | |
110 | + return super.removeById(dev.getId()); | |
111 | + } | |
76 | 112 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/DevolucaoServiceImpl.java
... | ... | @@ -16,6 +16,7 @@ import br.com.centralit.api.model.DevolucaoItem; |
16 | 16 | import br.com.centralit.api.model.DevolucaoObservacao; |
17 | 17 | import br.com.centralit.api.service.AnexoService; |
18 | 18 | import br.com.centralit.api.service.ConfiguracaoParametroSistemaService; |
19 | +import br.com.centralit.api.service.ContaContabilMovimentoService; | |
19 | 20 | import br.com.centralit.api.service.DevolucaoItemService; |
20 | 21 | import br.com.centralit.api.service.DevolucaoService; |
21 | 22 | import br.com.centralit.api.service.DominioService; |
... | ... | @@ -65,6 +66,9 @@ public class DevolucaoServiceImpl extends GenericServiceImpl<Devolucao, Long> im |
65 | 66 | |
66 | 67 | @Autowired |
67 | 68 | private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService; |
69 | + | |
70 | + @Autowired | |
71 | + private ContaContabilMovimentoService contaContabilMovimentoService; | |
68 | 72 | |
69 | 73 | @Autowired |
70 | 74 | public DevolucaoServiceImpl( DevolucaoDao devolucaoDao, @Qualifier("devolucaoValidator") Validator validator ) { |
... | ... | @@ -188,6 +192,11 @@ public class DevolucaoServiceImpl extends GenericServiceImpl<Devolucao, Long> im |
188 | 192 | public boolean remove(Devolucao entity) { |
189 | 193 | |
190 | 194 | this.devolucaoItemService.calcularQuantidadeDevolvida(entity, Boolean.FALSE); |
195 | + | |
196 | + for (DevolucaoItem devolucaoItem : entity.getDevolucaoItens()) { | |
197 | + this.movimentoEstoqueService.removerMovimentosDevolucao(devolucaoItem); | |
198 | + this.contaContabilMovimentoService.removerMovimentosDevolucao(devolucaoItem.getId()); | |
199 | + } | |
191 | 200 | |
192 | 201 | return super.remove(entity); |
193 | 202 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/MovimentoEstoqueServiceImpl.java
... | ... | @@ -110,7 +110,8 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
110 | 110 | private MaterialConsumoService materialConsumoService; |
111 | 111 | |
112 | 112 | @Autowired |
113 | - private OrganizacaoService organizacaoService; | |
113 | + private OrganizacaoService organizacaoService; | |
114 | + | |
114 | 115 | |
115 | 116 | /** |
116 | 117 | * Responsável pela criação de novas instâncias desta classe. |
... | ... | @@ -146,8 +147,16 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
146 | 147 | movimentos.add(movimentoEstoque); |
147 | 148 | |
148 | 149 | this.materialEstoqueSaldoMedioService.atualizaMaterialEstoque(movimentoEstoque.getMaterial(), movimentoEstoque.getQuantidade(), movimentoEstoque.getValorFIFO()); |
149 | - | |
150 | - this.contaContabilMovimentoService.salvaMovimentoEntrada(entradaAlmoxarifadoItem.getMaterial().getContaContabil(), entradaAlmoxarifadoItem.getValorTotal(), entradaAlmoxarifadoItem.getEntrada()); | |
150 | + Dominio tipoSaldoEntrada = new Dominio(); | |
151 | + if (UtilObjeto.isReferencia(entradaAlmoxarifado.getDominioTipoEntrada())){ | |
152 | + if (entradaAlmoxarifado.getDominioTipoEntrada().getCodigo() == Dominio.TIPO_ENTRADA_ALMOXARIFADO_EXTRA_ORCAMENTARIA_CODIGO){ | |
153 | + tipoSaldoEntrada= this.dominioService.findByChaveAndCodigo(Dominio.TIPO_MOVIMENTO_CONTA_CONTABIL, Dominio.TIPO_MOVIMENTO_CONTA_CONTABIL_ENTRADA_EXTRAORCAMENTARIA_CODIGO); | |
154 | + }else{ | |
155 | + tipoSaldoEntrada = this.dominioService.findByChaveAndCodigo(Dominio.TIPO_MOVIMENTO_CONTA_CONTABIL, Dominio.TIPO_MOVIMENTO_CONTA_CONTABIL_ENTRADA_ORCAMENTARIA_CODIGO); | |
156 | + } | |
157 | + } | |
158 | + | |
159 | + this.contaContabilMovimentoService.salvaMovimentoEntradaAlmoxarifado(entradaAlmoxarifadoItem.getMaterial().getContaContabil(), entradaAlmoxarifadoItem.getValorTotal(), entradaAlmoxarifadoItem.getId(), entradaAlmoxarifadoItem.getEntrada(), tipoSaldoEntrada); | |
151 | 160 | } |
152 | 161 | |
153 | 162 | this.saveList(movimentos); |
... | ... | @@ -163,6 +172,14 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
163 | 172 | |
164 | 173 | this.removeList(movimentosEntrada); |
165 | 174 | } |
175 | + | |
176 | + @Override | |
177 | + public void removerMovimentosDevolucao(DevolucaoItem entity) { | |
178 | + | |
179 | + List<MovimentoEstoque> movimentosDevolucao = this.movimentoEstoqueDao.listarMovimentos(entity, "devolucaoItem.id"); | |
180 | + | |
181 | + this.removeList(movimentosDevolucao); | |
182 | + } | |
166 | 183 | |
167 | 184 | /** |
168 | 185 | * <p> |
... | ... | @@ -196,7 +213,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
196 | 213 | public void gerarMovimentoDevolucao(Devolucao devolucao) { |
197 | 214 | |
198 | 215 | Dominio tipoMovimentoDevolucao = this.dominioService.findByChaveAndCodigo(DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE, DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE_DEVOLUCAO); |
199 | - Dominio classeReferenciaDevolucao = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_DEVOLUCAO); | |
216 | + Dominio classeReferenciaDevolucao = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_DEVOLUCAO_ITEM); | |
200 | 217 | |
201 | 218 | List<MovimentoEstoque> movimentos = new ArrayList<MovimentoEstoque>(); |
202 | 219 | |
... | ... | @@ -218,9 +235,9 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
218 | 235 | String tipoAvaliacao = this.configuracaoParametroSistemaService.getParametro("TIPO_AVALIACAO_MONETARIA_ESTOQUE", devolucao.getOrganizacao()).getValor(); |
219 | 236 | |
220 | 237 | if (DominioAlmoxarifado.TIPO_AVALIACAO_MONETARIA_FIFO_NOME == tipoAvaliacao) { //Realiza movimento de entrada em conta contábil baseado em FIFO se estiver configurado como tal. |
221 | - this.contaContabilMovimentoService.salvaMovimentoEntrada(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoFIFO, classeReferenciaDevolucao, devolucao.getId()); | |
238 | + this.contaContabilMovimentoService.salvaMovimentoDevolucao(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoFIFO, classeReferenciaDevolucao, devolucaoItem.getId()); | |
222 | 239 | } else { //Realiza movimento de entrada em conta contábil baseado em Média Móvel (Padrão) |
223 | - this.contaContabilMovimentoService.salvaMovimentoEntrada(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoMediaMovel, classeReferenciaDevolucao, devolucao.getId()); | |
240 | + this.contaContabilMovimentoService.salvaMovimentoEntrada(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoMediaMovel, classeReferenciaDevolucao, devolucaoItem.getId()); | |
224 | 241 | } |
225 | 242 | } |
226 | 243 | |
... | ... | @@ -245,7 +262,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
245 | 262 | public void gerarMovimentoBaixa(BaixaAlmoxarifado baixaAlmoxarifado) { |
246 | 263 | |
247 | 264 | Dominio tipoMovimentoBaixa = this.dominioService.findByChaveAndCodigo(DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE, DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE_BAIXA); |
248 | - Dominio classeReferenciaBaixa = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA); | |
265 | + Dominio classeReferenciaBaixa = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA_ALMOXARIFADO_ITEM); | |
249 | 266 | |
250 | 267 | List<MovimentoEstoque> movimentos = new ArrayList<MovimentoEstoque>(); |
251 | 268 | |
... | ... | @@ -266,15 +283,16 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
266 | 283 | String tipoAvaliacao = this.configuracaoParametroSistemaService.getParametro("TIPO_AVALIACAO_MONETARIA_ESTOQUE", baixaAlmoxarifado.getOrganizacao()).getValor(); |
267 | 284 | |
268 | 285 | if (DominioAlmoxarifado.TIPO_AVALIACAO_MONETARIA_FIFO_NOME == tipoAvaliacao) { //Realiza movimento de saida em conta contábil baseado em FIFO se estiver configurado como tal. |
269 | - this.contaContabilMovimentoService.salvaMovimentoSaida(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoFIFO, classeReferenciaBaixa, baixaAlmoxarifado.getId()); | |
286 | + this.contaContabilMovimentoService.salvaMovimentoSaidaBaixaAlmoxarifado(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoFIFO, classeReferenciaBaixa, baixaAlmoxarifadoItem.getId(), baixaAlmoxarifado); | |
270 | 287 | } else { //Realiza movimento de saida em conta contábil baseado em Média Móvel (Padrão) |
271 | - this.contaContabilMovimentoService.salvaMovimentoSaida(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoMediaMovel, classeReferenciaBaixa, baixaAlmoxarifado.getId()); | |
288 | + this.contaContabilMovimentoService.salvaMovimentoSaidaBaixaAlmoxarifado(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoMediaMovel, classeReferenciaBaixa, baixaAlmoxarifadoItem.getId(), baixaAlmoxarifado); | |
272 | 289 | } |
273 | 290 | } |
274 | 291 | |
275 | 292 | this.saveList(movimentos); |
276 | 293 | |
277 | - } | |
294 | + } | |
295 | + | |
278 | 296 | |
279 | 297 | @Override |
280 | 298 | public void removeList(List<MovimentoEstoque> listEntity) { |
... | ... | @@ -291,17 +309,17 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
291 | 309 | Dominio classeReferencia = null; |
292 | 310 | Long idClasseReferencia = null; |
293 | 311 | if (movimentoEstoque.getAtendimentoRequisicaoConsumoItem() != null) { |
294 | - classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ATENDIMENTO); | |
295 | - idClasseReferencia = movimentoEstoque.getAtendimentoRequisicaoConsumoItem().getAtendimentoRequisicaoConsumo().getId(); | |
312 | + classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ATENDIMENTO_ALMOXARIFADO_ITEM); | |
313 | + idClasseReferencia = movimentoEstoque.getAtendimentoRequisicaoConsumoItem().getId(); | |
296 | 314 | } else if (movimentoEstoque.getBaixaAlmoxarifadoItem() != null) { |
297 | - classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA); | |
298 | - idClasseReferencia = movimentoEstoque.getBaixaAlmoxarifadoItem().getBaixaAlmoxarifado().getId(); | |
315 | + classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_BAIXA_ALMOXARIFADO_ITEM); | |
316 | + idClasseReferencia = movimentoEstoque.getBaixaAlmoxarifadoItem().getId(); | |
299 | 317 | } else if (movimentoEstoque.getDevolucaoItem() != null) { |
300 | - classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_DEVOLUCAO); | |
301 | - idClasseReferencia = movimentoEstoque.getDevolucaoItem().getDevolucao().getId(); | |
318 | + classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_DEVOLUCAO_ITEM); | |
319 | + idClasseReferencia = movimentoEstoque.getDevolucaoItem().getId(); | |
302 | 320 | } else if (movimentoEstoque.getEntradaAlmoxarifadoItem() != null) { |
303 | - classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ENTRADA); | |
304 | - idClasseReferencia = movimentoEstoque.getEntradaAlmoxarifadoItem().getEntrada().getId(); | |
321 | + classeReferencia = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ENTRADA_ALMOXARIFADO_ITEM); | |
322 | + idClasseReferencia = movimentoEstoque.getEntradaAlmoxarifadoItem().getId(); | |
305 | 323 | } |
306 | 324 | |
307 | 325 | ContaContabilMovimento movimento = this.contaContabilMovimentoService.findByContaAndClasseReferencia(material.getContaContabil(), classeReferencia, idClasseReferencia); |
... | ... | @@ -335,7 +353,7 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
335 | 353 | public void gerarMovimentoAtendimento(AtendimentoRequisicaoConsumo atendimento) { |
336 | 354 | |
337 | 355 | Dominio tipoMovimento = this.dominioService.findByChaveAndCodigo(DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE, DominioAlmoxarifado.TIPO_MOVIMENTO_ESTOQUE_ATENDIMENTO); |
338 | - Dominio classeReferenciaAtendimento = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ATENDIMENTO); | |
356 | + Dominio classeReferenciaAtendimento = this.dominioService.findByChaveAndCodigo(DominioMaterial.CLASSE_REFERENCIA, DominioMaterial.REFERENCIA_ATENDIMENTO_ALMOXARIFADO_ITEM); | |
339 | 357 | |
340 | 358 | List<MovimentoEstoque> movimentos = new ArrayList<MovimentoEstoque>(); |
341 | 359 | |
... | ... | @@ -360,9 +378,9 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
360 | 378 | String tipoAvaliacao = this.configuracaoParametroSistemaService.getParametro("TIPO_AVALIACAO_MONETARIA_ESTOQUE", atendimento.getOrganizacao()).getValor(); |
361 | 379 | |
362 | 380 | if (DominioAlmoxarifado.TIPO_AVALIACAO_MONETARIA_FIFO_NOME == tipoAvaliacao) { //Realiza movimento de saida em conta contábil baseado em FIFO se estiver configurado como tal. |
363 | - this.contaContabilMovimentoService.salvaMovimentoSaida(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoFIFO, classeReferenciaAtendimento, atendimento.getId()); | |
381 | + this.contaContabilMovimentoService.salvaMovimentoSaidaAtendimento(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoFIFO, classeReferenciaAtendimento, atendimentoRequisicaoConsumoItem.getId()); | |
364 | 382 | } else { //Realiza movimento de saida em conta contábil baseado em Média Móvel (Padrão) |
365 | - this.contaContabilMovimentoService.salvaMovimentoSaida(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoMediaMovel, classeReferenciaAtendimento, atendimento.getId()); | |
383 | + this.contaContabilMovimentoService.salvaMovimentoSaidaAtendimento(movimentoEstoque.getMaterial().getContaContabil(), valorMovimentoMediaMovel, classeReferenciaAtendimento, atendimentoRequisicaoConsumoItem.getId()); | |
366 | 384 | } |
367 | 385 | } |
368 | 386 | |
... | ... | @@ -394,6 +412,14 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
394 | 412 | this.removeList(movimentosAtendimento); |
395 | 413 | |
396 | 414 | } |
415 | + | |
416 | + public void removerMovimentosAtendimentoItem(AtendimentoRequisicaoConsumoItem entity) { | |
417 | + | |
418 | + List<MovimentoEstoque> movimentosAtendimento = this.movimentoEstoqueDao.listarMovimentos(entity, "atendimentoRequisicaoConsumoItem.id"); | |
419 | + | |
420 | + this.removeList(movimentosAtendimento); | |
421 | + | |
422 | + } | |
397 | 423 | |
398 | 424 | /** |
399 | 425 | * {@inheritDoc} | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/RequisicaoConsumoServiceImpl.java
... | ... | @@ -284,7 +284,7 @@ public class RequisicaoConsumoServiceImpl extends GenericServiceImpl<RequisicaoC |
284 | 284 | |
285 | 285 | if (this.atendimentoRequisicaoConsumoService.existeAtendimentoRequisicaoConsumo(idRequisicaoConsumo, idOrganizacao)) { |
286 | 286 | |
287 | - throw new BusinessException("MSG.MN020", CodigoErro.REGRA_NEGOCIO.getValue()); | |
287 | + throw new BusinessException("PORTAL.MSG.MN020", CodigoErro.REGRA_NEGOCIO.getValue()); | |
288 | 288 | |
289 | 289 | } |
290 | 290 | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/controller/ContaContabilMovimentoAlmoxarifadoController.java
... | ... | @@ -178,9 +178,9 @@ public class ContaContabilMovimentoAlmoxarifadoController extends GenericControl |
178 | 178 | |
179 | 179 | String apuracao = ""; |
180 | 180 | if (UtilDate.comparaMesAnoReferencia(calendarReferenciaFinal, referenciaVigente) < 0) { |
181 | - apuracao = this.internacionalizacaoService.getTranslate("LABEL.APURACAO_FECHADA", idioma); | |
181 | + apuracao = this.internacionalizacaoService.getTranslate("ADMINISTRACAODEMATERIAIS.LABEL.APURACAO_FECHADA", idioma); | |
182 | 182 | } else { |
183 | - apuracao = this.internacionalizacaoService.getTranslate("LABEL.APURACAO_PARCIAL", idioma); | |
183 | + apuracao = this.internacionalizacaoService.getTranslate("ADMINISTRACAODEMATERIAIS.LABEL.APURACAO_PARCIAL", idioma); | |
184 | 184 | } |
185 | 185 | |
186 | 186 | subReportParameters.put("DATA_REFERENCIA", dataFormatada); | ... | ... |