diff --git a/BMA.EHR.Leave/Controllers/LeaveController.cs b/BMA.EHR.Leave/Controllers/LeaveController.cs
index 2f033adc..930c4043 100644
--- a/BMA.EHR.Leave/Controllers/LeaveController.cs
+++ b/BMA.EHR.Leave/Controllers/LeaveController.cs
@@ -74,6 +74,8 @@ namespace BMA.EHR.Leave.Service.Controllers
private readonly HttpClient _httpClient;
+ private readonly LeaveProcessJobStatusRepository _leaveProcessJobStatusRepository;
+
#endregion
#region " Constuctor and Destructor "
@@ -97,7 +99,8 @@ namespace BMA.EHR.Leave.Service.Controllers
NotificationRepository notificationRepository,
CheckInJobStatusRepository checkInJobStatusRepository,
HttpClient httpClient,
- ApplicationDBContext appDbContext)
+ ApplicationDBContext appDbContext,
+ LeaveProcessJobStatusRepository leaveProcessJobStatusRepository)
{
_dutyTimeRepository = dutyTimeRepository;
_context = context;
@@ -116,7 +119,7 @@ namespace BMA.EHR.Leave.Service.Controllers
_leaveRequestRepository = leaveRequestRepository;
_notificationRepository = notificationRepository;
_checkInJobStatusRepository = checkInJobStatusRepository;
-
+ _leaveProcessJobStatusRepository = leaveProcessJobStatusRepository;
_objectPool = objectPool;
_permission = permission;
@@ -4156,6 +4159,49 @@ namespace BMA.EHR.Leave.Service.Controllers
#endregion
+ #region " Process - Leave and Absence "
+
+
+ ///
+ /// สร้าง Task สำหรับ Process ข้อมูลวันลาและขาดราชการ (ADMIN)
+ ///
+ ///
+ ///
+ /// เมื่อทำรายการสำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("admin/leave-task/process")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> CreateProcessTaskAsync([FromBody] CreateLeaveProcessJobDto req)
+ {
+ var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
+
+ var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
+ if (profile == null)
+ {
+ return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
+ }
+
+ var task = new LeaveProcessJobStatus
+ {
+ RootDnaId = profile.RootDnaId ?? Guid.Empty,
+ CreatedUserId = profile.Keycloak?.ToString("D") ?? "",
+ CreatedFullName = profile.FirstName + " " + profile.LastName,
+ CreatedAt = DateTime.Now,
+ Status = "PENDING",
+ StartDate = req.StartDate,
+ EndDate = req.EndDate
+ };
+
+ await _leaveProcessJobStatusRepository.AddAsync(task);
+
+ return Success();
+ }
+
+ #endregion
+
#endregion
}
diff --git a/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveProcessJobDto.cs b/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveProcessJobDto.cs
new file mode 100644
index 00000000..ae4aacc4
--- /dev/null
+++ b/BMA.EHR.Leave/DTOs/LeaveRequest/CreateLeaveProcessJobDto.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
+{
+ ///
+ /// ข้อมูลสำหรับสร้าง Job ประมวลผลวันลา โดยมีช่วงวันที่เริ่มต้นและสิ้นสุดของการประมวลผลวันลา
+ ///
+ public class CreateLeaveProcessJobDto
+ {
+ ///
+ /// วันที่เริ่มต้นของการประมวลผลวันลา
+ ///
+ public DateTime StartDate { get; set; }
+
+ ///
+ /// วันที่สิ้นสุดของการประมวลผลวันลา
+ ///
+ public DateTime EndDate { get; set; }
+ }
+}
\ No newline at end of file