no message

This commit is contained in:
Bright 2024-10-02 16:10:16 +07:00
parent 139969b324
commit 64f0e99283
2 changed files with 244 additions and 0 deletions

View file

@ -625,6 +625,85 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-08
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <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.RetirementOthers
.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-08
/// </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)
{
try
{
var report_data = await _context.RetirementOthers
.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.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToListAsync();
return Success(report_data);
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-08
/// </summary>
@ -696,6 +775,85 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-09
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("out/report")]
public async Task<ActionResult<ResponseObject>> PostReportOut([FromBody] ReportPersonRequest req)
{
var placementProfiles = await _context.RetirementOthers
.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-09
/// </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("out/report/attachment")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportOutAttachment([FromBody] ReportPersonRequest req)
{
try
{
var report_data = await _context.RetirementOthers
.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.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToListAsync();
return Success(report_data);
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-09
/// </summary>