cambio de proceso polizas vencidas

This commit is contained in:
2026-05-11 13:03:57 +02:00
parent ed81d8d5a6
commit 4e7f72cdb9
4 changed files with 29 additions and 22 deletions

View File

@@ -24,35 +24,31 @@ namespace Servicio_Gestion_Asegasa.Procesos
{ {
DateOnly hoy = DateOnly.FromDateTime(DateTime.Now); DateOnly hoy = DateOnly.FromDateTime(DateTime.Now);
List<polizassg> listadoPolizasVencidas = bd.polizassg.Where(x => x.idTipoCobro == 272 && x.FechaVencimiento < hoy).ToList();
var lr = bd.polizassg.Include(x => x.entidadespolizas).ThenInclude(x => x.idEntidadNavigation).Include(x => x.idRamoNavigation).Include(x => x.idAgenteNavigation).ToList() var lr = bd.recibos.Include(x => x.idPolizaNavigation).ThenInclude(x => x.entidadespolizas).ThenInclude(x => x.idEntidadNavigation).Include(x => x.idPolizaNavigation)
.Where(x => x.idTipoCobro == 272 && x.FechaVencimiento < hoy).Select(x => new PolizaPagoUnicoExcel{ .ThenInclude(x => x.idCompaniaNavigation).Include(x => x.idAgenteNavigation).Where(x => x.idPolizaNavigation.idTipoCobro == 272 && x.FechaVencimiento < hoy).Select(x => new PolizaPagoUnicoExcel{
NumeroPoliza = x.NumeroPoliza ?? "", NumeroPoliza = x.idPolizaNavigation.NumeroPoliza ?? "",
RazonSocial = x.Tomador?.RazonSocial ?? "", RazonSocial = x.idPolizaNavigation.Tomador.RazonSocial ?? "",
FechaEfecto = x.FechaEfecto, FechaEfecto = x.FechaEfecto,
FechaVencimiento = x.FechaVencimiento, FechaVencimiento = x.FechaVencimiento,
Descripcion = x.idRamoNavigation?.Descripcion ?? "", Descripcion = x.idPolizaNavigation.idRamoNavigation.Descripcion ?? "",
NombreAgente = x.idAgenteNavigation?.Nombre ?? "", NombreAgente = x.idPolizaNavigation.idAgenteNavigation.Nombre ?? "",
CiaNumeroPolizaSuplemento = x.CiaNumeroPolizaSuplemento CiaNumeroPolizaSuplemento = x.idPolizaNavigation.CiaNumeroPolizaSuplemento
}).ToList(); }).ToList();
byte[] f = tsUtilidades.Excel.IEnumerableAExcel(lr);
string sFichero = @"C:\temp\listadoPolizas.xlsx"; byte[] excelPolizas = tsUtilidades.Excel.IEnumerableAExcel(lr);
File.WriteAllBytes(sFichero, f);
//await bd.polizassg.Where(x => x.idTipoCobro == 272 && x.FechaVencimiento < hoy).ExecuteUpdateAsync(setters => setters //await bd.polizassg.Where(x => x.idTipoCobro == 272 && x.recibos.Any(r => r.FechaVencimiento < hoy)).ExecuteUpdateAsync(setters => setters
// .SetProperty(x => x.FechaBaja, x => x.FechaVencimiento) // .SetProperty(x => x.FechaBaja, hoy)
// .SetProperty(x => x.idCausaBaja, 784)); // .SetProperty(x => x.idCausaBaja, 784));
string sDireccionesEnvio = "davidperea@tecnosis.net"; string sDireccionesEnvio = "davidperea@tecnosis.net";
string sServidorSMTP = "mail.tecnosis.net"; string sServidorSMTP = "mail.tecnosis.net";
@@ -64,7 +60,7 @@ namespace Servicio_Gestion_Asegasa.Procesos
listadoFicheros.Add(new tsUtilidades.Correo.FicheroAdjunto listadoFicheros.Add(new tsUtilidades.Correo.FicheroAdjunto
{ {
NombreFichero = "FicherosVencidos.xlsx", NombreFichero = "FicherosVencidos.xlsx",
Fichero = f Fichero = excelPolizas
}); });
tsUtilidades.Correo.Funciones.EnviaCorreoVariosAdjuntos(sServidorSMTP, sRemitente, sDireccionesEnvio, Asunto, Cuerpo, listadoFicheros); tsUtilidades.Correo.Funciones.EnviaCorreoVariosAdjuntos(sServidorSMTP, sRemitente, sDireccionesEnvio, Asunto, Cuerpo, listadoFicheros);

View File

@@ -30,12 +30,11 @@ namespace Servicio_Gestion_Asegasa
try try
{ {
await ComprobarPolizasPagoUnico();
if (ProcesosConf.Conf.HoraProcesosDiarios != null) if (ProcesosConf.Conf.HoraProcesosDiarios != null)
{ {
Mensaje += " Hora Procesos Programados: " + ProcesosConf.Conf.HoraProcesosDiarios; Mensaje += " Hora Procesos Programados: " + ProcesosConf.Conf.HoraProcesosDiarios;
CreaTareaProcesosDiarios(); await CreaTareaProcesosDiariosAsync();
} }
await Logs.A<EFBFBD>adeLogAsync(tsUtilidades.Enumeraciones.TipoLog.InicioServicio, "Inicio " + Mensaje); await Logs.A<EFBFBD>adeLogAsync(tsUtilidades.Enumeraciones.TipoLog.InicioServicio, "Inicio " + Mensaje);
@@ -67,7 +66,7 @@ namespace Servicio_Gestion_Asegasa
private void CreaTareaProcesosDiarios() private async Task CreaTareaProcesosDiariosAsync()
{ {
ISchedulerFactory schedulerFactory = new StdSchedulerFactory(); ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
IScheduler scheduler = schedulerFactory.GetScheduler().Result; IScheduler scheduler = schedulerFactory.GetScheduler().Result;
@@ -78,6 +77,8 @@ namespace Servicio_Gestion_Asegasa
.Build(); .Build();
// Crear un trigger que se ejecute diariamente a una hora espec<65>fica // Crear un trigger que se ejecute diariamente a una hora espec<65>fica
await ComprobarPolizasPagoUnico();
int Hora = int.Parse(ProcesosConf.Conf.HoraProcesosDiarios.Split(":")[0]); int Hora = int.Parse(ProcesosConf.Conf.HoraProcesosDiarios.Split(":")[0]);
int Minutos = int.Parse(ProcesosConf.Conf.HoraProcesosDiarios.Split(":")[1]); int Minutos = int.Parse(ProcesosConf.Conf.HoraProcesosDiarios.Split(":")[1]);

View File

@@ -333,7 +333,7 @@ namespace bdAsegasa.db
} }
} }
} }
public string CiaNumeroPolizaSuplemento public string CiaNumeroPolizaSuplemento
{ {
get get
{ {

View File

@@ -3,6 +3,7 @@ using bdAsegasa.Informes;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using tsEFCore8; using tsEFCore8;
@@ -18,6 +19,7 @@ namespace bdAsegasa.db
// Revisado // Revisado
#region Contabilidad #region Contabilidad
[NotMapped]
public string Tomador public string Tomador
{ {
@@ -33,6 +35,7 @@ namespace bdAsegasa.db
} }
} }
} }
[NotMapped]
public double LiquidoCia public double LiquidoCia
{ {
@@ -43,6 +46,7 @@ namespace bdAsegasa.db
return Math.Round(total - comision, 2, MidpointRounding.AwayFromZero); return Math.Round(total - comision, 2, MidpointRounding.AwayFromZero);
} }
} }
[NotMapped]
public int NumeroDiasRemesaPago public int NumeroDiasRemesaPago
{ {
@@ -504,7 +508,7 @@ namespace bdAsegasa.db
#region Comisiones #region Comisiones
[NotMapped]
public bool BloquearFacturacion public bool BloquearFacturacion
{ {
get get
@@ -541,6 +545,8 @@ namespace bdAsegasa.db
} }
} }
} }
[NotMapped]
public int? idAgente_Nulable public int? idAgente_Nulable
{ {
get get
@@ -669,6 +675,8 @@ namespace bdAsegasa.db
tsUtilidades.TsNotificacionesClient.RegistrarAsync( "En GuardandoCambios", ex.Message + sListaCambios, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR); tsUtilidades.TsNotificacionesClient.RegistrarAsync( "En GuardandoCambios", ex.Message + sListaCambios, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
} }
} }
[NotMapped]
public string NombreSubAgente public string NombreSubAgente
{ {
get get
@@ -1043,6 +1051,7 @@ namespace bdAsegasa.db
} }
} }
[NotMapped]
public string DescripcionSuplemento public string DescripcionSuplemento
{ {
@@ -1262,6 +1271,7 @@ namespace bdAsegasa.db
} }
[NotMapped]
public FormaComunicacionEnum FormaComunicacionTMP { get; set; } public FormaComunicacionEnum FormaComunicacionTMP { get; set; }