Transferencia de estoque simplificado feat bug#AL-3983

master
fabio.fbarreto 2024-03-13 16:28:08 -03:00
parent 3f222cce7a
commit 41b76d1b4b
16 changed files with 192 additions and 44 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ModelWeb</artifactId> <artifactId>ModelWeb</artifactId>
<version>1.40.7</version> <version>1.41.0</version>
<distributionManagement> <distributionManagement>
<repository> <repository>

View File

@ -24,4 +24,6 @@ public interface AidfDAO extends GenericDAO<Aidf, Long> {
public boolean vaidaRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId, String folio); public boolean vaidaRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId, String folio);
public Boolean validarDocFiscalPorEstadoAgencia(Long idAidf, Integer especieId, String docFiscal, String formInicial, String formFinal, Estado estado, PuntoVenta agencia); public Boolean validarDocFiscalPorEstadoAgencia(Long idAidf, Integer especieId, String docFiscal, String formInicial, String formFinal, Estado estado, PuntoVenta agencia);
public List<Aidf> buscaAidfsPorEmpresasAgencia(List<Empresa> empresas, PuntoVenta pontoVenda);
} }

View File

@ -20,4 +20,6 @@ public interface DetAbastoBoletoDAO extends GenericDAO<DetAbastoBoleto, Integer>
public List<Object> buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(com.rjconsultores.ventaboletos.entidad.Aidf aidf); public List<Object> buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(com.rjconsultores.ventaboletos.entidad.Aidf aidf);
public DetAbastoBoleto buscarPorAidf(Long aidfId, String folioInicial, String folioFinal);
} }

View File

@ -119,6 +119,17 @@ public class AidfHibernateDAO extends GenericHibernateDAO<Aidf, Long> implements
return (List<Aidf>) c.list(); return (List<Aidf>) c.list();
} }
@Override
public List<Aidf> buscaAidfsPorEmpresasAgencia(List<Empresa> empresas, PuntoVenta pontoVenda) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.in("empresa", empresas));
c.add(Restrictions.eq("puntoVenta", pontoVenda));
return (List<Aidf>) c.list();
}
public Boolean existeAidfComCodFiscalEEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado) { public Boolean existeAidfComCodFiscalEEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado) {
Criteria c = getSession().createCriteria(getPersistentClass()); Criteria c = getSession().createCriteria(getPersistentClass());

View File

@ -127,4 +127,14 @@ public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO<DetAbastoBo
return query.list(); return query.list();
} }
@Override
public DetAbastoBoleto buscarPorAidf(Long aidfId, String folioInicial, String folioFinal) {
List<DetAbastoBoleto> detAbastoBoletos = findByCriteria(
Restrictions.eq("aidf.aidfId", aidfId),
Restrictions.sqlRestriction("cast(numfolioinicial as integer) <= "+folioInicial),
Restrictions.sqlRestriction("cast(numfoliofinal as integer) >= "+folioFinal),
Restrictions.eq("activo", Boolean.TRUE));
return detAbastoBoletos.get(0);
}
} }

View File

