Movimentação de estoque centralizado:
Estoque por agência git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@33463 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
698962b82f
commit
ad3c4f625c
|
@ -1,7 +1,12 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
public interface AbastoBoletoDAO extends GenericDAO<AbastoBoleto, Integer> {
|
public interface AbastoBoletoDAO extends GenericDAO<AbastoBoleto, Integer> {
|
||||||
|
|
||||||
|
public List<AbastoBoleto> buscaAbastoBoletoPorPuntoVenta(PuntoVenta puntoVenta);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
||||||
|
@ -16,13 +17,15 @@ public interface AbastoCentralDAO extends GenericDAO<AbastoCentral, Long> {
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes);
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes);
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem);
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem);
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes);
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes);
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem);
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String numSerie, String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem);
|
||||||
|
|
||||||
public void actualizaBilhetes(List<AbastoCentral> bilhetes, PuntoVenta destino);
|
public void actualizaBilhetes(List<AbastoCentral> bilhetes, PuntoVenta destino);
|
||||||
public void actualizaBilhetes(List<AbastoCentral> bilhetes, Estacion destino);
|
public void actualizaBilhetes(List<AbastoCentral> bilhetes, Estacion destino);
|
||||||
public void suscribirBilhetes(List<AbastoCentral> bilhetes);
|
public void suscribirBilhetes(List<AbastoCentral> bilhetes);
|
||||||
public List<AbastoCentral> buscaBilhetesPorAidf(Aidf aidf);
|
public List<AbastoCentral> buscaBilhetesPorAidf(Aidf aidf);
|
||||||
|
|
||||||
|
public void gravaControleEstoqueMigracao(PuntoVenta puntoVenta, Date fecmodif, Integer usuarioId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.PuntoVenta;
|
||||||
|
|
||||||
public interface DetAbastoBoletoDAO extends GenericDAO<DetAbastoBoleto, Integer> {
|
public interface DetAbastoBoletoDAO extends GenericDAO<DetAbastoBoleto, Integer> {
|
||||||
|
|
||||||
public Long getSecuencia();
|
public Long getSecuencia();
|
||||||
|
|
||||||
|
public List<DetAbastoBoleto> buscaDetAbastoBoletos(AbastoBoleto abastoBoleto);
|
||||||
|
|
||||||
|
public List<DetAbastoBoleto> buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa);
|
||||||
|
|
||||||
|
public void desativaDetAbastos(List<DetAbastoBoleto> detAbastoBoletos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO;
|
import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
@Repository("abastoBoletoDAO")
|
@Repository("abastoBoletoDAO")
|
||||||
public class AbastoBoletoHibernateDAO extends GenericHibernateDAO<AbastoBoleto, Integer>
|
public class AbastoBoletoHibernateDAO extends GenericHibernateDAO<AbastoBoleto, Integer>
|
||||||
|
@ -16,4 +21,11 @@ public class AbastoBoletoHibernateDAO extends GenericHibernateDAO<AbastoBoleto,
|
||||||
public AbastoBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
public AbastoBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
setSessionFactory(factory);
|
setSessionFactory(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AbastoBoleto> buscaAbastoBoletoPorPuntoVenta(PuntoVenta puntoVenta) {
|
||||||
|
|
||||||
|
List<AbastoBoleto> abastos = findByCriteria(Restrictions.eq("puntoventa", puntoVenta), Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
return abastos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.Query;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.criterion.Order;
|
import org.hibernate.criterion.Order;
|
||||||
|
@ -15,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO;
|
import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
|
@ -46,13 +49,17 @@ public class AbastoCentralHibernateDAO extends GenericHibernateDAO<AbastoCentral
|
||||||
|
|
||||||
|
|
||||||
public List<AbastoCentral> obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem) {
|
public List<AbastoCentral> obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem) {
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
|
||||||
c.add(Restrictions.eq("aidf", aidf));
|
|
||||||
c.add(Restrictions.eq("puntoventa", origem));
|
|
||||||
c.add(Restrictions.between("numfoliopreimpreso", formInicial, formFinal));
|
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
|
||||||
|
|
||||||
return (List<AbastoCentral>)c.list();
|
String queryStr = "from AbastoCentral act where act.aidf = :aidf and act.puntoventa = :puntoventa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal";
|
||||||
|
|
||||||
|
Query query = getSession().createQuery(queryStr);
|
||||||
|
|
||||||
|
query.setLong("aidf", aidf.getAidfId());
|
||||||
|
query.setInteger("puntoventa", origem.getPuntoventaId());
|
||||||
|
query.setLong("folioinicial", Long.valueOf(formInicial));
|
||||||
|
query.setLong("foliofinal", Long.valueOf(formFinal));
|
||||||
|
|
||||||
|
return (List<AbastoCentral>)query.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -113,15 +120,19 @@ public class AbastoCentralHibernateDAO extends GenericHibernateDAO<AbastoCentral
|
||||||
|
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes) {
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes) {
|
||||||
|
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
String queryStr = "from AbastoCentral act where act.puntoventa = :puntoventa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal";
|
||||||
c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes));
|
|
||||||
c.add(Restrictions.between("numfoliopreimpreso", formInicial, formFinal));
|
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
|
||||||
|
|
||||||
return (List<AbastoCentral>)c.list();
|
Query query = getSession().createQuery(queryStr);
|
||||||
|
|
||||||
|
query.setInteger("puntoventa", puntoVentaBilhetes.getPuntoventaId());
|
||||||
|
query.setLong("folioinicial", Long.valueOf(formInicial));
|
||||||
|
query.setLong("foliofinal", Long.valueOf(formFinal));
|
||||||
|
|
||||||
|
return (List<AbastoCentral>)query.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem) {
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem) {
|
||||||
|
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes));
|
c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes));
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
@ -131,17 +142,24 @@ public class AbastoCentralHibernateDAO extends GenericHibernateDAO<AbastoCentral
|
||||||
return (List<AbastoCentral>)c.list();
|
return (List<AbastoCentral>)c.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem) {
|
public List<AbastoCentral> obtenerBilhetesPorPuntoVenta(String numSerie, String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem) {
|
||||||
|
|
||||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
String queryStr = "from AbastoCentral act where act.puntoventa = :puntoventa and act.numseriepreimpresa = :numseriepreimpresa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal";
|
||||||
c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes));
|
|
||||||
c.add(Restrictions.between("numfoliopreimpreso", formInicial, formFinal));
|
|
||||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
|
||||||
|
|
||||||
if(origem != null)
|
if(origem != null)
|
||||||
c.add(Restrictions.eq("estacion", origem));
|
queryStr += " and act.estacion = :estacion";
|
||||||
|
|
||||||
return (List<AbastoCentral>)c.list();
|
Query query = getSession().createQuery(queryStr);
|
||||||
|
|
||||||
|
query.setInteger("puntoventa", puntoVentaBilhetes.getPuntoventaId());
|
||||||
|
query.setString("numseriepreimpresa", numSerie);
|
||||||
|
query.setLong("folioinicial", Long.valueOf(formInicial));
|
||||||
|
query.setLong("foliofinal", Long.valueOf(formFinal));
|
||||||
|
|
||||||
|
if(origem != null)
|
||||||
|
query.setInteger("estacion", origem.getEstacionId());
|
||||||
|
|
||||||
|
return (List<AbastoCentral>)query.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -164,4 +182,13 @@ public class AbastoCentralHibernateDAO extends GenericHibernateDAO<AbastoCentral
|
||||||
session.flush();
|
session.flush();
|
||||||
session.clear();
|
session.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gravaControleEstoqueMigracao(PuntoVenta puntoVenta, Date fecmodif, Integer usuarioId) {
|
||||||
|
Session session = getSessionFactory().getCurrentSession();
|
||||||
|
ControleEstoqueMigracao ctrlMigracao = new ControleEstoqueMigracao(puntoVenta, fecmodif, usuarioId);
|
||||||
|
session.save(ctrlMigracao);
|
||||||
|
session.flush();
|
||||||
|
session.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
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.AbastoCentral;
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
|
|
||||||
@Repository("detAbastoBoletoDAO")
|
@Repository("detAbastoBoletoDAO")
|
||||||
public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBoleto, Integer>
|
public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBoleto, Integer>
|
||||||
|
@ -33,4 +42,55 @@ public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DetAbastoBoleto> buscaDetAbastoBoletos(AbastoBoleto abastoBoleto) {
|
||||||
|
|
||||||
|
List<DetAbastoBoleto> detAbastoBoletos = findByCriteria(Restrictions.eq("abastoBoleto", abastoBoleto));
|
||||||
|
return detAbastoBoletos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DetAbastoBoleto> buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) {
|
||||||
|
|
||||||
|
|
||||||
|
StringBuilder queryString = new StringBuilder("from DetAbastoBoleto det where ")
|
||||||
|
.append(" det.abastoBoleto.estacion.estacionId = :origem")
|
||||||
|
.append(" and det.numseriepreimpresa = :numseriepreimpresa")
|
||||||
|
.append(" and (det.numfolioinicial >= :numfolioinicial and det.numfoliofinal <= :numfoliofinal) ")
|
||||||
|
.append(" order by det.detabastoboletoId");
|
||||||
|
|
||||||
|
Query query = getSession().createQuery(queryString.toString());
|
||||||
|
query.setInteger("origem", origem.getEstacionId());
|
||||||
|
query.setString("numseriepreimpresa", numseriepreimpresa);
|
||||||
|
query.setString("numfolioinicial", numfolioinicial);
|
||||||
|
query.setString("numfoliofinal", numfoliofinal);
|
||||||
|
|
||||||
|
List<DetAbastoBoleto> detAbastoBoletos = query.list();
|
||||||
|
|
||||||
|
return detAbastoBoletos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void desativaDetAbastos(List<DetAbastoBoleto> detAbastoBoletos) {
|
||||||
|
Session session = getSessionFactory().getCurrentSession();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for(DetAbastoBoleto det : detAbastoBoletos){
|
||||||
|
det.setActivo(Boolean.FALSE);
|
||||||
|
session.update(det);
|
||||||
|
|
||||||
|
if(++count % 20 == 0){
|
||||||
|
session.flush();
|
||||||
|
session.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
session.flush();
|
||||||
|
session.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AbastoCentral generated by hbm2java
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "CTRL_EST_MIGRACAO")
|
||||||
|
public class ControleEstoqueMigracao implements java.io.Serializable {
|
||||||
|
|
||||||
|
private Long ctrlestmigracaoId;
|
||||||
|
private PuntoVenta puntoventa;
|
||||||
|
private Date fecmodif;
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public ControleEstoqueMigracao() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControleEstoqueMigracao(PuntoVenta _puntoventa, Date _fecmodif, Integer _usuarioId) {
|
||||||
|
puntoventa = _puntoventa;
|
||||||
|
fecmodif = _fecmodif;
|
||||||
|
usuarioId = _usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JoinColumn(name = "PUNTOVENTA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
public PuntoVenta getPuntoventa() {
|
||||||
|
return this.puntoventa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoventa(PuntoVenta puntoventa) {
|
||||||
|
this.puntoventa = puntoventa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Temporal(TemporalType.DATE)
|
||||||
|
@Column(name = "FECMODIF", length = 7)
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return this.fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Column(name = "USUARIO_ID", precision = 7, scale = 0)
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return this.usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SequenceGenerator(name = "CTRL_EST_MIGRACAO_SEQ", sequenceName = "CTRL_EST_MIGRACAO_SEQ", allocationSize = 1)
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CTRL_EST_MIGRACAO_SEQ")
|
||||||
|
@Column(name = "CTRLESTMIGRACAO_ID", unique = true, nullable = false, precision = 15, scale = 0)
|
||||||
|
public Long getCtrlestmigracaoId() {
|
||||||
|
return ctrlestmigracaoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCtrlestmigracaoId(Long ctrlestmigracaoId) {
|
||||||
|
this.ctrlestmigracaoId = ctrlestmigracaoId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -143,6 +143,9 @@ public class PuntoVenta implements Serializable {
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private PtovtaTipoEstoque ptovtaTipoEstoque;
|
private PtovtaTipoEstoque ptovtaTipoEstoque;
|
||||||
|
|
||||||
|
@Column(name = "USA_CRTL_EST_CENTRAL")
|
||||||
|
private Boolean usaCrtlEstCentral;
|
||||||
|
|
||||||
public PtovtaTipoEstoque getPtovtaTipoEstoque() {
|
public PtovtaTipoEstoque getPtovtaTipoEstoque() {
|
||||||
return ptovtaTipoEstoque;
|
return ptovtaTipoEstoque;
|
||||||
}
|
}
|
||||||
|
@ -588,4 +591,12 @@ public class PuntoVenta implements Serializable {
|
||||||
this.puntoVentaPadre = puntoVentaPadre;
|
this.puntoVentaPadre = puntoVentaPadre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isUsaCrtlEstCentral() {
|
||||||
|
return usaCrtlEstCentral;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsaCrtlEstCentral(Boolean usaCrtlEstCentral) {
|
||||||
|
this.usaCrtlEstCentral = usaCrtlEstCentral;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class TipoMovimentacion implements java.io.Serializable {
|
||||||
public static final int TIPO_TRANSFERENCIA = 4;
|
public static final int TIPO_TRANSFERENCIA = 4;
|
||||||
public static final int TIPO_PERDIDO = 5;
|
public static final int TIPO_PERDIDO = 5;
|
||||||
public static final int TIPO_AJUSTE = 6;
|
public static final int TIPO_AJUSTE = 6;
|
||||||
|
public static final int TIPO_MIGRACAO = 99;
|
||||||
|
|
||||||
private Integer tipomovimentacionId;
|
private Integer tipomovimentacionId;
|
||||||
private String desctipomovimentacion;
|
private String desctipomovimentacion;
|
||||||
|
|
|
@ -3,10 +3,11 @@ package com.rjconsultores.ventaboletos.service;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion;
|
||||||
|
|
||||||
public interface AutorizaFolioService {
|
public interface AutorizaFolioService {
|
||||||
|
|
||||||
public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion estacion, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, Empresa empresaUsuario);
|
public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion);
|
||||||
|
|
||||||
public Boolean noChequeFolioPreimpresos(Estacion estacion);
|
public Boolean noChequeFolioPreimpresos(Estacion estacion);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
|
|
||||||
public interface DetAbastoBoletoService extends GenericService<DetAbastoBoleto, Integer> {
|
public interface DetAbastoBoletoService extends GenericService<DetAbastoBoleto, Integer> {
|
||||||
|
|
||||||
public Long getSecuencia();
|
public Long getSecuencia();
|
||||||
|
|
||||||
|
public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
|
||||||
|
public interface MigracaoControleEstoqueService {
|
||||||
|
|
||||||
|
public void migraDadosBoletosPuntoVenta(PuntoVenta puntoVenta);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -26,8 +26,6 @@ public interface MovimentacionBilhetesService {
|
||||||
public PuntoVenta buscarAgContabilidade();
|
public PuntoVenta buscarAgContabilidade();
|
||||||
|
|
||||||
public List<TipoMovimentacion> obtenerTiposMovimetacionPuntoVenta();
|
public List<TipoMovimentacion> obtenerTiposMovimetacionPuntoVenta();
|
||||||
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, TipoMovimentacion tipoMovimentacion);
|
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String numSerie, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion);
|
||||||
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String formInicial, Long cantidad, TipoMovimentacion tipoMovimentacion);
|
|
||||||
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.rjconsultores.ventaboletos.entidad.Estacion;
|
||||||
import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso;
|
import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto;
|
import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion;
|
||||||
import com.rjconsultores.ventaboletos.service.AbastoBoletoService;
|
import com.rjconsultores.ventaboletos.service.AbastoBoletoService;
|
||||||
import com.rjconsultores.ventaboletos.service.ArticuloService;
|
import com.rjconsultores.ventaboletos.service.ArticuloService;
|
||||||
import com.rjconsultores.ventaboletos.service.AutorizaFolioService;
|
import com.rjconsultores.ventaboletos.service.AutorizaFolioService;
|
||||||
|
@ -41,28 +42,38 @@ public class AutorizaFolioServiceImpl implements AutorizaFolioService {
|
||||||
private FolioPreimpresoService folioPreimpresoService;
|
private FolioPreimpresoService folioPreimpresoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion estacion, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, Empresa empresaUsuario) {
|
public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa,
|
||||||
|
Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion) {
|
||||||
|
|
||||||
FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(estacion, empresaUsuario);
|
if(TipoMovimentacion.TIPO_ENVIO == tipoMovimentacion.getTipomovimentacionId() ||
|
||||||
|
TipoMovimentacion.TIPO_TRANSFERENCIA == tipoMovimentacion.getTipomovimentacionId()){
|
||||||
RequisicionBoleto requisicionBoleto = geraRequisicionBoleto(aidf, estacion, empresaUsuario);
|
|
||||||
AbastoBoleto abastoBoleto = geraAbastoBoleto(requisicionBoleto);
|
|
||||||
DetAbastoBoleto detAbastoBoleto = geraDetAbastoBoleto(abastoBoleto, numfolioinicial, numfoliofinal, numseriepreimpresa);
|
|
||||||
actualizaStatusRequisicion(requisicionBoleto);
|
|
||||||
|
|
||||||
if (folio == null) {
|
|
||||||
|
|
||||||
FolioPreimpreso folioPreimpreso = geraFolioPreimpreso(detAbastoBoleto, numfolioinicial);
|
FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(destino, empresaUsuario);
|
||||||
|
|
||||||
if (folioPreimpreso.getFoliopreimpresoId() == null) {
|
RequisicionBoleto requisicionBoleto = geraRequisicionBoleto(aidf, destino, empresaUsuario);
|
||||||
return Boolean.FALSE;
|
AbastoBoleto abastoBoleto = geraAbastoBoleto(requisicionBoleto);
|
||||||
|
DetAbastoBoleto detAbastoBoleto = geraDetAbastoBoleto(abastoBoleto, numfolioinicial, numfoliofinal, numseriepreimpresa);
|
||||||
|
actualizaStatusRequisicion(requisicionBoleto);
|
||||||
|
|
||||||
|
if (folio == null) {
|
||||||
|
|
||||||
|
FolioPreimpreso folioPreimpreso = geraFolioPreimpreso(detAbastoBoleto, numfolioinicial);
|
||||||
|
|
||||||
|
if (folioPreimpreso.getFoliopreimpresoId() == null)
|
||||||
|
return Boolean.FALSE;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
actualizaFolioPreimpreso(folio, numseriepreimpresa, numfolioinicial);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
actualizaFolioPreimpreso(folio, numseriepreimpresa, numfolioinicial);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(TipoMovimentacion.TIPO_TRANSFERENCIA == tipoMovimentacion.getTipomovimentacionId() ||
|
||||||
|
TipoMovimentacion.TIPO_VOLVER == tipoMovimentacion.getTipomovimentacionId() ||
|
||||||
|
TipoMovimentacion.TIPO_PERDIDO == tipoMovimentacion.getTipomovimentacionId())
|
||||||
|
|
||||||
|
detAbastoBoletoService.desabilitaDetAbastos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa);
|
||||||
|
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,7 +118,7 @@ public class AutorizaFolioServiceImpl implements AutorizaFolioService {
|
||||||
|
|
||||||
return detAbastoBoletoService.suscribir(detAbastoBoleto);
|
return detAbastoBoletoService.suscribir(detAbastoBoleto);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void actualizaStatusRequisicion(RequisicionBoleto requisicionBoleto) {
|
private void actualizaStatusRequisicion(RequisicionBoleto requisicionBoleto) {
|
||||||
requisicionBoleto.setStatusenvio(Boolean.FALSE);
|
requisicionBoleto.setStatusenvio(Boolean.FALSE);
|
||||||
requisicionBoletoService.actualizacion(requisicionBoleto);
|
requisicionBoletoService.actualizacion(requisicionBoleto);
|
||||||
|
|
|
@ -3,12 +3,15 @@ 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.service.DetAbastoBoletoService;
|
import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@ -60,4 +63,22 @@ public class DetAbastoBoletoServiceImpl implements DetAbastoBoletoService {
|
||||||
return detAbastoBoletoDAO.getSecuencia();
|
return detAbastoBoletoDAO.getSecuencia();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) {
|
||||||
|
|
||||||
|
List<DetAbastoBoleto> detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa);
|
||||||
|
|
||||||
|
detAbastoBoletoDAO.desativaDetAbastos(detAbastoBoletos);
|
||||||
|
|
||||||
|
DetAbastoBoleto detAbastoBoletoInicial = detAbastoBoletos.get(0);
|
||||||
|
detAbastoBoletoInicial.setNumfoliofinal(numfolioinicial);
|
||||||
|
detAbastoBoletoInicial.setActivo(Boolean.TRUE);
|
||||||
|
detAbastoBoletoDAO.actualizacion(detAbastoBoletoInicial);
|
||||||
|
|
||||||
|
DetAbastoBoleto detAbastoBoletoFinal = detAbastoBoletos.get(detAbastoBoletos.size() - 1);
|
||||||
|
detAbastoBoletoFinal.setNumfolioinicial(numfoliofinal);
|
||||||
|
detAbastoBoletoFinal.setActivo(Boolean.TRUE);
|
||||||
|
detAbastoBoletoDAO.actualizacion(detAbastoBoletoFinal);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,155 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.AidfDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AbastoCentral;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.AbastoCentralService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MigracaoControleEstoqueService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("migracaoControleEstoqueService")
|
||||||
|
public class MigracaoControleEstoqueServiceImpl implements MigracaoControleEstoqueService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AbastoBoletoDAO abastoBoletoDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DetAbastoBoletoDAO detAbastoBoletoDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AidfDAO aidfDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AbastoCentralDAO abastoCentralDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AbastoHistoDAO abastoHistoDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoMovimentacionDAO tipoMovimentacionDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaDAO puntoVentaDAO;
|
||||||
|
|
||||||
|
public MigracaoControleEstoqueServiceImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void migraDadosBoletosPuntoVenta(PuntoVenta puntoVenta){
|
||||||
|
puntoVentaDAO.actualizacion(puntoVenta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void migraDadosBoletosPuntoVentaAutomatico(PuntoVenta puntoVenta){
|
||||||
|
|
||||||
|
List<AbastoBoleto> abastoBoletos = abastoBoletoDAO.buscaAbastoBoletoPorPuntoVenta(puntoVenta);
|
||||||
|
|
||||||
|
List<Empresa> empresas = new ArrayList<Empresa>();
|
||||||
|
empresas.add(puntoVenta.getEmpresa());
|
||||||
|
|
||||||
|
List<Aidf> aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas);
|
||||||
|
|
||||||
|
Map<Aidf, List<DetAbastoBoleto>> abastoBoletosPorAidf = new HashMap<Aidf, List<DetAbastoBoleto>>();
|
||||||
|
|
||||||
|
for(AbastoBoleto abastoBoleto: abastoBoletos){
|
||||||
|
|
||||||
|
List<DetAbastoBoleto> detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(abastoBoleto);
|
||||||
|
|
||||||
|
for(Aidf aidf : aidfs){
|
||||||
|
|
||||||
|
if(!abastoBoletosPorAidf.containsKey(aidf))
|
||||||
|
abastoBoletosPorAidf.put(aidf, new ArrayList<DetAbastoBoleto>());
|
||||||
|
|
||||||
|
for(DetAbastoBoleto detAbastoBoleto : detAbastoBoletos){
|
||||||
|
|
||||||
|
String serieDetAbastoBoleto = detAbastoBoleto.getNumseriepreimpresa();
|
||||||
|
Long numFolioInicialDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfolioinicial());
|
||||||
|
Long numFolioFinalDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfoliofinal());
|
||||||
|
|
||||||
|
Long numFolioInicialAidf = Long.valueOf(aidf.getForminicial());
|
||||||
|
Long numFolioFinalAidf = Long.valueOf(aidf.getFormfinal());
|
||||||
|
|
||||||
|
if(serieDetAbastoBoleto.equals(aidf.getSerie())
|
||||||
|
&& numFolioInicialDetAbastoBoleto >= numFolioInicialAidf
|
||||||
|
&& numFolioFinalDetAbastoBoleto <= numFolioFinalAidf){
|
||||||
|
|
||||||
|
abastoBoletosPorAidf.get(aidf).add(detAbastoBoleto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<Entry<Aidf,List<DetAbastoBoleto>>> boletosIt = abastoBoletosPorAidf.entrySet().iterator();
|
||||||
|
|
||||||
|
List<AbastoCentral> boletosAMigrar = new ArrayList<AbastoCentral>();
|
||||||
|
|
||||||
|
Integer usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId();
|
||||||
|
Date fecmodif = new Date();
|
||||||
|
|
||||||
|
while(boletosIt.hasNext()){
|
||||||
|
|
||||||
|
Entry<Aidf,List<DetAbastoBoleto>> boletosPorAidf = boletosIt.next();
|
||||||
|
|
||||||
|
Aidf aidf = boletosPorAidf.getKey();
|
||||||
|
List<DetAbastoBoleto> detAbastoBoletos = boletosPorAidf.getValue();
|
||||||
|
|
||||||
|
for(DetAbastoBoleto detAbastoBoleto : detAbastoBoletos){
|
||||||
|
|
||||||
|
String serieDetAbastoBoleto = detAbastoBoleto.getNumseriepreimpresa();
|
||||||
|
Long numFolioInicialDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfolioinicial());
|
||||||
|
Long numFolioFinalDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfoliofinal());
|
||||||
|
|
||||||
|
int numBoletos = (int)(numFolioFinalDetAbastoBoleto - numFolioInicialDetAbastoBoleto);
|
||||||
|
|
||||||
|
Boolean activo = detAbastoBoleto.getActivo();
|
||||||
|
String numsubseriepreimpreso = "";
|
||||||
|
|
||||||
|
for(int contBoletos = 0 ; contBoletos < numBoletos; contBoletos++ ){
|
||||||
|
|
||||||
|
String numfoliopreimpreso = (numFolioInicialDetAbastoBoleto + contBoletos)+"";
|
||||||
|
|
||||||
|
AbastoCentral boletoAMigrar = new AbastoCentral(
|
||||||
|
aidf, serieDetAbastoBoleto, numfoliopreimpreso, numsubseriepreimpreso,
|
||||||
|
puntoVenta, activo, fecmodif, usuarioId);
|
||||||
|
|
||||||
|
boletosAMigrar.add(boletoAMigrar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abastoCentralDAO.suscribirBilhetes(boletosAMigrar);
|
||||||
|
|
||||||
|
TipoMovimentacion tipoMovMigracao = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_MIGRACAO);
|
||||||
|
abastoHistoDAO.grabaHistoricoBilhetes(boletosAMigrar, tipoMovMigracao);
|
||||||
|
|
||||||
|
|
||||||
|
abastoCentralDAO.gravaControleEstoqueMigracao(puntoVenta, fecmodif, usuarioId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -162,38 +162,14 @@ public class MovimentacionBilhetesServiceImpl implements MovimentacionBilhetesSe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, TipoMovimentacion tipoMovimentacion) {
|
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String numSerie, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) {
|
||||||
List<AbastoCentral> bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(puntoVentaBilhetes, origem);
|
|
||||||
|
List<AbastoCentral> bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(numSerie, formInicial, formFinal, puntoVentaBilhetes, origem);
|
||||||
atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion);
|
atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion);
|
||||||
|
trataRequisicionBilhetesEstacion(bilhetes, origem, destino, formInicial, formFinal, tipoMovimentacion);
|
||||||
if(!bilhetes.isEmpty() && origem == null){//envio
|
|
||||||
String formInicial = bilhetes.get(0).getNumfoliopreimpreso();
|
|
||||||
String formFinal = bilhetes.get(bilhetes.size() - 1).getNumfoliopreimpreso();
|
|
||||||
geraRequisicionBilhetesEstacion(bilhetes, destino, formInicial, formFinal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String _formInicial, Long cantidad, TipoMovimentacion tipoMovimentacion) {
|
|
||||||
|
|
||||||
Long formInicial = Long.valueOf(_formInicial);
|
|
||||||
Long formFinal = formInicial + cantidad.longValue();
|
|
||||||
|
|
||||||
realizaMovimentacionBilhetes(puntoVentaBilhetes, origem, destino, formInicial.toString(), formFinal.toString(), tipoMovimentacion);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) {
|
|
||||||
|
|
||||||
List<AbastoCentral> bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(formInicial, formFinal, puntoVentaBilhetes, origem);
|
|
||||||
atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion);
|
|
||||||
|
|
||||||
if(origem == null) //envio
|
|
||||||
geraRequisicionBilhetesEstacion(bilhetes, destino, formInicial, formFinal);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void geraRequisicionBilhetesEstacion(List<AbastoCentral> bilhetes, Estacion destino, String numfolioinicial, String numfoliofinal){
|
private void trataRequisicionBilhetesEstacion(List<AbastoCentral> bilhetes, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, TipoMovimentacion tipoMovimentacion){
|
||||||
|
|
||||||
Aidf aidfCorrente = null;
|
Aidf aidfCorrente = null;
|
||||||
|
|
||||||
|
@ -202,7 +178,7 @@ public class MovimentacionBilhetesServiceImpl implements MovimentacionBilhetesSe
|
||||||
if(aidfCorrente == null || (aidfCorrente != null && !aidfCorrente.equals(bilhete.getAidf()))){
|
if(aidfCorrente == null || (aidfCorrente != null && !aidfCorrente.equals(bilhete.getAidf()))){
|
||||||
aidfCorrente = bilhete.getAidf();
|
aidfCorrente = bilhete.getAidf();
|
||||||
String numseriepreimpresa = aidfCorrente.getSerie();
|
String numseriepreimpresa = aidfCorrente.getSerie();
|
||||||
autorizaFolioService.noChequeFolioPreimpresos(aidfCorrente, destino, numfolioinicial, numfoliofinal, numseriepreimpresa, aidfCorrente.getEmpresa());
|
autorizaFolioService.noChequeFolioPreimpresos(aidfCorrente, origem, destino, numfolioinicial, numfoliofinal, numseriepreimpresa, aidfCorrente.getEmpresa(), tipoMovimentacion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue