0004575: Estoque de Passagens na troca de agência.
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@32801 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
773de70828
commit
150628a5fb
|
@ -33,4 +33,6 @@ public interface EstacionDAO extends GenericDAO<Estacion, Integer> {
|
|||
public List<Estacion> buscarEstaciones(PuntoVenta puntoVenta);
|
||||
|
||||
public List<PuntoVenta> buscarPuntosVentaEstacionPorUsuario(Usuario usuario);
|
||||
|
||||
public Boolean temEstoque(PuntoVenta puntoVenta, Estacion estacion);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ 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;
|
||||
|
@ -95,4 +97,20 @@ public List<Estacion> buscarEstaciones(PuntoVenta puntoVenta) {
|
|||
return buscaPuntoVentasUsuario.list();
|
||||
}
|
||||
|
||||
public Boolean temEstoque(PuntoVenta puntoVenta, Estacion estacion){
|
||||
StringBuilder qryStr = new StringBuilder();
|
||||
qryStr.append("Select count(*) from ABASTO_BOLETO B, DET_ABASTO_BOLETO D ");
|
||||
qryStr.append("where d.abastoboleto_id = b.abastoboleto_id and (d.statusfirma = 0 ");
|
||||
qryStr.append("or d.statusfirma = 1) and d.activo = 1 and b.activo = 1 and ");
|
||||
qryStr.append("b.puntoventa_id = :puntoventa_id and b.estacion_id = :estacion_id");
|
||||
|
||||
SQLQuery query = getSession().createSQLQuery(qryStr.toString());
|
||||
query.setParameter("puntoventa_id", puntoVenta.getPuntoventaId());
|
||||
query.setParameter("estacion_id", estacion.getEstacionId());
|
||||
|
||||
List<BigDecimal> list = query.list();
|
||||
BigDecimal result = list.get(0);
|
||||
return (result.intValue() > 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,14 @@ 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Boolean esMacDuplicado = Boolean.FALSE;
|
||||
List<Estacion> lsEstacionMac = estacionDAO.buscar(estacion.getDescmac());
|
||||
if (!lsEstacionMac.isEmpty()) {
|
||||
|
|
Loading…
Reference in New Issue