Merge branch 'develop' of https://github.com/Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
f908a3b065
8 changed files with 560 additions and 3 deletions
|
|
@ -6641,5 +6641,105 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-19
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command19/report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand19Execute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrl = $"{baseAPI}/org/profile/command19/{recv.refId}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
profileId = recv.refId,
|
||||||
|
date = recv.commandAffectDate,
|
||||||
|
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||||
|
salaryRef = recv.templateDoc,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-20
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command20/report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand20Execute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrl = $"{baseAPI}/org/profile/command20/{recv.refId}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
profileId = recv.refId,
|
||||||
|
date = recv.commandAffectDate,
|
||||||
|
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||||
|
salaryRef = recv.templateDoc,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-21
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("command21/report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportCommand21Execute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
var data = req.refIds.Select(x => new
|
||||||
|
{
|
||||||
|
id = x.refId,
|
||||||
|
amount = x.amount,
|
||||||
|
positionSalaryAmount = x.positionSalaryAmount,
|
||||||
|
mouthSalaryAmount = x.mouthSalaryAmount,
|
||||||
|
refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
|
||||||
|
templateDoc = x.templateDoc,
|
||||||
|
});
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrl = $"{baseAPI}/org/profile-employee/report/resume";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||||
|
var result = await res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1221,5 +1221,77 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-22
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("employee-appoint/report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportExecuteEmployeeAppoint([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var data = await _context.PlacementAppointments
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||||
|
if (data == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var baseAPI = _configuration["API"];
|
||||||
|
var apiUrlSalary = $"{baseAPI}/org/profile-employee/salary";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
profileEmployeeId = data.profileId,
|
||||||
|
date = recv.commandAffectDate,
|
||||||
|
amount = recv.amount,
|
||||||
|
positionSalaryAmount = recv.positionSalaryAmount,
|
||||||
|
mouthSalaryAmount = recv.mouthSalaryAmount,
|
||||||
|
posNo = data.posMasterNo == null ? "" :
|
||||||
|
data.node == 4 ? $"{data.child4ShortName}{data.posMasterNo}" :
|
||||||
|
data.node == 3 ? $"{data.child3ShortName}{data.posMasterNo}" :
|
||||||
|
data.node == 2 ? $"{data.child2ShortName}{data.posMasterNo}" :
|
||||||
|
data.node == 1 ? $"{data.child1ShortName}{data.posMasterNo}" :
|
||||||
|
data.node == 0 ? $"{data.rootShortName}{data.posMasterNo}" : "",
|
||||||
|
position = data.position,
|
||||||
|
positionType = data.posTypeName,
|
||||||
|
positionLevel = data.posLevelName,
|
||||||
|
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||||
|
templateDoc = recv.templateDoc,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var baseAPIOrg = _configuration["API"];
|
||||||
|
var apiUrlOrg = $"{baseAPIOrg}/org/employee/pos/report/current";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
|
{
|
||||||
|
posmasterId = data.posmasterId,
|
||||||
|
positionId = data.positionId,
|
||||||
|
profileId = data.profileId,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -566,5 +567,60 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-15
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportExecute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var data = await _context.PlacementOfficers
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||||
|
|
||||||
|
if (data == 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 _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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -878,5 +879,82 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
return Success(position);
|
return Success(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-14
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportExecute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
// query placement Profile
|
||||||
|
var placementProfile = await _context.PlacementReceives
|
||||||
|
.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 _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.posMasterNo == null ? "" :
|
||||||
|
placementProfile.node == 4 ? $"{placementProfile.child4ShortName}{placementProfile.posMasterNo}" :
|
||||||
|
placementProfile.node == 3 ? $"{placementProfile.child3ShortName}{placementProfile.posMasterNo}" :
|
||||||
|
placementProfile.node == 2 ? $"{placementProfile.child2ShortName}{placementProfile.posMasterNo}" :
|
||||||
|
placementProfile.node == 1 ? $"{placementProfile.child1ShortName}{placementProfile.posMasterNo}" :
|
||||||
|
placementProfile.node == 0 ? $"{placementProfile.rootShortName}{placementProfile.posMasterNo}" : "",
|
||||||
|
position = placementProfile.position,
|
||||||
|
positionLine = "",
|
||||||
|
positionPathSide = "",
|
||||||
|
positionExecutive = "",
|
||||||
|
positionType = placementProfile.posTypeName,
|
||||||
|
positionLevel = placementProfile.posLevelName,
|
||||||
|
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
|
||||||
|
templateDoc = recv.templateDoc,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
var baseAPIOrg = _configuration["API"];
|
||||||
|
var apiUrlOrg = $"{baseAPIOrg}/org/pos/report/current";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlOrg);
|
||||||
|
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||||
|
{
|
||||||
|
posmasterId = placementProfile.posmasterId,
|
||||||
|
positionId = placementProfile.positionId,
|
||||||
|
profileId = placementProfile.profileId,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
placementProfile.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -473,5 +474,60 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
||||||
// return Success();
|
// return Success();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-16
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportExecute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var data = await _context.PlacementRepatriations
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||||
|
|
||||||
|
if (data == 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 _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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Placement;
|
using BMA.EHR.Domain.Models.Placement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -12,10 +13,7 @@ using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
||||||
using System.Drawing.Printing;
|
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -759,5 +757,60 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-13
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("report/excecute")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> PostReportExecute([FromBody] ReportExecuteRequest req)
|
||||||
|
{
|
||||||
|
// create new profile
|
||||||
|
foreach (var recv in req.refIds)
|
||||||
|
{
|
||||||
|
var data = await _context.PlacementTransfers
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
|
||||||
|
|
||||||
|
if (data == 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 _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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -766,5 +766,76 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-18
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("leave/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
|
||||||
|
.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 _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())
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1628,5 +1628,76 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
|
||||||
|
|
||||||
return Success(retirementQuestionnaireQuestion);
|
return Success(retirementQuestionnaireQuestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ออกคำสั่ง C-PM-17
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("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
|
||||||
|
.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 _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())
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update placementstatus
|
||||||
|
data.Status = "DONE";
|
||||||
|
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue