no message
This commit is contained in:
parent
1374757bf2
commit
9567181117
5 changed files with 528 additions and 6 deletions
|
|
@ -1293,5 +1293,77 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-24
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("employee-move/report/excecute")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportExecuteEmployeeMove([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)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue