- 2026-05-12 1.2.0.0 Correccion tsUtilidades
- 2026-05-12 1.1.0.0 Se añade rutina diaria FinalizaPolizasPagoUnicoVencidas
This commit is contained in:
@@ -8,18 +8,19 @@ namespace Servicio_Gestion_Asegasa.Clases
|
||||
{
|
||||
public class PolizaPagoUnicoExcel
|
||||
{
|
||||
public int idPoliza { get; set; }
|
||||
public string NumeroPoliza { get; set; }
|
||||
|
||||
public string RazonSocial { get; set; }
|
||||
public string Tomador { get; set; }
|
||||
|
||||
public DateOnly FechaEfecto { get; set; }
|
||||
|
||||
public DateOnly FechaVencimiento { get; set; }
|
||||
|
||||
public string Descripcion { get; set; }
|
||||
public string Ramo { get; set; }
|
||||
|
||||
public string NombreAgente { get; set; }
|
||||
|
||||
public string CiaNumeroPolizaSuplemento { get; set; }
|
||||
public string Compañia { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,61 +25,61 @@ namespace Servicio_Gestion_Asegasa
|
||||
//
|
||||
// Modificaciones:
|
||||
// ===============
|
||||
if (oBloqueoLog == null) oBloqueoLog = new object();
|
||||
lock (oBloqueoLog)
|
||||
//if (oBloqueoLog == null) oBloqueoLog = new object();
|
||||
//lock (oBloqueoLog)
|
||||
//{
|
||||
try
|
||||
{
|
||||
try
|
||||
if (e != null)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
|
||||
string sStackTrace = "Tipo excepción: " + e.ToString() + Constants.vbCrLf;
|
||||
Exception exError = e;
|
||||
do
|
||||
{
|
||||
sStackTrace += exError.StackTrace + Constants.vbCrLf;
|
||||
exError = exError.InnerException;
|
||||
}
|
||||
while (!Information.IsNothing(exError));
|
||||
if (sStackTrace != "")
|
||||
Mensaje += Constants.vbCrLf + "|StackTrace: " + sStackTrace;
|
||||
}
|
||||
switch (Tipo)
|
||||
string sStackTrace = "Tipo excepción: " + e.ToString() + Constants.vbCrLf;
|
||||
Exception exError = e;
|
||||
do
|
||||
{
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
||||
Mensaje = "Error WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Fatal(Mensaje);
|
||||
tsUtilidades.TsNotificacionesClient.RegistrarAsync("Error en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Advertencia:
|
||||
Mensaje = "Advertencia WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Warning(Mensaje);
|
||||
tsUtilidades.TsNotificacionesClient.RegistrarAsync("Advertencia en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ADVERTENCIA);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.InicioServicio:
|
||||
Mensaje = "Inicio WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
tsUtilidades.TsNotificacionesClient.RegistrarAsync("Inicio Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.FinServicio:
|
||||
Mensaje = "Finalización WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
tsUtilidades.TsNotificacionesClient.RegistrarAsync("Finalización Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||
break;
|
||||
default:
|
||||
Mensaje = Tipo.ToString() + " WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
break;
|
||||
sStackTrace += exError.StackTrace + Constants.vbCrLf;
|
||||
exError = exError.InnerException;
|
||||
}
|
||||
while (!Information.IsNothing(exError));
|
||||
if (sStackTrace != "")
|
||||
Mensaje += Constants.vbCrLf + "|StackTrace: " + sStackTrace;
|
||||
}
|
||||
catch (Exception ex)
|
||||
switch (Tipo)
|
||||
{
|
||||
if (e != null)
|
||||
Mensaje += " --- " + e.StackTrace;
|
||||
|
||||
Log.Fatal(Mensaje + " ---" + ex.Message + " --- " + ex.StackTrace);
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Fallo:
|
||||
Mensaje = "Error WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Fatal(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Error en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ERROR);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.Advertencia:
|
||||
Mensaje = "Advertencia WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Warning(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Advertencia en Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.ADVERTENCIA);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.InicioServicio:
|
||||
Mensaje = "Inicio WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Inicio Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||
break;
|
||||
case tsUtilidades.Enumeraciones.TipoLog.FinServicio:
|
||||
Mensaje = "Finalización WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". Mensaje: " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
await tsUtilidades.TsNotificacionesClient.RegistrarAsync("Finalización Servicio Gestion Asegasa", Mensaje, tsUtilidades.TsNotificacionesClient.TipoNotificacionEnum.INFO);
|
||||
break;
|
||||
default:
|
||||
Mensaje = Tipo.ToString() + " WSAsegasa. " + " Enviado desde " + Environment.MachineName + ". Version:" + Assembly.GetEntryAssembly()?.GetName().Version + ". " + Mensaje;
|
||||
Log.Information(Mensaje);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (e != null)
|
||||
Mensaje += " --- " + e.StackTrace;
|
||||
|
||||
Log.Fatal(Mensaje + " ---" + ex.Message + " --- " + ex.StackTrace);
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using bdAsegasa;
|
||||
using bdAsegasa.db;
|
||||
using bdAsegasa.dbcontext;
|
||||
using DevExpress.DataProcessing.InMemoryDataProcessor;
|
||||
using DevExpress.XtraCharts.Native;
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Servicio_Gestion_Asegasa.Clases;
|
||||
using System;
|
||||
@@ -16,58 +19,58 @@ namespace Servicio_Gestion_Asegasa.Procesos
|
||||
public class ProcesosPolizas
|
||||
{
|
||||
|
||||
public static async Task ComprobarPolizasPagoUnico()
|
||||
public static async Task FinalizaPolizasPagoUnicoVencidas()
|
||||
{
|
||||
var bd = tscgestionasegasa.NuevoContexto();
|
||||
|
||||
try
|
||||
{
|
||||
DateOnly hoy = DateOnly.FromDateTime(DateTime.Now);
|
||||
int idTcpu = bd.enumeraciones.First(x => x.Codigo == "DUR.U").idEnumeracion;
|
||||
int idcaba = bd.enumeraciones.First(x => x.Codigo == "CABA.VENCI").idEnumeracion;
|
||||
|
||||
|
||||
var lr = bd.vf_recibosextendidos.Where(x => x.idDuracion == idTcpu && x.FechaVencimiento < hoy && x.FechaBajaPoliza==null && x.NumeroPoliza!=null).Select(x => new PolizaPagoUnicoExcel{
|
||||
idPoliza = x.idPoliza,
|
||||
|
||||
var lr = bd.recibos.Include(x => x.idPolizaNavigation).ThenInclude(x => x.entidadespolizas).ThenInclude(x => x.idEntidadNavigation).Include(x => x.idPolizaNavigation)
|
||||
.ThenInclude(x => x.idCompaniaNavigation).Include(x => x.idAgenteNavigation).Where(x => x.idPolizaNavigation.idTipoCobro == 272 && x.FechaVencimiento < hoy).Select(x => new PolizaPagoUnicoExcel{
|
||||
NumeroPoliza = x.idPolizaNavigation.NumeroPoliza ?? "",
|
||||
NumeroPoliza = x.NumeroPoliza ,
|
||||
|
||||
RazonSocial = x.idPolizaNavigation.Tomador.RazonSocial ?? "",
|
||||
Tomador = x.Tomador,
|
||||
|
||||
FechaEfecto = x.FechaEfecto,
|
||||
|
||||
FechaVencimiento = x.FechaVencimiento,
|
||||
|
||||
Descripcion = x.idPolizaNavigation.idRamoNavigation.Descripcion ?? "",
|
||||
Ramo = x.Ramo,
|
||||
|
||||
NombreAgente = x.idPolizaNavigation.idAgenteNavigation.Nombre ?? "",
|
||||
NombreAgente = x.Agente ?? "",
|
||||
|
||||
CiaNumeroPolizaSuplemento = x.idPolizaNavigation.CiaNumeroPolizaSuplemento
|
||||
Compañia = x.Compania
|
||||
}).ToList();
|
||||
|
||||
if (lr.Count > 0)
|
||||
{
|
||||
string Destinatarios = bd.enumeraciones.First(x => x.Codigo == "CONF.EMAILCONTA").ValorAlfabeticoLargo;
|
||||
byte[] excelPolizas = tsUtilidades.Excel.IEnumerableAExcel(lr);
|
||||
string sql = @"UPDATE polizassg p INNER JOIN recibos r ON r.idPoliza = p.idPoliza SET p.FechaBaja = p.FechaVencimiento, p.idCausaBaja = " + idcaba.ToString() + " WHERE p.idDuracion = " + idTcpu.ToString() + " AND r.FechaVencimiento < '" + hoy.ToString("yyyyMMdd") +@"' AND p.FechaBaja IS NULL;";
|
||||
var na = await bd.Database.ExecuteSqlRawAsync(sql);
|
||||
//await bd.polizassg.Where(x => lPol.Contains(x.idPoliza)).ExecuteUpdateAsync(setters => setters
|
||||
// .SetProperty(x => x.FechaBaja, x.FechaVencimiento)
|
||||
// .SetProperty(x => x.idCausaBaja, idcaba));
|
||||
|
||||
byte[] excelPolizas = tsUtilidades.Excel.IEnumerableAExcel(lr);
|
||||
|
||||
|
||||
//await bd.polizassg.Where(x => x.idTipoCobro == 272 && x.recibos.Any(r => r.FechaVencimiento < hoy)).ExecuteUpdateAsync(setters => setters
|
||||
// .SetProperty(x => x.FechaBaja, hoy)
|
||||
// .SetProperty(x => x.idCausaBaja, 784));
|
||||
|
||||
string sDireccionesEnvio = "sevilla@tecnosis.net";
|
||||
string sServidorSMTP = "mail.tecnosis.net";
|
||||
string sRemitente = "logs@tecnosis.es";
|
||||
string Asunto = "Ficheros vencidos";
|
||||
string Cuerpo = "Excel de ficheros cobro único vencidos.";
|
||||
|
||||
List<tsUtilidades.Correo.FicheroAdjunto> listadoFicheros = new List<tsUtilidades.Correo.FicheroAdjunto>();
|
||||
listadoFicheros.Add(new tsUtilidades.Correo.FicheroAdjunto
|
||||
{
|
||||
NombreFichero = "FicherosVencidos.xlsx",
|
||||
Fichero = excelPolizas
|
||||
});
|
||||
|
||||
tsUtilidades.Correo.Funciones.EnviaCorreoVariosAdjuntos(sServidorSMTP, sRemitente, sDireccionesEnvio, Asunto, Cuerpo, listadoFicheros);
|
||||
var cta = bd.cuentascorreo.First(x => x.Codigo == "TECNOSIS");
|
||||
correos.GeneraRegistroCorreoConAdjunto(bd,
|
||||
"Listado de pólizas de Duración Pago Único Vencidas.",
|
||||
"Se ha procedido dar de baja por vencimiento a las pólizas del fichero adjunto de tipo de duración a único.",
|
||||
cta,
|
||||
excelPolizas, "PolizasPagoUnicoVencidas-" + hoy.ToString("yyyy-MM-dd") + ".xlsx",
|
||||
"Pólizas pago único vencidas",
|
||||
Destinatarios);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
catch (Exception ex) {
|
||||
await Logs.AñadeLogAsync(tsUtilidades.Enumeraciones.TipoLog.Fallo, ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ using Microsoft.Extensions.Hosting;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder.Configuration
|
||||
.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||
builder.Services.AddHostedService<Worker>();
|
||||
|
||||
builder.Services.Configure<Configuracion>(
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<AssemblyVersion>1.2.0.0</AssemblyVersion>
|
||||
<PackageReleaseNotes>
|
||||
- 2026-05-12 1.2.0.0 Correccion tsUtilidades
|
||||
- 2026-05-12 1.1.0.0 Se añade rutina diaria FinalizaPolizasPagoUnicoVencidas
|
||||
- 2026-04-24 1.0.0.0 Primera versión estable
|
||||
</PackageReleaseNotes>
|
||||
<Nullable>enable</Nullable>
|
||||
@@ -18,7 +20,8 @@
|
||||
<PackageReference Include="Quartz" Version="3.15.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
<PackageReference Include="tsUtilidades" Version="1.1.14" />
|
||||
<PackageReference Include="tsCorreos" Version="1.0.6" />
|
||||
<PackageReference Include="tsUtilidades" Version="1.1.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace Servicio_Gestion_Asegasa
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
|
||||
string Mensaje = "Servicio Gestion Asegasa. Versi<73>n: " + tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
||||
|
||||
try
|
||||
{
|
||||
//await ProcesosPolizas.ComprobarPolizasPagoUnico();
|
||||
|
||||
if (ProcesosConf.Conf.HoraProcesosDiarios != null)
|
||||
{
|
||||
@@ -76,10 +76,6 @@ namespace Servicio_Gestion_Asegasa
|
||||
.WithIdentity("TareasProgramadas", "Grupo1")
|
||||
.Build();
|
||||
// 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 Minutos = int.Parse(ProcesosConf.Conf.HoraProcesosDiarios.Split(":")[1]);
|
||||
Quartz.ITrigger trigger = Quartz.TriggerBuilder.Create()
|
||||
@@ -99,15 +95,9 @@ namespace Servicio_Gestion_Asegasa
|
||||
|
||||
public class TareasProgramadas : IJob
|
||||
{
|
||||
public Task Execute(IJobExecutionContext context)
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
//var ch = bdTecnosis.db.chequeos;
|
||||
// var bd = bdTecnosis.tscTecnosis.NuevoContexto();
|
||||
//var c = bd.chequeos.FirstOrDefault(x => x.idChequeo == ch.idChequeo);
|
||||
//Comprobaciones.ChequeaColaCorreo(bd,c);
|
||||
//Comprobaciones.CompruebaReplica();
|
||||
//Aqui van los procesos y comprobaciones
|
||||
return Task.CompletedTask;
|
||||
await ProcesosPolizas.FinalizaPolizasPagoUnicoVencidas();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,4 +191,11 @@ public partial class vf_recibosextendidos
|
||||
public string? CodigoCausaDevolucion { get; set; }
|
||||
|
||||
public DateOnly? FechaRemesa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// tabla enumeraciones
|
||||
/// </summary>
|
||||
public int? idTipoCobro { get; set; }
|
||||
|
||||
public DateOnly? FechaBajaPoliza { get; set; }
|
||||
}
|
||||
|
||||
@@ -3796,7 +3796,7 @@ public partial class gestionasegasaContext : DbContext
|
||||
|
||||
entity.Property(e => e.idPlantilla).HasColumnType("int(11)");
|
||||
entity.Property(e => e.Codigo)
|
||||
.HasMaxLength(30)
|
||||
.HasMaxLength(60)
|
||||
.UseCollation("latin1_swedish_ci")
|
||||
.HasCharSet("latin1");
|
||||
entity.Property(e => e.Descripcion)
|
||||
@@ -6275,6 +6275,9 @@ public partial class gestionasegasaContext : DbContext
|
||||
entity.Property(e => e.idSituacion).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idSubagente).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idTipo).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idTipoCobro)
|
||||
.HasComment("tabla enumeraciones")
|
||||
.HasColumnType("int(11)");
|
||||
entity.Property(e => e.idTipoPago)
|
||||
.HasComment("tabla enumeraciones")
|
||||
.HasColumnType("int(11)");
|
||||
|
||||
Reference in New Issue
Block a user