@ -8,6 +8,7 @@ import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
@ -61,22 +62,22 @@ public class AbastoBoleto implements Serializable {
@Column(name = "USUARIO_ID") @Column(name = "USUARIO_ID")
private Integer usuarioId; private Integer usuarioId;
@JoinColumn(name = "PUNTOVENTACENTRAL_ID", referencedColumnName = "PUNTOVENTA_ID") @JoinColumn(name = "PUNTOVENTACENTRAL_ID", referencedColumnName = "PUNTOVENTA_ID")
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
private PuntoVenta puntoventacentral; private PuntoVenta puntoventacentral;
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
private PuntoVenta puntoventa; private PuntoVenta puntoventa;
@JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID")
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
private Estacion estacion; private Estacion estacion;
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
private Empresa empresa; private Empresa empresa;
@JoinColumn(name = "CLASIFICACION_ID", referencedColumnName = "CLASIFICACION_ID") @JoinColumn(name = "CLASIFICACION_ID", referencedColumnName = "CLASIFICACION_ID")
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
private Clasificacion clasificacion; private Clasificacion clasificacion;
@JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID")
@ManyToOne @ManyToOne(fetch = FetchType.LAZY)
private Articulo articulo; private Articulo articulo;
@OneToMany(mappedBy = "abastoBoleto", cascade = CascadeType.ALL) @OneToMany(mappedBy = "abastoBoleto", cascade = CascadeType.ALL)
private List<DetAbastoBoleto> detAbastoBoletoList; private List<DetAbastoBoleto> detAbastoBoletoList;

View File

@ -25,26 +25,57 @@ import org.hibernate.annotations.GenericGenerator;
public class Aidf implements java.io.Serializable { public class Aidf implements java.io.Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id
@GenericGenerator(name = "aidfgen_id", strategy = "com.rjconsultores.ventaboletos.dao.util.AidfGenerator")
@GeneratedValue(generator = "aidfgen_id")
@Column(name = "AIDF_ID", unique = true, nullable = false, precision = 15, scale = 0)
private Long aidfId; private Long aidfId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "AIDFTIPO_ID")
private AidfTipo aidfTipo; private AidfTipo aidfTipo;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "AIDFESP_ID")
private AidfEspecie aidfEspecie; private AidfEspecie aidfEspecie;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PUNTOVENTA_ID")
private PuntoVenta puntoVenta; private PuntoVenta puntoVenta;
@JoinColumn(name = "ESTADO_ID")
@ManyToOne
private Estado estado; private Estado estado;
@Column(name = "DOCFISCAL", length = 20)
private String docfiscal; private String docfiscal;
@Column(name = "ACFISCAL", length = 20)
private String acfiscal; private String acfiscal;
@Column(name = "SERIE", length = 20)
private String serie; private String serie;
@Column(name = "SUBSERIE", length = 20)
private String subserie; private String subserie;
@Column(name = "FORMINICIAL", length = 12)
private String forminicial; private String forminicial;
@Column(name = "FORMFINAL", length = 12)
private String formfinal; private String formfinal;
@Temporal(TemporalType.DATE)
@Column(name = "FECADQUISICION", length = 7)
private Date fecadquisicion; private Date fecadquisicion;
@Temporal(TemporalType.DATE)
@Column(name = "FECVENCIMIENTO", length = 7)
private Date fecvencimiento; private Date fecvencimiento;
@Column(name = "INSCESTADUAL", length = 20)
private String inscestadual; private String inscestadual;
@JoinColumn(name = "EMPRESA_ID")
@ManyToOne
private Empresa empresa; private Empresa empresa;
@Column(name = "ACTIVO", precision = 1, scale = 0)
private Boolean activo; private Boolean activo;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "FECMODIF", length = 7)
private Date fecmodif; private Date fecmodif;
@Column(name = "USUARIO_ID", precision = 7, scale = 0)
private Integer usuarioId; private Integer usuarioId;
@Column(name = "CNPJ", length = 20)
private String cnpj; private String cnpj;
@Column(name = "TIPOVALIDAVENTA")
private String tipoValidaVenta; private String tipoValidaVenta;
public Aidf() { public Aidf() {
@ -73,8 +104,6 @@ public class Aidf implements java.io.Serializable {
} }
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "PUNTOVENTA_ID")
public PuntoVenta getPuntoVenta() { public PuntoVenta getPuntoVenta() {
return puntoVenta; return puntoVenta;
} }
@ -103,10 +132,6 @@ public class Aidf implements java.io.Serializable {
return true; return true;
} }
@Id
@GenericGenerator(name = "aidfgen_id", strategy = "com.rjconsultores.ventaboletos.dao.util.AidfGenerator")
@GeneratedValue(generator = "aidfgen_id")
@Column(name = "AIDF_ID", unique = true, nullable = false, precision = 15, scale = 0)
public Long getAidfId() { public Long getAidfId() {
return aidfId; return aidfId;
} }
@ -115,8 +140,6 @@ public class Aidf implements java.io.Serializable {
this.aidfId = aidfId; this.aidfId = aidfId;
} }
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "AIDFTIPO_ID")
public AidfTipo getAidfTipo() { public AidfTipo getAidfTipo() {
return aidfTipo; return aidfTipo;
} }
@ -125,8 +148,6 @@ public class Aidf implements java.io.Serializable {
this.aidfTipo = aidfTipo; this.aidfTipo = aidfTipo;
} }
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "AIDFESP_ID")
public AidfEspecie getAidfEspecie() { public AidfEspecie getAidfEspecie() {
return aidfEspecie; return aidfEspecie;
} }
@ -135,8 +156,6 @@ public class Aidf implements java.io.Serializable {
this.aidfEspecie = aidfEspecie; this.aidfEspecie = aidfEspecie;
} }
@JoinColumn(name = "ESTADO_ID")
@ManyToOne
public Estado getEstado() { public Estado getEstado() {
return estado; return estado;
} }
@ -145,7 +164,6 @@ public class Aidf implements java.io.Serializable {
this.estado = estado; this.estado = estado;
} }
@Column(name = "DOCFISCAL", length = 20)
public String getDocfiscal() { public String getDocfiscal() {
return docfiscal; return docfiscal;
} }
@ -154,7 +172,6 @@ public class Aidf implements java.io.Serializable {
this.docfiscal = docfiscal; this.docfiscal = docfiscal;
} }
@Column(name = "ACFISCAL", length = 20)
public String getAcfiscal() { public String getAcfiscal() {
return acfiscal; return acfiscal;
} }
@ -163,7 +180,6 @@ public class Aidf implements java.io.Serializable {
this.acfiscal = acfiscal; this.acfiscal = acfiscal;
} }
@Column(name = "SERIE", length = 20)
public String getSerie() { public String getSerie() {
return serie; return serie;
} }
@ -172,7 +188,6 @@ public class Aidf implements java.io.Serializable {
this.serie = serie; this.serie = serie;
} }
@Column(name = "SUBSERIE", length = 20)
public String getSubserie() { public String getSubserie() {
return subserie; return subserie;
} }
@ -181,7 +196,6 @@ public class Aidf implements java.io.Serializable {
this.subserie = subserie; this.subserie = subserie;
} }
@Column(name = "FORMINICIAL", length = 12)
public String getForminicial() { public String getForminicial() {
return forminicial; return forminicial;
} }
@ -190,7 +204,6 @@ public class Aidf implements java.io.Serializable {
this.forminicial = forminicial; this.forminicial = forminicial;
} }
@Column(name = "FORMFINAL", length = 12)
public String getFormfinal() { public String getFormfinal() {
return formfinal; return formfinal;
} }
@ -199,8 +212,6 @@ public class Aidf implements java.io.Serializable {
this.formfinal = formfinal; this.formfinal = formfinal;
} }
@Temporal(TemporalType.DATE)
@Column(name = "FECADQUISICION", length = 7)
public Date getFecadquisicion() { public Date getFecadquisicion() {
return fecadquisicion; return fecadquisicion;
} }
@ -209,7 +220,6 @@ public class Aidf implements java.io.Serializable {
this.fecadquisicion = fecadquisicion; this.fecadquisicion = fecadquisicion;
} }
@Column(name = "CNPJ", length = 20)
public String getCnpj() { public String getCnpj() {
return cnpj; return cnpj;
} }
@ -218,8 +228,6 @@ public class Aidf implements java.io.Serializable {
this.cnpj = cnpj; this.cnpj = cnpj;
} }
@Temporal(TemporalType.DATE)
@Column(name = "FECVENCIMIENTO", length = 7)
public Date getFecvencimiento() { public Date getFecvencimiento() {
return fecvencimiento; return fecvencimiento;
} }
@ -228,7 +236,6 @@ public class Aidf implements java.io.Serializable {
this.fecvencimiento = fecvencimiento; this.fecvencimiento = fecvencimiento;
} }
@Column(name = "INSCESTADUAL", length = 20)
public String getInscestadual() { public String getInscestadual() {
return inscestadual; return inscestadual;
} }
@ -237,8 +244,6 @@ public class Aidf implements java.io.Serializable {
this.inscestadual = inscestadual; this.inscestadual = inscestadual;
} }
@JoinColumn(name = "EMPRESA_ID")
@ManyToOne
public Empresa getEmpresa() { public Empresa getEmpresa() {
return empresa; return empresa;
} }
@ -247,7 +252,6 @@ public class Aidf implements java.io.Serializable {
this.empresa = empresa; this.empresa = empresa;
} }
@Column(name = "ACTIVO", precision = 1, scale = 0)
public Boolean getActivo() { public Boolean getActivo() {
return activo; return activo;
} }
@ -256,8 +260,6 @@ public class Aidf implements java.io.Serializable {
this.activo = activo; this.activo = activo;
} }
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "FECMODIF", length = 7)
public Date getFecmodif() { public Date getFecmodif() {
return fecmodif; return fecmodif;
} }
@ -266,7 +268,6 @@ public class Aidf implements java.io.Serializable {
this.fecmodif = fecmodif; this.fecmodif = fecmodif;
} }
@Column(name = "USUARIO_ID", precision = 7, scale = 0)
public Integer getUsuarioId() { public Integer getUsuarioId() {
return usuarioId; return usuarioId;
} }
@ -275,7 +276,6 @@ public class Aidf implements java.io.Serializable {
this.usuarioId = usuarioId; this.usuarioId = usuarioId;
} }
@Column(name = "TIPOVALIDAVENTA")
public String getTipoValidaVenta() { public String getTipoValidaVenta() {
return tipoValidaVenta; return tipoValidaVenta;
} }
@ -283,11 +283,26 @@ public class Aidf implements java.io.Serializable {
public void setTipoValidaVenta(String tipoValidaVenta) { public void setTipoValidaVenta(String tipoValidaVenta) {
this.tipoValidaVenta = tipoValidaVenta; this.tipoValidaVenta = tipoValidaVenta;
} }
public String obterSerieSubserieFormatada() {
String serieInformada = this.getSerie();
String subSerieInformada = this.getSubserie();
if(serieInformada == null) {
serieInformada = "";
}
return serieInformada
.trim()
.concat(
subSerieInformada == null || subSerieInformada.isEmpty()
? ""
: "-".concat(subSerieInformada.trim()));
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s - %s", this.getAidfId(), (this.getSerie() == null ? "" : this.getSerie() return String.format("%s - %s", this.getAidfId(), obterSerieSubserieFormatada());
+ this.getSubserie() == null ? "" : this.getSubserie()));
} }
} }

