Fix: Cambios solicitados. Parte 1
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 6m18s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 6m18s
This commit is contained in:
@@ -61,13 +61,13 @@ namespace GestionIntegral.Api.Data.Repositories.Distribucion
|
||||
}
|
||||
if (fechaDesde.HasValue)
|
||||
{
|
||||
sqlBuilder.Append(" AND sb.FechaRemito >= @FechaDesdeParam"); // O FechaEstado según el contexto del filtro
|
||||
sqlBuilder.Append(" AND sb.FechaRemito >= @FechaDesdeParam");
|
||||
parameters.Add("FechaDesdeParam", fechaDesde.Value.Date);
|
||||
}
|
||||
if (fechaHasta.HasValue)
|
||||
{
|
||||
sqlBuilder.Append(" AND sb.FechaRemito <= @FechaHastaParam"); // O FechaEstado
|
||||
parameters.Add("FechaHastaParam", fechaHasta.Value.Date.AddDays(1).AddTicks(-1)); // Hasta el final del día
|
||||
sqlBuilder.Append(" AND sb.FechaRemito <= @FechaHastaParam");
|
||||
parameters.Add("FechaHastaParam", fechaHasta.Value.Date);
|
||||
}
|
||||
|
||||
sqlBuilder.Append(" ORDER BY sb.FechaRemito DESC, sb.NroBobina;");
|
||||
@@ -224,14 +224,12 @@ namespace GestionIntegral.Api.Data.Repositories.Distribucion
|
||||
|
||||
if (actual == null) throw new KeyNotFoundException("Bobina no encontrada para eliminar.");
|
||||
|
||||
// --- INICIO DE CAMBIO EN VALIDACIÓN ---
|
||||
// Permitir eliminar si está Disponible (1) o Dañada (3)
|
||||
if (actual.IdEstadoBobina != 1 && actual.IdEstadoBobina != 3)
|
||||
{
|
||||
_logger.LogWarning("Intento de eliminar bobina {IdBobina} que no está en estado 'Disponible' o 'Dañada'. Estado actual: {EstadoActual}", idBobina, actual.IdEstadoBobina);
|
||||
return false; // Devolver false si no cumple la condición para ser eliminada
|
||||
}
|
||||
// --- FIN DE CAMBIO EN VALIDACIÓN ---
|
||||
|
||||
const string sqlDelete = "DELETE FROM dbo.bob_StockBobinas WHERE Id_Bobina = @IdBobinaParam";
|
||||
const string sqlInsertHistorico = @"
|
||||
|
||||
@@ -5,6 +5,6 @@ namespace GestionIntegral.Api.Dtos.Distribucion
|
||||
public int IdPublicacion { get; set; }
|
||||
public string Nombre { get; set; } = string.Empty;
|
||||
public string NombreEmpresa { get; set; } = string.Empty;
|
||||
public bool Habilitada { get; set; }
|
||||
public bool? Habilitada { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,6 @@ namespace GestionIntegral.Api.Dtos.Distribucion
|
||||
public int IdEmpresa { get; set; }
|
||||
public string NombreEmpresa { get; set; } = string.Empty; // Para mostrar en UI
|
||||
public bool CtrlDevoluciones { get; set; }
|
||||
public bool Habilitada { get; set; } // Simplificamos a bool, el backend manejará el default si es null
|
||||
public bool? Habilitada { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace GestionIntegral.Api.Services.Distribucion
|
||||
Task<IEnumerable<PublicacionDiaSemanaDto>> ObtenerConfiguracionDiasAsync(int idPublicacion);
|
||||
Task<IEnumerable<PublicacionDto>> ObtenerPublicacionesPorDiaSemanaAsync(byte diaSemana); // Devolvemos el DTO completo
|
||||
Task<(bool Exito, string? Error)> ActualizarConfiguracionDiasAsync(int idPublicacion, UpdatePublicacionDiasSemanaRequestDto requestDto, int idUsuario);
|
||||
Task<IEnumerable<PublicacionDropdownDto>> ObtenerParaDropdownAsync(bool soloHabilitadas = true);
|
||||
Task<IEnumerable<PublicacionDropdownDto>> ObtenerParaDropdownAsync(bool soloHabilitadas);
|
||||
Task<IEnumerable<PublicacionHistorialDto>> ObtenerHistorialAsync(
|
||||
DateTime? fechaDesde, DateTime? fechaHasta,
|
||||
int? idUsuarioModifico, string? tipoModificacion,
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace GestionIntegral.Api.Services.Distribucion
|
||||
IdEmpresa = data.Publicacion.IdEmpresa,
|
||||
NombreEmpresa = data.NombreEmpresa ?? "Empresa Desconocida", // Manejar null para NombreEmpresa
|
||||
CtrlDevoluciones = data.Publicacion.CtrlDevoluciones,
|
||||
Habilitada = data.Publicacion.Habilitada ?? true // Asumir true si es null desde BD
|
||||
Habilitada = data.Publicacion.Habilitada
|
||||
};
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ namespace GestionIntegral.Api.Services.Distribucion
|
||||
return MapToDto(data);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<PublicacionDropdownDto>> ObtenerParaDropdownAsync(bool soloHabilitadas = true)
|
||||
public async Task<IEnumerable<PublicacionDropdownDto>> ObtenerParaDropdownAsync(bool soloHabilitadas)
|
||||
{
|
||||
var data = await _publicacionRepository.GetAllAsync(null, null, soloHabilitadas ? (bool?)true : null);
|
||||
var data = await _publicacionRepository.GetAllAsync(null, null, soloHabilitadas);
|
||||
|
||||
return data
|
||||
.Where(p => p.Publicacion != null) // Asegurar que la publicación no sea null
|
||||
@@ -87,7 +87,7 @@ namespace GestionIntegral.Api.Services.Distribucion
|
||||
IdPublicacion = d.Publicacion!.IdPublicacion, // Usar ! si estás seguro que no es null después del Where
|
||||
Nombre = d.Publicacion!.Nombre,
|
||||
NombreEmpresa = d.NombreEmpresa ?? "Empresa Desconocida",
|
||||
Habilitada = d.Publicacion!.Habilitada ?? true // Si necesitas filtrar por esto
|
||||
Habilitada = d.Publicacion!.Habilitada
|
||||
})
|
||||
.OrderBy(p => p.Nombre)
|
||||
.ToList(); // O ToListAsync si el método del repo es async y devuelve IQueryable
|
||||
|
||||
Reference in New Issue
Block a user