baixa automática
Automatizar a checagem do folio para empresa que usa impressora fiscal (fixes bug #5785) Tempo: 03 horas git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@39555 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
5071d1dfda
commit
1a6020d1c1
|
@ -3,10 +3,8 @@ package com.rjconsultores.ventaboletos.dao;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
|
||||||
|
|
||||||
public interface DetAbastoBoletoDAO extends GenericDAO<DetAbastoBoleto, Integer> {
|
public interface DetAbastoBoletoDAO extends GenericDAO<DetAbastoBoleto, Integer> {
|
||||||
|
|
||||||
|
@ -18,4 +16,6 @@ public interface DetAbastoBoletoDAO extends GenericDAO<DetAbastoBoleto, Integer>
|
||||||
|
|
||||||
public void desativaDetAbastos(List<DetAbastoBoleto> detAbastoBoletos);
|
public void desativaDetAbastos(List<DetAbastoBoleto> detAbastoBoletos);
|
||||||
|
|
||||||
|
public List<DetAbastoBoleto> buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
@ -16,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO;
|
import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
|
|
||||||
|
@ -52,7 +49,6 @@ public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBo
|
||||||
@Override
|
@Override
|
||||||
public List<DetAbastoBoleto> buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) {
|
public List<DetAbastoBoleto> buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) {
|
||||||
|
|
||||||
|
|
||||||
StringBuilder queryString = new StringBuilder("from DetAbastoBoleto det where ")
|
StringBuilder queryString = new StringBuilder("from DetAbastoBoleto det where ")
|
||||||
.append(" det.abastoBoleto.estacion.estacionId = :origem")
|
.append(" det.abastoBoleto.estacion.estacionId = :origem")
|
||||||
.append(" and det.numseriepreimpresa = :numseriepreimpresa")
|
.append(" and det.numseriepreimpresa = :numseriepreimpresa")
|
||||||
|
@ -76,11 +72,11 @@ public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBo
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(DetAbastoBoleto det : detAbastoBoletos){
|
for (DetAbastoBoleto det : detAbastoBoletos) {
|
||||||
det.setActivo(Boolean.FALSE);
|
det.setActivo(Boolean.FALSE);
|
||||||
session.update(det);
|
session.update(det);
|
||||||
|
|
||||||
if(++count % 20 == 0){
|
if (++count % 20 == 0) {
|
||||||
session.flush();
|
session.flush();
|
||||||
session.clear();
|
session.clear();
|
||||||
}
|
}
|
||||||
|
@ -91,6 +87,23 @@ public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DetAbastoBoleto> buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa) {
|
||||||
|
|
||||||
|
StringBuilder qs = new StringBuilder();
|
||||||
|
qs.append(" from DetAbastoBoleto det ");
|
||||||
|
qs.append(" where det.activo = 1 ");
|
||||||
|
qs.append(" and det.statusoperacion = 1 ");
|
||||||
|
qs.append(" and det.abastoBoleto.estacion.estacionId = :estacion ");
|
||||||
|
qs.append(" and det.numseriepreimpresa = :numseriepreimpresa ");
|
||||||
|
|
||||||
|
Query query = getSession().createQuery(qs.toString());
|
||||||
|
query.setInteger("estacion", estacion.getEstacionId());
|
||||||
|
query.setString("numseriepreimpresa", numseriepreimpresa);
|
||||||
|
|
||||||
|
List<DetAbastoBoleto> detAbastoBoletos = query.list();
|
||||||
|
|
||||||
|
return detAbastoBoletos;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,6 @@ public interface AutorizaFolioService {
|
||||||
|
|
||||||
public String noChequeFolioPreimpresos(EstacionImpresora estacionImpresora, boolean isImpressoraFiscal);
|
public String noChequeFolioPreimpresos(EstacionImpresora estacionImpresora, boolean isImpressoraFiscal);
|
||||||
|
|
||||||
|
public void devolverFoliosAutomaticosImpressoraFiscal(EstacionImpresora ei);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
|
|
||||||
|
@ -9,6 +11,5 @@ public interface DetAbastoBoletoService extends GenericService<DetAbastoBoleto,
|
||||||
|
|
||||||
public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa);
|
public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa);
|
||||||
|
|
||||||
|
public List<DetAbastoBoleto> buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EstacionImpresora;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
|
||||||
|
@ -40,4 +41,6 @@ public interface EstacionService {
|
||||||
|
|
||||||
public List<Estacion> buscarEstaciones(PuntoVenta puntoVenta);
|
public List<Estacion> buscarEstaciones(PuntoVenta puntoVenta);
|
||||||
|
|
||||||
|
public void devolverFoliosAutomaticosImpressoraFiscal(EstacionImpresora ei);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
|
@ -45,6 +46,25 @@ public class AutorizaFolioServiceImpl implements AutorizaFolioService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FolioPreimpresoService folioPreimpresoService;
|
private FolioPreimpresoService folioPreimpresoService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void devolverFoliosAutomaticosImpressoraFiscal(final EstacionImpresora ei) {
|
||||||
|
|
||||||
|
Empresa empresa = ei.getEmpresa();
|
||||||
|
FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(ei.getEstacion(), empresa);
|
||||||
|
|
||||||
|
if (folio != null) {
|
||||||
|
List<DetAbastoBoleto> lsDetAbasto = detAbastoBoletoService.buscabDetAbastoBoletoAutomatico(ei.getEstacion(), folio.getNumeserie());
|
||||||
|
if (!lsDetAbasto.isEmpty()) {
|
||||||
|
|
||||||
|
DetAbastoBoleto dab = lsDetAbasto.get(0);
|
||||||
|
|
||||||
|
abastoBoletoService.borrar(dab.getAbastoBoleto());
|
||||||
|
detAbastoBoletoService.borrar(dab);
|
||||||
|
folioPreimpresoService.borrar(folio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa,
|
public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa,
|
||||||
Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion) {
|
Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion) {
|
||||||
|
|
|
@ -3,13 +3,11 @@ package com.rjconsultores.ventaboletos.service.impl;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO;
|
import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService;
|
import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService;
|
||||||
|
@ -68,7 +66,7 @@ public class DetAbastoBoletoServiceImpl implements DetAbastoBoletoService {
|
||||||
|
|
||||||
List<DetAbastoBoleto> detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa);
|
List<DetAbastoBoleto> detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa);
|
||||||
|
|
||||||
if(!detAbastoBoletos.isEmpty()){
|
if (!detAbastoBoletos.isEmpty()) {
|
||||||
detAbastoBoletoDAO.desativaDetAbastos(detAbastoBoletos);
|
detAbastoBoletoDAO.desativaDetAbastos(detAbastoBoletos);
|
||||||
|
|
||||||
DetAbastoBoleto detAbastoBoletoInicial = detAbastoBoletos.get(0);
|
DetAbastoBoleto detAbastoBoletoInicial = detAbastoBoletos.get(0);
|
||||||
|
@ -83,4 +81,9 @@ public class DetAbastoBoletoServiceImpl implements DetAbastoBoletoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DetAbastoBoleto> buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa) {
|
||||||
|
return detAbastoBoletoDAO.buscabDetAbastoBoletoAutomatico(estacion, numseriepreimpresa);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,14 @@ public class EstacionServiceImpl implements EstacionService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void devolverFoliosAutomaticosImpressoraFiscal(final EstacionImpresora ei) {
|
||||||
|
|
||||||
|
if (ei.getNombImpresora().equals(BEMATECH_FISCAL)) {
|
||||||
|
autorizaFolioService.devolverFoliosAutomaticosImpressoraFiscal(ei);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void validarEstoqueUpdate(Estacion estacion) throws BusinessException {
|
private void validarEstoqueUpdate(Estacion estacion) throws BusinessException {
|
||||||
|
|
||||||
if (estacion.getEstacionId() == null) {
|
if (estacion.getEstacionId() == null) {
|
||||||
|
|
Loading…
Reference in New Issue