Fix: Fechas de Estado Bobinas
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 14m8s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 14m8s
- Las fechas de estado de las bobinas no pueden ser anterior a la fecha de remito (ingreso).
This commit is contained in:
@@ -199,12 +199,20 @@ namespace GestionIntegral.Api.Services.Impresion
|
||||
using var transaction = connection.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var bobina = await _stockBobinaRepository.GetByIdAsync(idBobina); // Obtener dentro de la transacción
|
||||
var bobina = await _stockBobinaRepository.GetByIdAsync(idBobina);
|
||||
if (bobina == null)
|
||||
{
|
||||
try { transaction.Rollback(); } catch { }
|
||||
return (false, "Bobina no encontrada.");
|
||||
}
|
||||
|
||||
// Comparamos solo las fechas (sin hora) para evitar problemas de precisión.
|
||||
if (cambiarEstadoDto.FechaCambioEstado.Date < bobina.FechaRemito.Date)
|
||||
{
|
||||
try { transaction.Rollback(); } catch { }
|
||||
return (false, $"Error de integridad: La fecha del nuevo estado ({cambiarEstadoDto.FechaCambioEstado:dd/MM/yyyy}) " +
|
||||
$"no puede ser anterior a la fecha de ingreso por remito ({bobina.FechaRemito:dd/MM/yyyy}).");
|
||||
}
|
||||
|
||||
var nuevoEstado = await _estadoBobinaRepository.GetByIdAsync(cambiarEstadoDto.NuevoEstadoId);
|
||||
if (nuevoEstado == null)
|
||||
|
||||
Reference in New Issue
Block a user