View File

@ -84,6 +84,10 @@ public class DetAbastoBoleto implements Serializable {
public String getNumfolioinicial() { public String getNumfolioinicial() {
return numfolioinicial; return numfolioinicial;
} }
public Long getFolioInicial() {
return Long.valueOf(numfolioinicial);
}
public void setNumfolioinicial(String numfolioinicial) { public void setNumfolioinicial(String numfolioinicial) {
this.numfolioinicial = numfolioinicial; this.numfolioinicial = numfolioinicial;
@ -92,6 +96,10 @@ public class DetAbastoBoleto implements Serializable {
public String getNumfoliofinal() { public String getNumfoliofinal() {
return numfoliofinal; return numfoliofinal;
} }
public Long getFolioFinal() {
return Long.valueOf(numfoliofinal);
}
public void setNumfoliofinal(String numfoliofinal) { public void setNumfoliofinal(String numfoliofinal) {
this.numfoliofinal = numfoliofinal; this.numfoliofinal = numfoliofinal;

View File

@ -1082,7 +1082,7 @@ public class PuntoVenta implements Serializable, Auditavel<PuntoVenta> {
} }
public String getCep(){ public String getCep(){
return codpostal != null ? codpostal.toString() : ""; return codpostal != null ? codpostal : "";
} }
public String getLogradouro(){ public String getLogradouro(){

View File

@ -42,6 +42,11 @@ public class TipoMovimentacion implements java.io.Serializable {
this.tipomovimentacionId = tipomovimentacionId; this.tipomovimentacionId = tipomovimentacionId;
} }
public TipoMovimentacion(Integer tipomovimentacionId, String desctipomovimentacion) {
this.tipomovimentacionId = tipomovimentacionId;
this.desctipomovimentacion = desctipomovimentacion;
}
public TipoMovimentacion(Integer tipomovimentacionId, String desctipomovimentacion, Boolean activo, Date fecmodif, Integer usuarioId) { public TipoMovimentacion(Integer tipomovimentacionId, String desctipomovimentacion, Boolean activo, Date fecmodif, Integer usuarioId) {
this.tipomovimentacionId = tipomovimentacionId; this.tipomovimentacionId = tipomovimentacionId;
this.desctipomovimentacion = desctipomovimentacion; this.desctipomovimentacion = desctipomovimentacion;

View File

@ -1,6 +1,12 @@
package com.rjconsultores.ventaboletos.service; package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
import com.rjconsultores.ventaboletos.entidad.Aidf;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.exception.BusinessException;
public interface AbastoBoletoService extends GenericService<AbastoBoleto, Integer> { public interface AbastoBoletoService extends GenericService<AbastoBoleto, Integer> {
public AbastoBoleto movimentaAbasto(AbastoBoleto abastoBoleto, PuntoVenta destino) throws BusinessException;
} }

View File

@ -28,6 +28,8 @@ public interface AidfService {
public List<AidfTipo> obtenerTodosAdifTipo(); public List<AidfTipo> obtenerTodosAdifTipo();
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas); public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas);
public List<Aidf> buscaAidfsPorEmpresasAgencia(List<Empresa> empresas, PuntoVenta pontoVenda);
public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn); public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn);

View File

@ -2,9 +2,11 @@ package com.rjconsultores.ventaboletos.service;
import java.util.List; import java.util.List;
import com.rjconsultores.ventaboletos.entidad.AbastoBoleto;
import com.rjconsultores.ventaboletos.entidad.Aidf; import com.rjconsultores.ventaboletos.entidad.Aidf;
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.exception.BusinessException;
public interface DetAbastoBoletoService extends GenericService<DetAbastoBoleto, Integer> { public interface DetAbastoBoletoService extends GenericService<DetAbastoBoleto, Integer> {
@ -15,4 +17,8 @@ public interface DetAbastoBoletoService extends GenericService<DetAbastoBoleto,
public List<DetAbastoBoleto> buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa); public List<DetAbastoBoleto> buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa);
public List<Object> buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf Aidf); public List<Object> buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf Aidf);
public DetAbastoBoleto buscarPorAidf(Long aidfId, String folioInicial, String folioFinal);
public DetAbastoBoleto movimentaDetAbasto(Aidf aidf, AbastoBoleto abasto, String folioInicial, String folioFinal) throws BusinessException;
} }

View File

@ -9,6 +9,8 @@ import org.springframework.transaction.annotation.Transactional;
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;
import com.rjconsultores.ventaboletos.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.AbastoBoletoService; import com.rjconsultores.ventaboletos.service.AbastoBoletoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -54,5 +56,40 @@ public class AbastoBoletoServiceImpl implements AbastoBoletoService {
abastoBoletoDAO.actualizacion(entidad); abastoBoletoDAO.actualizacion(entidad);
} }
@Transactional
@Override
public AbastoBoleto movimentaAbasto(
AbastoBoleto abastoBoleto,
PuntoVenta destino) throws BusinessException {
if( abastoBoleto == null ) {
throw new BusinessException("abastoService.msg.semOrigem");
}
try {
AbastoBoleto novo = new AbastoBoleto();
novo.setArticulo(abastoBoleto.getArticulo());
novo.setCantfajilla(abastoBoleto.getCantfajilla());
novo.setClasificacion(abastoBoleto.getClasificacion());
novo.setEmpresa(abastoBoleto.getEmpresa());
novo.setEstacion(abastoBoleto.getEstacion());
novo.setFechorfirma(abastoBoleto.getFechorfirma());
novo.setFechorreq(abastoBoleto.getFechorreq());
novo.setNumrequisicion(abastoBoleto.getNumrequisicion());
novo.setNumservidor(abastoBoleto.getNumservidor());
novo.setPuntoventacentral(abastoBoleto.getPuntoventacentral());
novo.setStatusEnvio(abastoBoleto.getStatusEnvio());
novo.setStatusfirma(abastoBoleto.getStatusfirma());
novo.setUsuariogeneracionId(abastoBoleto.getUsuariogeneracionId());
novo.setUsuarioreqId(abastoBoleto.getUsuarioreqId());
novo.setPuntoventa(destino);
novo.setFechorgeneracion(Calendar.getInstance().getTime());
return novo;
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
}
} }

