ออกคำสั่ง
This commit is contained in:
parent
604b234c4b
commit
1290da7211
14 changed files with 1979 additions and 2004 deletions
|
|
@ -703,7 +703,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-08
|
||||
/// ออกคำสั่ง C-PM-08 บรรจุและแต่งตั้งข้าราชการกลับเข้ารับราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -713,62 +713,50 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpPost("appoint/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteAppoint([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
var data = await _context.RetirementOthers
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
date = r.commandAffectDate,
|
||||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
posNo = p.PositionNumberOld,
|
||||
position = p.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = p.PositionTypeOld,
|
||||
positionLevel = p.PositionLevelOld,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
|
||||
templateDoc = r.templateDoc,
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var placementProfile = await _context.RetirementOthers
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (placementProfile == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
||||
using (var client = new HttpClient())
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileId = placementProfile.profileId,
|
||||
date = recv.commandAffectDate,
|
||||
amount = recv.amount,
|
||||
positionSalaryAmount = recv.positionSalaryAmount,
|
||||
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||
posNo = placementProfile.PositionNumberOld,
|
||||
position = placementProfile.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = placementProfile.PositionTypeOld,
|
||||
positionLevel = placementProfile.PositionLevelOld,
|
||||
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||
templateDoc = recv.templateDoc,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
var baseAPILeave = _configuration["API"];
|
||||
var apiUrlLeave = $"{baseAPI}/org/profile/leave/{placementProfile.profileId}";
|
||||
using (var client = new HttpClient())
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlLeave);
|
||||
string? _null = null;
|
||||
var _res = await client.PostAsJsonAsync(apiUrlLeave, new
|
||||
{
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
placementProfile.Status = "DONE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -851,7 +839,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-09
|
||||
/// ออกคำสั่ง C-PM-09 คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -861,62 +849,50 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpPost("out/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteOut([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
var data = await _context.RetirementOthers
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
date = r.commandAffectDate,
|
||||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
posNo = p.PositionNumberOld,
|
||||
position = p.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = p.PositionTypeOld,
|
||||
positionLevel = p.PositionLevelOld,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
|
||||
templateDoc = r.templateDoc,
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var placementProfile = await _context.RetirementOthers
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (placementProfile == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
||||
using (var client = new HttpClient())
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileId = placementProfile.profileId,
|
||||
date = recv.commandAffectDate,
|
||||
amount = recv.amount,
|
||||
positionSalaryAmount = recv.positionSalaryAmount,
|
||||
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||
posNo = placementProfile.PositionNumberOld,
|
||||
position = placementProfile.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = placementProfile.PositionTypeOld,
|
||||
positionLevel = placementProfile.PositionLevelOld,
|
||||
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||
templateDoc = recv.templateDoc,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
var baseAPILeave = _configuration["API"];
|
||||
var apiUrlLeave = $"{baseAPI}/org/profile/leave/{placementProfile.profileId}";
|
||||
using (var client = new HttpClient())
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlLeave);
|
||||
string? _null = null;
|
||||
var _res = await client.PostAsJsonAsync(apiUrlLeave, new
|
||||
{
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
placementProfile.Status = "DONE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-18
|
||||
/// ออกคำสั่ง C-PM-18 คำสั่งให้ออกจากราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -497,62 +497,49 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpPost("command/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteLeave([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
var data = await _context.RetirementOuts
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
date = r.commandAffectDate,
|
||||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
posNo = p.PositionNumberOld,
|
||||
position = p.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = p.PositionTypeOld,
|
||||
positionLevel = p.PositionLevelOld,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
|
||||
templateDoc = r.templateDoc,
|
||||
isLeave = true,
|
||||
leaveReason = "ให้ออกจากราชการ",
|
||||
dateLeave = r.commandAffectDate,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var data = await _context.RetirementOuts
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
|
||||
|
||||
using (var client = new HttpClient())
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||
{
|
||||
isLeave = true,
|
||||
leaveReason = "ให้ออกจากราชการ",
|
||||
dateLeave = recv.commandAffectDate,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
||||
using (var client = new HttpClient())
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileId = data.profileId,
|
||||
date = recv.commandAffectDate,
|
||||
amount = recv.amount,
|
||||
positionSalaryAmount = recv.positionSalaryAmount,
|
||||
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||
posNo = data.PositionNumberOld,
|
||||
position = data.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = data.PositionTypeOld,
|
||||
positionLevel = data.PositionLevelOld,
|
||||
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||
templateDoc = recv.templateDoc,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1695,7 +1695,7 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-17
|
||||
/// ออกคำสั่ง C-PM-17 คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -1705,62 +1705,49 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
[HttpPost("command/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecute([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
var data = await _context.RetirementResigns
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
date = r.commandAffectDate,
|
||||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
posNo = p.PositionNumberOld,
|
||||
position = p.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = p.PositionTypeOld,
|
||||
positionLevel = p.PositionLevelOld,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
|
||||
templateDoc = r.templateDoc,
|
||||
isLeave = true,
|
||||
leaveReason = "ลาออกจากราชการ",
|
||||
dateLeave = r.commandAffectDate,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var data = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
|
||||
|
||||
using (var client = new HttpClient())
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||
{
|
||||
isLeave = true,
|
||||
leaveReason = "ลาออกจากราชการ",
|
||||
dateLeave = recv.commandAffectDate,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
||||
using (var client = new HttpClient())
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileId = data.profileId,
|
||||
date = recv.commandAffectDate,
|
||||
amount = recv.amount,
|
||||
positionSalaryAmount = recv.positionSalaryAmount,
|
||||
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||
posNo = data.PositionNumberOld,
|
||||
position = data.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = data.PositionTypeOld,
|
||||
positionLevel = data.PositionLevelOld,
|
||||
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||
templateDoc = recv.templateDoc,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -1833,7 +1820,7 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-23
|
||||
/// ออกคำสั่ง C-PM-23 คำสั่งให้ลูกจ้างออกจากราชการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -1843,36 +1830,46 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
[HttpPost("employee/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteEmployee([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
var data = await _context.RetirementResigns
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
date = r.commandAffectDate,
|
||||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
posNo = p.PositionNumberOld,
|
||||
position = p.PositionOld,
|
||||
positionType = p.PositionTypeOld,
|
||||
positionLevel = p.PositionLevelOld,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
|
||||
templateDoc = r.templateDoc,
|
||||
isLeave = true,
|
||||
leaveReason = "ลาออกจากราชการ",
|
||||
dateLeave = r.commandAffectDate,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-employee-leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var data = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/org/profile-employee/salary/{data.profileId}";
|
||||
|
||||
using (var client = new HttpClient())
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Put, apiUrl);
|
||||
var _res = await client.PutAsJsonAsync(apiUrl, new
|
||||
{
|
||||
isLeave = true,
|
||||
leaveReason = "ลาออกจากราชการ",
|
||||
dateLeave = recv.commandAffectDate,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
data.ForEach(profile => profile.Status = "DONE");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -1945,7 +1942,7 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-41
|
||||
/// ออกคำสั่ง C-PM-41 คำสั่งยกเลิกการลาออก
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -1955,63 +1952,50 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
|||
[HttpPost("leave-cancel/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteLeaveCancel([FromBody] ReportExecuteRequest req)
|
||||
{
|
||||
// create new profile
|
||||
foreach (var recv in req.refIds)
|
||||
var data = await _context.RetirementResigns
|
||||
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
string? _null = null;
|
||||
var resultData = (from p in data
|
||||
join r in req.refIds
|
||||
on p.Id.ToString() equals r.refId
|
||||
select new
|
||||
{
|
||||
profileId = p.profileId,
|
||||
date = r.commandAffectDate,
|
||||
amount = r.amount,
|
||||
positionSalaryAmount = r.positionSalaryAmount,
|
||||
mouthSalaryAmount = r.mouthSalaryAmount,
|
||||
posNo = p.PositionNumberOld,
|
||||
position = p.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = p.PositionTypeOld,
|
||||
positionLevel = p.PositionLevelOld,
|
||||
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
|
||||
templateDoc = r.templateDoc,
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
}).ToList();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var data = await _context.RetirementResigns
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
|
||||
|
||||
using (var client = new HttpClient())
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
string? _null = null;
|
||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||
{
|
||||
isLeave = false,
|
||||
leaveReason = _null,
|
||||
dateLeave = _null,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
var apiUrlSalary = $"{baseAPI}/org/profile/salary";
|
||||
using (var client = new HttpClient())
|
||||
data = resultData,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlSalary);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileId = data.profileId,
|
||||
date = recv.commandAffectDate,
|
||||
amount = recv.amount,
|
||||
positionSalaryAmount = recv.positionSalaryAmount,
|
||||
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||
posNo = data.PositionNumberOld,
|
||||
position = data.PositionOld,
|
||||
positionLine = "",
|
||||
positionPathSide = "",
|
||||
positionExecutive = "",
|
||||
positionType = data.PositionTypeOld,
|
||||
positionLevel = data.PositionLevelOld,
|
||||
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||
templateDoc = recv.templateDoc,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
data.ForEach(profile => profile.Status = "DONEREJECT");
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONEREJECT";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue