From 91c479ef9eff363af9a4cf34a552218dc78db37f Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Tue, 12 May 2026 11:37:32 +0700 Subject: [PATCH] fix addition checkin --- BMA.EHR.Leave/Controllers/LeaveController.cs | 9 +++++++++ 1 file changed, 9 insertions(+) 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) {