View File

@ -90,8 +90,11 @@ public class AidfServiceImpl implements AidfService {
} }
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas) { public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas) {
List<Aidf> aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas); return aidfDAO.buscaAidfsPorEmpresas(empresas);
return aidfs; }
public List<Aidf> buscaAidfsPorEmpresasAgencia(List<Empresa> empresas, PuntoVenta pontoVenda){
return aidfDAO.buscaAidfsPorEmpresasAgencia(empresas, pontoVenda);
} }
public List<AidfVo> obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn) { public List<AidfVo> obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn) {

View File

@ -8,9 +8,11 @@ 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.AbastoBoleto;
import com.rjconsultores.ventaboletos.entidad.Aidf; import com.rjconsultores.ventaboletos.entidad.Aidf;
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.exception.BusinessException;
import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService; import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -92,4 +94,42 @@ public class DetAbastoBoletoServiceImpl implements DetAbastoBoletoService {
return detAbastoBoletoDAO.buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(aidf); return detAbastoBoletoDAO.buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(aidf);
} }
@Override
public DetAbastoBoleto movimentaDetAbasto(
Aidf aidf,
AbastoBoleto abasto,
String folioInicial,
String folioFinal) throws BusinessException {
DetAbastoBoleto detAbasto = buscarPorAidf(aidf.getAidfId(), folioInicial, folioFinal);
if( detAbasto == null ) {
throw new BusinessException("detAbastoService.msg.semOrigem");
}
try {
DetAbastoBoleto novo = new DetAbastoBoleto();
novo.setAidf(detAbasto.getAidf());
novo.setIndinutiliza(detAbasto.getIndinutiliza());
novo.setNummovimiento(detAbasto.getNummovimiento());
novo.setNumseriepreimpresa(detAbasto.getNumseriepreimpresa());
novo.setStatusenvio(detAbasto.getStatusenvio());
novo.setStatusfirma(detAbasto.getStatusfirma());
novo.setStatusoperacion(detAbasto.getStatusoperacion());
novo.setAbastoBoleto(abasto);
novo.setNumfolioinicial(folioInicial);
novo.setNumfoliofinal(folioFinal);
return novo;
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
}
@Override
public DetAbastoBoleto buscarPorAidf(Long aidfId, String folioInicial, String folioFinal) {
return detAbastoBoletoDAO.buscarPorAidf(aidfId, folioInicial, folioFinal);
}
} }