git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@33151 d1611594-4594-4d17-8e1d-87c2c4800839
parent
8bb81378e7
commit
08b66ff46e
|
@ -4,15 +4,12 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.DetachedCriteria;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.criterion.Property;
|
||||
|
@ -24,6 +21,7 @@ import org.springframework.stereotype.Repository;
|
|||
import com.rjconsultores.ventaboletos.dao.EstacionDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -45,7 +45,7 @@ public class EstacionServiceImpl implements EstacionService {
|
|||
@Transactional(rollbackFor = BusinessException.class)
|
||||
public Estacion suscribirActualizar(Estacion estacion) throws BusinessException {
|
||||
|
||||
validarEstoque(estacion);
|
||||
validarEstoqueUpdate(estacion);
|
||||
|
||||
Boolean esMacDuplicado = Boolean.FALSE;
|
||||
List<Estacion> lsEstacionMac = estacionDAO.buscar(estacion.getDescmac());
|
||||
|
@ -93,7 +93,12 @@ public class EstacionServiceImpl implements EstacionService {
|
|||
|
||||
}
|
||||
|
||||
private void validarEstoque(Estacion estacion) throws BusinessException {
|
||||
private void validarEstoqueUpdate(Estacion estacion) throws BusinessException {
|
||||
|
||||
if (estacion.getEstacionId() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ApplicationProperties.getInstance().generarRotinaFolios()) {
|
||||
Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId());
|
||||
if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())) {
|
||||
|
@ -104,10 +109,18 @@ public class EstacionServiceImpl implements EstacionService {
|
|||
}
|
||||
}
|
||||
|
||||
private void validarEstoqueBorrar(Estacion estacion) throws BusinessException {
|
||||
if (!ApplicationProperties.getInstance().generarRotinaFolios()) {
|
||||
if (estacionDAO.temEstoque(estacion.getPuntoVenta(), estacion)) {
|
||||
throw new BusinessException("estacionServiceImpl.msg.hayStock");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(Estacion entidad) throws BusinessException {
|
||||
|
||||
validarEstoque(entidad);
|
||||
validarEstoqueBorrar(entidad);
|
||||
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
|
|
Loading…
Reference in New Issue