update 11 12
This commit is contained in:
parent
065d3e91bf
commit
3419a314e1
1 changed files with 121 additions and 67 deletions
|
|
@ -6582,81 +6582,66 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("appoint/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportAppoint([FromBody] ReportPersonRequest req)
|
||||
{
|
||||
//var placementProfiles = await _context.PlacementAppointments
|
||||
// .Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
// .ToListAsync();
|
||||
//foreach (var placementProfile in placementProfiles)
|
||||
//{
|
||||
// // update placementstatus
|
||||
// placementProfile.Status = "REPORT";
|
||||
//}
|
||||
//await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// เอกสารแนบท้าย C-PM-11
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("appoint/report/attachment")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportPersonRequest req)
|
||||
[HttpPost("command11/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportCommand11([FromBody] ReportPersonRequest reqss)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var report_data = await _context.PlacementAppointments
|
||||
// .Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
// .Select(p => new
|
||||
// {
|
||||
// Education = p.EducationOld == null ? "-" : p.EducationOld,
|
||||
// //Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||
// //CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
|
||||
// //FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
// Seq = "",
|
||||
// CitizenId = "",
|
||||
// FullName = "",
|
||||
// OldOc = p.rootOld == null ? "" : p.rootOld,
|
||||
// OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||
// OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||
// OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||
// OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||
// OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
// OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
// NewOc = p.root == null ? "" : p.root,
|
||||
// NewPositionName = p.position == null ? "" : p.position,
|
||||
// NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
|
||||
// NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
|
||||
// NewPositionNumber = p.posMasterNo == null ? "" :
|
||||
// p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
// p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
// p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
// p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
|
||||
// p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
|
||||
// //NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
// NewSalary = "",
|
||||
// AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||
// Reason = p.Reason == null ? "-" : p.Reason
|
||||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
// })
|
||||
// .ToListAsync();
|
||||
//return Success(report_data);
|
||||
return null;
|
||||
var baseAPI = _configuration["Node:API"];
|
||||
var apiUrl = $"{baseAPI}/report/pass";
|
||||
|
||||
var response = new PassProbationResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassProbationResponse>(result);
|
||||
|
||||
var seq = 1;
|
||||
foreach (var d in response!.data)
|
||||
{
|
||||
var _baseAPI = _configuration["API"];
|
||||
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||
using (var _client = new HttpClient())
|
||||
{
|
||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
|
||||
var _res = await _client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
if (org == null || org.result == null)
|
||||
continue;
|
||||
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||
};
|
||||
seq++;
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -6693,7 +6678,76 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
//bright 12
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-12
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("command12/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportCommand12([FromBody] ReportPersonRequest reqss)
|
||||
{
|
||||
try
|
||||
{
|
||||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
var baseAPI = _configuration["Node:API"];
|
||||
var apiUrl = $"{baseAPI}/report/not-pass";
|
||||
|
||||
var response = new PassProbationResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassProbationResponse>(result);
|
||||
|
||||
var seq = 1;
|
||||
foreach (var d in response!.data)
|
||||
{
|
||||
var _baseAPI = _configuration["API"];
|
||||
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||
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.Get, _apiUrl);
|
||||
var _res = await _client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
if (org == null || org.result == null)
|
||||
continue;
|
||||
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||
};
|
||||
seq++;
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-12
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue