git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@32816 d1611594-4594-4d17-8e1d-87c2c4800839
parent
69340dea0f
commit
bc6aa0a23d
|
@ -8,7 +8,6 @@ import java.util.List;
|
|||
|
||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +30,7 @@ public interface EstacionService {
|
|||
*/
|
||||
public Estacion suscribirActualizar(Estacion entidad) throws BusinessException;
|
||||
|
||||
public void borrar(Estacion entidad);
|
||||
public void borrar(Estacion entidad) throws BusinessException;
|
||||
|
||||
public List<Estacion> buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv);
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import com.rjconsultores.ventaboletos.dao.EstacionDAO;
|
|||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||
import com.rjconsultores.ventaboletos.entidad.EstacionSitef;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.AutorizaFolioService;
|
||||
import com.rjconsultores.ventaboletos.service.EstacionService;
|
||||
|
@ -46,14 +45,8 @@ public class EstacionServiceImpl implements EstacionService {
|
|||
@Transactional(rollbackFor = BusinessException.class)
|
||||
public Estacion suscribirActualizar(Estacion estacion) throws BusinessException {
|
||||
|
||||
if (!ApplicationProperties.getInstance().generarRotinaFolios()){
|
||||
Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId());
|
||||
if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())){
|
||||
if (estacionDAO.temEstoque(estacionPuntoVentaAnterior.getPuntoVenta(), estacion)){
|
||||
throw new BusinessException("estacionServiceImpl.msg.hayStock");
|
||||
}
|
||||
}
|
||||
}
|
||||
validarEstoque(estacion);
|
||||
|
||||
Boolean esMacDuplicado = Boolean.FALSE;
|
||||
List<Estacion> lsEstacionMac = estacionDAO.buscar(estacion.getDescmac());
|
||||
if (!lsEstacionMac.isEmpty()) {
|
||||
|
@ -100,8 +93,22 @@ public class EstacionServiceImpl implements EstacionService {
|
|||
|
||||
}
|
||||
|
||||
private void validarEstoque(Estacion estacion) throws BusinessException {
|
||||
if (!ApplicationProperties.getInstance().generarRotinaFolios()){
|
||||
Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId());
|
||||
if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())){
|
||||
if (estacionDAO.temEstoque(estacionPuntoVentaAnterior.getPuntoVenta(), estacion)){
|
||||
throw new BusinessException("estacionServiceImpl.msg.hayStock");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(Estacion entidad) {
|
||||
public void borrar(Estacion entidad) throws BusinessException {
|
||||
|
||||
validarEstoque(entidad);
|
||||
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
|
Loading…
Reference in New Issue