ออกคำสั่ง
This commit is contained in:
parent
139969b324
commit
1374757bf2
8 changed files with 560 additions and 3 deletions
|
|
@ -6641,5 +6641,105 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue