diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java index 3844b66b9..55ad12457 100644 --- a/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java @@ -14,7 +14,7 @@ public interface AidfDAO extends GenericDAO { public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn); - public Boolean existeAidfComCodFiscalEEstado(Long idAidf, String docFiscal, Estado estado); + public Boolean existeAidfComCodFiscalEEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado); public List buscaAidfRMD(Integer empresaId, Integer estadoId); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java index b05df2644..e784edc23 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java @@ -118,8 +118,7 @@ public class AidfHibernateDAO extends GenericHibernateDAO implements return (List) c.list(); } - public Boolean existeAidfComCodFiscalEEstado(Long idAidf, String docFiscal, Estado estado) { - + public Boolean existeAidfComCodFiscalEEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado) { Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("estado", estado)); c.add(Restrictions.eq("docfiscal", docFiscal)); @@ -128,6 +127,10 @@ public class AidfHibernateDAO extends GenericHibernateDAO implements c.add(Restrictions.ne("aidfId", idAidf)); } + if (especieId != null) { + c.add(Restrictions.eq("aidfEspecie.aidfespId", especieId)); + } + return c.list().isEmpty(); } diff --git a/src/com/rjconsultores/ventaboletos/service/AidfService.java b/src/com/rjconsultores/ventaboletos/service/AidfService.java index ce1c578d2..5ba9c40e9 100644 --- a/src/com/rjconsultores/ventaboletos/service/AidfService.java +++ b/src/com/rjconsultores/ventaboletos/service/AidfService.java @@ -32,7 +32,7 @@ public interface AidfService { public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn); - public Boolean validarDocFiscalPorEstado(Long idAidf, String docFiscal, Estado estado); + public Boolean validarDocFiscalPorEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado); public Boolean validarTipoVenda(String tipoVenda, String serie, Integer idTipo); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java index f18f7a493..c393ea118 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java @@ -120,8 +120,8 @@ public class AidfServiceImpl implements AidfService { return -1l; } - public Boolean validarDocFiscalPorEstado(Long idAidf, String docFiscal, Estado estado) { - return aidfDAO.existeAidfComCodFiscalEEstado(idAidf, docFiscal, estado); + public Boolean validarDocFiscalPorEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado) { + return aidfDAO.existeAidfComCodFiscalEEstado(idAidf, especieId, docFiscal, estado); } public Boolean validarTipoVenda(String tipoVenda, String serie, Integer idTipo) {