issue #2551
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m58s

This commit is contained in:
Suphonchai Phoonsawat 2026-06-19 10:51:18 +07:00
parent 71966eb4e9
commit 2cdae3578e
7 changed files with 1996 additions and 40 deletions

View file

@ -18,6 +18,7 @@ using System.Text;
using Hangfire;
using Hangfire.MySql;
using System.Transactions;
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
using BMA.EHR.Leave.Service.Filters;
using Hangfire.Common;
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
@ -194,10 +195,28 @@ app.UseHangfireDashboard("/hangfire", new DashboardOptions()
var manager = new RecurringJobManager();
if (manager != null)
{
manager.AddOrUpdate("ปรับปรุงรอบการลงเวลาทำงาน", Job.FromExpression<UserDutyTimeRepository>(x => x.UpdateUserDutyTime()), "0 1 * * *", bangkokTimeZone);
manager.AddOrUpdate("ปรับปรุงรอบการลงเวลาทำงาน", Job.FromExpression<UserDutyTimeRepository>(x => x.UpdateUserDutyTime()), "0 1 * * *",
new RecurringJobOptions
{
TimeZone = bangkokTimeZone,
QueueName = "leave"
});
// ทำความสะอาดข้อมูล CheckIn Job Status ที่เก่ากว่า 30 วัน - รันทุกวันเวลา 02:00 น.
manager.AddOrUpdate("ทำความสะอาดข้อมูล CheckIn Job Status", Job.FromExpression<CheckInJobStatusRepository>(x => x.CleanupOldJobsAsync(30)), "0 2 * * *", bangkokTimeZone);
manager.AddOrUpdate("ทำความสะอาดข้อมูล CheckIn Job Status", Job.FromExpression<CheckInJobStatusRepository>(x => x.CleanupOldJobsAsync(30)), "0 2 * * *",
new RecurringJobOptions
{
TimeZone = bangkokTimeZone,
QueueName = "leave"
});
manager.AddOrUpdate("Proceess Beginning สำหรับการลาล่วงหน้า", Job.FromExpression<LeaveBeginningRepository>(x => x.ProcessEarlyLeaveRequestSchedule()), "0 1 1 10 *",
new RecurringJobOptions
{
TimeZone = bangkokTimeZone,
QueueName = "leave"
});
// ตรวจสอบและ mark งาน CheckIn ที่ค้างเกิน 30 นาทีเป็น FAILED - รันทุก 15 นาที
// manager.AddOrUpdate("ตรวจสอบงาน CheckIn ที่ค้างเกินเวลา", Job.FromExpression<CheckInJobStatusRepository>(x => x.MarkStaleJobsAsFailedAsync(30)), "*/15 * * * *",
// new RecurringJobOptions