เพิ่มวันที่ยับยั่ง
This commit is contained in:
parent
f2a0b754b3
commit
64eb77674a
13 changed files with 41337 additions and 90 deletions
|
|
@ -184,7 +184,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CommanderApproveRetirementResignEmployee(Guid id, string reason)
|
||||
public async Task CommanderApproveRetirementResignEmployee(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -250,6 +250,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
//await _dbContext.SaveChangesAsync();
|
||||
|
||||
|
|
@ -296,7 +297,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task CommanderRejectRetirementResignEmployee(Guid id, string reason)
|
||||
public async Task CommanderRejectRetirementResignEmployee(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -338,6 +339,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
@ -383,7 +385,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
}
|
||||
|
||||
public async Task ApproveRetirementResignEmployee(Guid id, string reason)
|
||||
public async Task ApproveRetirementResignEmployee(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -424,6 +426,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
@ -459,7 +462,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
}
|
||||
|
||||
public async Task RejectRetirementResignEmployee(Guid id, string reason)
|
||||
public async Task RejectRetirementResignEmployee(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -500,6 +503,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,51 +89,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//เกษียณอายุราชการ
|
||||
//public async Task ExecuteRetirement()
|
||||
//{
|
||||
// var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||
// .Where(x => x.Year == DateTime.Now.Year)
|
||||
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
// if (retirePeriodOfficer == null)
|
||||
// return;
|
||||
|
||||
// var body = new
|
||||
// {
|
||||
// data = retirePeriodOfficer.RetirementRawProfiles
|
||||
// .Select(x => new
|
||||
// {
|
||||
// profileId = x.profileId
|
||||
// })
|
||||
// .ToList()
|
||||
// };
|
||||
|
||||
// //ข้าราชการ
|
||||
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
|
||||
// var jsonBody = JsonConvert.SerializeObject(body);
|
||||
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||
|
||||
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||
// {
|
||||
// Content = content
|
||||
// };
|
||||
// var response = await client.SendAsync(_req);
|
||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||
// if (!response.IsSuccessStatusCode)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public void TestMethod()
|
||||
{
|
||||
return;
|
||||
|
|
@ -182,7 +137,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CommanderApproveRetirementResign(Guid id, string reason)
|
||||
public async Task CommanderApproveRetirementResign(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -199,14 +154,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
}
|
||||
|
||||
// check commander approve
|
||||
//var approvers = await _dbContext.Set<RetirementResignApprover>()
|
||||
// //.AsNoTracking()
|
||||
// .Include(x => x.RetirementResign)
|
||||
// .Where(x => x.RetirementResign.Id == id && x.ApproveType == "COMMANDER")
|
||||
// .OrderBy(x => x.Seq)
|
||||
// .ToListAsync();
|
||||
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
|
|
@ -228,28 +175,9 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
//var data = await _dbContext.Set<RetirementResignApprover>()
|
||||
// .AsNoTracking()
|
||||
// .Include(x => x.RetirementResign)
|
||||
// .Where(x => x.RetirementResign.Id == id && x.KeycloakId == userId && x.ApproveType == "COMMANDER")
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
//if(data != null)
|
||||
//{
|
||||
// data.ApproveStatus = "APPROVE";
|
||||
// data.Comment = reason;
|
||||
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// data.LastUpdateUserId = userId.ToString("D");
|
||||
// data.LastUpdateFullName = FullName ?? "";
|
||||
|
||||
// await _dbContext.SaveChangesAsync();
|
||||
//}
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
|
||||
//await _dbContext.SaveChangesAsync();
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
@ -271,7 +199,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
// rawData.LeaveComment = reason;
|
||||
rawData.ApproveStep = "st3";
|
||||
|
||||
// TODO: Send notification to 1st Approver
|
||||
|
|
@ -293,7 +220,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task CommanderRejectRetirementResign(Guid id, string reason)
|
||||
public async Task CommanderRejectRetirementResign(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -335,6 +262,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
@ -379,7 +307,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
}
|
||||
|
||||
public async Task ApproveRetirementResign(Guid id, string reason)
|
||||
public async Task ApproveRetirementResign(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -420,6 +348,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
@ -458,7 +387,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
}
|
||||
|
||||
public async Task RejectRetirementResign(Guid id, string reason)
|
||||
public async Task RejectRetirementResign(Guid id, string reason, DateTime date)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
|
@ -499,6 +428,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
approver.RejectDate = date;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue