Commit 03da991fe5fec32ff7dd164f3f21fc616efca381

Authored by erick.sato
1 parent 780c5282
Exists in master

Redmine #5043 Update registro excluido atendimento requisição

cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/AtendimentoRequisicaoConsumoServiceImpl.java
@@ -186,9 +186,13 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl< @@ -186,9 +186,13 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl<
186 this.requisicaoConsumoService.atualizarSituacaoAtendimento(atendimento.getRequisicaoConsumo().getId(), false); 186 this.requisicaoConsumoService.atualizarSituacaoAtendimento(atendimento.getRequisicaoConsumo().getId(), false);
187 187
188 }else{ 188 }else{
189 - atendimento.setDataInativo(null); 189 + boolean registroExcluido = false;
  190 + if(atendimento.getDataInativo() != null){
  191 + atendimento.setDataInativo(null);
  192 + registroExcluido = true;
  193 + }
190 atendimento.setDataAtendimento(entity.getDataAtendimento()); 194 atendimento.setDataAtendimento(entity.getDataAtendimento());
191 - this.merge(atendimento); 195 + this.merge(atendimento, registroExcluido);
192 } 196 }
193 } 197 }
194 198
@@ -251,17 +255,19 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl< @@ -251,17 +255,19 @@ public class AtendimentoRequisicaoConsumoServiceImpl extends GenericServiceImpl<
251 * @author wilker.machado 255 * @author wilker.machado
252 * 256 *
253 * @param entity 257 * @param entity
  258 + * @param registroExcluido
254 * @return 259 * @return
255 */ 260 */
256 - @Override  
257 - public AtendimentoRequisicaoConsumo merge(AtendimentoRequisicaoConsumo entity) { 261 + public AtendimentoRequisicaoConsumo merge(AtendimentoRequisicaoConsumo entity, boolean registroExcluido) {
258 262
259 if (this.movimentoEstoqueService.existeMovimentacaoDepois(entity, "idClasseReferencia")) { 263 if (this.movimentoEstoqueService.existeMovimentacaoDepois(entity, "idClasseReferencia")) {
260 264
261 throw new BusinessException(VALIDACAO_ERRO_EDICAO_EXISTE_MOVIMENTACAO, CodigoErro.REGRA_NEGOCIO.getValue()); 265 throw new BusinessException(VALIDACAO_ERRO_EDICAO_EXISTE_MOVIMENTACAO, CodigoErro.REGRA_NEGOCIO.getValue());
262 } 266 }
263 -  
264 - removerLancamentosPassados(entity); 267 +
  268 + if(!registroExcluido){
  269 + removerLancamentosPassados(entity);
  270 + }
265 271
266 this.montarEntidade(entity); 272 this.montarEntidade(entity);
267 273