Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2025-05-15 06:40:41 +07:00
commit 9af97134f4
6 changed files with 31 additions and 23 deletions

View file

@ -137,7 +137,7 @@ namespace BMA.EHR.Application.Repositories
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
} }
public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime date) public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime? date)
{ {
// Get UserId from token // Get UserId from token
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
@ -220,7 +220,7 @@ namespace BMA.EHR.Application.Repositories
} }
} }
public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime date) public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime? date)
{ {
// Get UserId from token // Get UserId from token
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
@ -307,7 +307,7 @@ namespace BMA.EHR.Application.Repositories
} }
public async Task ApproveRetirementResign(Guid id, string reason, DateTime date) public async Task ApproveRetirementResign(Guid id, string reason, DateTime? date)
{ {
// Get UserId from token // Get UserId from token
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
@ -387,7 +387,7 @@ namespace BMA.EHR.Application.Repositories
} }
public async Task RejectRetirementResign(Guid id, string reason, DateTime date) public async Task RejectRetirementResign(Guid id, string reason, DateTime? date)
{ {
// Get UserId from token // Get UserId from token
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);

View file

@ -289,8 +289,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response> /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}")] [HttpGet("{insigniaPeriodId:length(36)}/{ocId:length(36)}/{role}/{status}/{isDeputy}")]
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkk(Guid insigniaPeriodId, Guid ocId, string role, string status) public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkk(Guid insigniaPeriodId, Guid ocId, string role, string status, bool isDeputy)
{ {
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId); var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId);
if (result != null) if (result != null)
@ -315,7 +315,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
Items = new List<InsigniaRequestItem>() Items = new List<InsigniaRequestItem>()
}; };
GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE"); GetIsOfficerDto RoleInsignia = await _userProfileRepository.GetIsOfficerRootAsync(AccessToken, "SYS_INSIGNIA_MANAGE");
if (RoleInsignia.isOfficer == true && result.RequestStatus != "st6") if (RoleInsignia.isOfficer == true && isDeputy == false && result.RequestStatus != "st6")
return Success(resend); return Success(resend);
if (RoleInsignia.isDirector == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2")) if (RoleInsignia.isDirector == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2"))
return Success(resend); return Success(resend);

View file

@ -355,8 +355,12 @@ namespace BMA.EHR.Leave.Service.Controllers
// if (list.Count > 0) // if (list.Count > 0)
// approver = list.First().Name; // approver = list.First().Name;
//} //}
if (data != null && data.LeaveSubTypeName == "ลาประกอบพิธีฮัจญ์" && isHajj == false)
{
isHajj = true;
}
if (data.HajjDayStatus == true) if (isHajj == true)
{ {
return new return new
{ {

View file

@ -411,7 +411,7 @@ namespace BMA.EHR.Leave.Service.Controllers
// add dear and oc_data // add dear and oc_data
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = profile.Commander ?? ""; // var approver = profile.Commander ?? "";
var userOc = profile.Root ?? ""; var userOc = profile.Root ?? "";
//if (rootOc != null) //if (rootOc != null)
//{ //{
@ -422,8 +422,8 @@ namespace BMA.EHR.Leave.Service.Controllers
leaveRequest.LeaveTypeCode = leaveType.Code; leaveRequest.LeaveTypeCode = leaveType.Code;
leaveRequest.Dear = approver; leaveRequest.Dear = req.Commander ?? "";
leaveRequest.CommanderPosition = profile.CommanderPositionName ?? ""; leaveRequest.CommanderPosition = req.CommanderPositionName ?? "";
// เพิ่มตำแหน่ง // เพิ่มตำแหน่ง
//leaveRequest.CommanderPosition = req.CommanderPosition ?? ""; //leaveRequest.CommanderPosition = req.CommanderPosition ?? "";
@ -934,12 +934,12 @@ namespace BMA.EHR.Leave.Service.Controllers
SalaryText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false), SalaryText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false),
LeaveLast = leaveLast == null ? null : leaveLast, LeaveLast = leaveLast == null ? null : leaveLast,
TelephoneNumber = profile.TelephoneNumber ?? "-", TelephoneNumber = profile.TelephoneNumber ?? "",
CurrentAddress = profile.CurrentAddress ?? "-", CurrentAddress = profile.CurrentAddress ?? "",
CurrentSubDistrict = profile.CurrentSubDistrict ?? "-", CurrentSubDistrict = profile.CurrentSubDistrict ?? "",
CurrentDistrict = profile.CurrentDistrict ?? "-", CurrentDistrict = profile.CurrentDistrict ?? "",
CurrentProvince = profile.CurrentProvince ?? "-", CurrentProvince = profile.CurrentProvince ?? "",
CurrentZipCode = profile.CurrentZipCode ?? "-", CurrentZipCode = profile.CurrentZipCode ?? "",
}; };
return Success(result); return Success(result);
@ -1772,7 +1772,7 @@ namespace BMA.EHR.Leave.Service.Controllers
else if (role == "ROOT") else if (role == "ROOT")
{ {
nodeId = profileAdmin?.RootDnaId; nodeId = profileAdmin?.RootDnaId;
} }
var rawData = var rawData =
await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status, role, nodeId, profileAdmin?.Node); await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status, role, nodeId, profileAdmin?.Node);

View file

@ -102,7 +102,11 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
public DateTime? CoupleDayEndDateHistory { get; set; } public DateTime? CoupleDayEndDateHistory { get; set; }
public string? CoupleDaySumTotalHistory { get; set; } public string? CoupleDaySumTotalHistory { get; set; }
public string? Commander { get; set; }
public string? CommanderPositionName { get; set; }
} }
} }

View file

@ -2663,7 +2663,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
// { // {
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
// } // }
await _repository.CommanderApproveRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); await _repository.CommanderApproveRetirementResign(id, req.Reason ?? "", null);
return Success(); return Success();
} }
@ -2697,7 +2697,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
// { // {
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
// } // }
await _repository.CommanderRejectRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); await _repository.CommanderRejectRetirementResign(id, req.Reason ?? "", req.Date);
return Success(); return Success();
} }
@ -2731,7 +2731,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
// { // {
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
// } // }
await _repository.ApproveRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); await _repository.ApproveRetirementResign(id, req.Reason ?? "", null);
return Success(); return Success();
} }
@ -2765,7 +2765,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
// { // {
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
// } // }
await _repository.RejectRetirementResign(id, req.Reason ?? "", req.Date ?? DateTime.Now); await _repository.RejectRetirementResign(id, req.Reason ?? "", req.Date);
return Success(); return Success();
} }