Servicio de cola de impresion - Only Control

This commit is contained in:
james 2023-02-12 22:59:06 -05:00
parent e464e4a486
commit b698acb879
2 changed files with 120 additions and 115 deletions

View File

@ -20,7 +20,9 @@ import com.fp.persistence.parmas.param.TarmCentroControl;
import com.fp.persistence.pgeneral.safe.TsafeUserDetail;
/**
* Componente que realiza la búsquedas de los datos de impresión de un usuario
* Componente que realiza la búsquedas de los datos de impresión
* de un usuario
*
* @author dcruz
*
*/
@ -88,8 +90,9 @@ public class ColaImpresion extends QueryRule{
colaImpresionObj.setEstadoimpresioncode(tmp[2].toString());
colaImpresionObj.setCdocumento((new BigDecimal(tmp[0].toString())).longValue());
colaImpresionObj.setFecharegistro(new Date(((Timestamp) tmp[5]).getTime()));
if (tmp[6] != null)
if (tmp[6] != null) {
colaImpresionObj.setCodigotarjeta(tmp[6].toString());
}
coladeImpresionList.add(colaImpresionObj);
}
lcolaImpresion = ColaImpresionUtil.getInstancia().completaColaImpresion(coladeImpresionList, tsafeUserDetail.getPk().getPersoncode(), tsafeUserDetail.getPk().getUsercode());

View File

@ -20,16 +20,18 @@ import com.fp.persistence.parmas.inte.TarmColadeImpresion;
/**
* Consulta los datos de impresión del proceso
*
* @author dcruz
*
*/
public class ConsultaImpresionProceso extends QueryRule {
private static final long serialVersionUID = -7675701723545274414L;
public static final String QUERY_COLA_SOLICITUD = "SELECT o.* FROM TarmColadeImpresion o WHERE o.estadoimpresion='PIMPR' and o.cdocumento "
public static final String QUERY_COLA_SOLICITUD = "SELECT cdocumento, estadoimpresion, estadoimpresioncode, cimpresion, fechaimpresion, "
+ "fecharegistro, codigotarjeta FROM TarmColadeImpresion o WHERE o.estadoimpresion='PIMPR' and o.cdocumento "
+ "IN ((SELECT i.cdocumento FROM TarmDocumentoHabilitante i WHERE i.csolicitud IN (SELECT c.CSOLICITUD FROM TarmSolicitud c "
+ "WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)) UNION (SELECT SD.cdocumento FROM tarmsolicituddocumento SD WHERE sd.csolicitud "
+ "IN (SELECT c.CSOLICITUD FROM TarmSolicitud c WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)))";
+ "WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)) UNION (SELECT SD.cdocumento FROM tarmsolicituddocumento SD "
+ "WHERE sd.csolicitud IN (SELECT c.CSOLICITUD FROM TarmSolicitud c WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)))";
@SuppressWarnings("unchecked")
@Override
@ -44,25 +46,25 @@ public class ConsultaImpresionProceso extends QueryRule {
Query query = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_COLA_SOLICITUD);
query.setParameter("numerosolicitud", codigosolicitud);
List<TarmColadeImpresion> ltarmColadeImpresions = new ArrayList<TarmColadeImpresion>();
List<TarmColadeImpresion> ltarmColadeImpresions = new ArrayList<>();
List<Object[]> ltarmColadeImpresionsTMP = query.getResultList();
for (Object[] tmp : ltarmColadeImpresionsTMP) {
TarmColadeImpresion colaImpresionObj = new TarmColadeImpresion();
colaImpresionObj.setPk(tmp[3].toString());
colaImpresionObj.setEstadoimpresion(tmp[1].toString());
colaImpresionObj.setFechaimpresion((Timestamp) tmp[4]);
colaImpresionObj.setEstadoimpresioncode(tmp[2].toString());
colaImpresionObj.setCdocumento(((BigDecimal) tmp[0]).longValue());
colaImpresionObj.setFecharegistro(new Date(((Timestamp) tmp[5]).getTime()));
if (tmp[6] != null)
colaImpresionObj.setEstadoimpresion(tmp[1].toString());
colaImpresionObj.setEstadoimpresioncode(tmp[2].toString());
colaImpresionObj.setPk(tmp[3].toString());
colaImpresionObj.setFechaimpresion(tmp[4] == null ? null : new Timestamp(((Date) tmp[4]).getTime()));
colaImpresionObj.setFecharegistro(tmp[5] == null ? null : (Date) tmp[5]);
if (tmp[6] != null) {
colaImpresionObj.setCodigotarjeta(tmp[6].toString());
}
ltarmColadeImpresions.add(colaImpresionObj);
}
lcolaImpresion = ColaImpresionUtil.getInstancia().completaColaImpresion(ltarmColadeImpresions);
pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion);
pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion);
// pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion);
} catch (Throwable e) {
APPLogger.getLogger().error(e.getMessage(), e);
}