ปรับการขอยกเลิกการลา ให้สถานะเป็น DELETING จนมีการอนุมัติ แล้วเปลี่ยนเป็น DELETE
This commit is contained in:
parent
0367e33768
commit
41bcc2a1ef
2 changed files with 28 additions and 17 deletions
|
|
@ -524,6 +524,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
}
|
||||
|
||||
|
||||
// ปรับสถานะ จาก DELETING มาเป็น DELETE
|
||||
data.LeaveStatus = "DELETE";
|
||||
|
||||
data.LeaveCancelStatus = "APPROVE";
|
||||
data.LeaveDirectorComment = Reason;
|
||||
data.LeaveCancelComment = LeaveReason;
|
||||
|
|
@ -586,6 +589,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
rawData.LeaveStatus = "DELETE";
|
||||
|
||||
rawData.LeaveCancelStatus = "APPROVE";
|
||||
rawData.LeaveDirectorComment = Reason;
|
||||
|
||||
|
|
@ -593,8 +598,26 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
// TODO : Update ไปตาราง beginning
|
||||
if (rawData.ApproveStep == "st4") // ถ้ามีการอนุมัติจากผู้มีอำนาจแล้ว
|
||||
{
|
||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(rawData.LeaveStartDate.Year, rawData.Type.Id, rawData.KeycloakUserId, -1 * rawData.LeaveTotal);
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{rawData.Id}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
|
||||
var request = new HttpRequestMessage(HttpMethod.Patch, apiUrlSalary);
|
||||
|
||||
// ส่ง request
|
||||
var _res = await client.SendAsync(request);
|
||||
if (!_res.IsSuccessStatusCode)
|
||||
throw new Exception("ไม่สามารถอัพเดตการยกเลิกรายการลาไปยังระบบทะเบียนประวัติ");
|
||||
//var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove วันลา
|
||||
|
||||
// Send Noti
|
||||
|
|
@ -608,22 +631,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
_appDbContext.Set<Notification>().Add(noti);
|
||||
await _appDbContext.SaveChangesAsync();
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{rawData.Id}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
|
||||
var request = new HttpRequestMessage(HttpMethod.Patch, apiUrlSalary);
|
||||
|
||||
// ส่ง request
|
||||
var _res = await client.SendAsync(request);
|
||||
if (!_res.IsSuccessStatusCode)
|
||||
throw new Exception("ไม่สามารถอัพเดตการยกเลิกรายการลาไปยังระบบทะเบียนประวัติ");
|
||||
//var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task RejectCancelLeaveRequestAsync(Guid id, string Reason)
|
||||
|
|
|
|||
|
|
@ -1693,7 +1693,10 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
|
||||
// change status to delete
|
||||
data.LeaveStatus = "DELETE";
|
||||
// แก้จาก DELETE เป็น DELETING ไว้ก่อน รอ approve ค่อยเปลี่ยนเป็น DELETE
|
||||
// data.LeaveStatus = "DELETE";
|
||||
|
||||
data.LeaveStatus = "DELETING";
|
||||
data.CancelLeaveWrote = req.LeaveWrote ?? "";
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue