diff --git a/BMA.EHR.Leave/Controllers/LeaveController.cs b/BMA.EHR.Leave/Controllers/LeaveController.cs index ee894ed4..7e6befad 100644 --- a/BMA.EHR.Leave/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveController.cs @@ -3136,8 +3136,17 @@ namespace BMA.EHR.Leave.Service.Controllers { return Error("ไม่สามารถขอลงเวลากรณีพิเศษในวันที่มากกว่าวันที่ปัจจุบันได้", StatusCodes.Status400BadRequest); } + + var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty; + + var checkin = await _userTimeStampRepository.GetTimestampByDateAsync(userId, req.CheckDate.Date); + if (checkin != null && checkin.CheckOut == null) + { + return Error("ระบบพบรายการลงเวลาของวันที่ต้องการแก้ไข แต่ยังไม่มีข้อมูลการลงเวลาออก กรุณาลงเวลาออกให้เรียบร้อยก่อนดำเนินการ"); + } + var profile = await _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken); if (profile == null) {