Merge branch 'develop' into dev

* develop:
  update LeaveController to handle additional leave range options for check-in and check-out statuses
  update LeaveController to pass currentDate parameter to GetLastEffectRound method
  update LeaveReportController to pass date parameter to GetLastEffectRound method
  update GetLastEffectRound method to accept effectiveDate parameter and adjust usage in LeaveReportController
  add noti discord
  fix build report
  fix build report to v2 and add noti
  remove build forgejo, move to dev branch
This commit is contained in:
Warunee Tamkoo 2026-01-11 20:39:39 +07:00
commit d831b208de
21 changed files with 300 additions and 740 deletions

View file

@ -812,7 +812,7 @@ namespace BMA.EHR.Leave.Service.Controllers
return Error("ไม่พบรอบการลงเวลาทำงาน Default", StatusCodes.Status404NotFound);
}
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(profile.Id);
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(profile.Id, currentDate);
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
@ -877,7 +877,28 @@ namespace BMA.EHR.Leave.Service.Controllers
else
startTime = duty.StartTimeMorning;
var checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
string checkInStatus = "NORMAL";
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(userId, currentDate.Date);
if (leaveReq != null)
{
var leaveRange = leaveReq.LeaveRange == null ? "" : leaveReq.LeaveRange.ToUpper();
if (leaveRange == "MORNING" || leaveRange == "ALL")
checkInStatus = "NORMAL";
else
{
checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {startTime}") ?
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
"ABSENT" :
"LATE" :
"NORMAL";
}
}
else
{
checkInStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {startTime}") ?
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) >
@ -885,6 +906,8 @@ namespace BMA.EHR.Leave.Service.Controllers
"ABSENT" :
"LATE" :
"NORMAL";
}
// process - รอทำใน queue
var checkin_process = new ProcessUserTimeStamp
@ -959,16 +982,41 @@ namespace BMA.EHR.Leave.Service.Controllers
{
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
}
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
var checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
// "ABSENT" :
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
"ABSENT" :
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
"ABSENT" :
"NORMAL";
string checkOutStatus = "NORMAL";
var leaveReq = await _leaveRequestRepository.GetLeavePeriodAsync(userId, currentDate.Date);
if (leaveReq != null)
{
var leaveRange = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
if (leaveRange == "AFTERNOON" || leaveRange == "ALL")
checkOutStatus = "NORMAL";
else
{
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
// "ABSENT" :
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
"ABSENT" :
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
"ABSENT" :
"NORMAL";
}
}
else
{
// fix issue : SIT ระบบบันทึกเวลาปฏิบัติงาน>>ลงเวลาเข้า-ออกงาน (กรณีลงเวลาออกอีกวัน) #921
checkOutStatus = DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
// "ABSENT" :
checkout.CheckIn.Date < currentDate.Date ? "NORMAL" :
"ABSENT" :
DateTime.Parse(currentDate.ToString("yyyy-MM-dd HH:mm")) <
DateTime.Parse($"{currentDate.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
"ABSENT" :
"NORMAL";
}
if (checkout_process != null)
{

View file

@ -1768,7 +1768,8 @@ namespace BMA.EHR.Leave.Service.Controllers
// return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
//}
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
// ให้ใช้วันที่จาก loop date แทน
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
@ -2098,7 +2099,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id, dd.date);
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);