คำสั่งวินัย

This commit is contained in:
Kittapath 2023-12-23 13:48:56 +07:00
parent f644654384
commit 1747891818
15 changed files with 6826 additions and 83 deletions

View file

@ -2388,6 +2388,59 @@ namespace BMA.EHR.Report.Service.Controllers
}
#endregion
#region " C-PM-25 "
private async Task<dynamic> GenerateCommandReportType25_Cover(Guid commandId, string exportType)
{
try
{
var raw_data = await _repository.GetByIdAsync(commandId);
if (raw_data == null)
{
throw new Exception(GlobalMessages.CommandNotFound);
}
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
var command = new
{
No = raw_data.CommandNo.ToThaiNumber(),
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
Issuerorganizationname = raw_data.IssuerOrganizationName,
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
PositionList = "",
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
AuthorizedPosition = raw_data.AuthorizedPosition,
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
Title = $"เรื่อง {raw_data.CommandSubject}",
CaseFault = raw_data.CaseFault,
FaultLevel = raw_data.FaultLevel,
RefRaw = raw_data.RefRaw,
Result = raw_data.Result,
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
Positionno = raw_data_profile == null ? "" : raw_data_profile.Positionno,
Organizationname = raw_data_profile == null ? "" : raw_data_profile.Organizationname,
Salary = raw_data_profile == null ? "" : raw_data_profile.Salary,
};
return command;
}
catch
{
throw;
}
}
#endregion
#endregion
#region " C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้ "
@ -4013,6 +4066,463 @@ namespace BMA.EHR.Report.Service.Controllers
#endregion
#region " C-PM-25 คำสั่งพักจากราชการxxxx "
/// <summary>
/// คำสั่ง C-PM-25 คำสั่งพักจากราชการ
/// </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>
[HttpGet("c-pm-25/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType25CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_006",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-26 คำสั่งให้ออกจากราชการไว้ก่อนxxxx "
/// <summary>
/// คำสั่ง C-PM-26 คำสั่งให้ออกจากราชการไว้ก่อน
/// </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>
[HttpGet("c-pm-26/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType26CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_006",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-27 คำสั่งลงโทษ ภาคทัณฑ์ "
/// <summary>
/// คำสั่ง C-PM-27 คำสั่งลงโทษ ภาคทัณฑ์
/// </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>
[HttpGet("c-pm-27/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType27CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_006",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-28 คำสั่งลงโทษ ตัดเงินเดือน "
/// <summary>
/// คำสั่ง C-PM-28 คำสั่งลงโทษ ตัดเงินเดือน
/// </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>
[HttpGet("c-pm-28/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType28CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_004",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-29 คำสั่งลงโทษ ลดขั้นเงินเดือน "
/// <summary>
/// คำสั่ง C-PM-29 คำสั่งลงโทษ ลดขั้นเงินเดือน
/// </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>
[HttpGet("c-pm-29/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType29CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_007",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-30 คำสั่งเพิ่มโทษ "
/// <summary>
/// คำสั่ง C-PM-30 คำสั่งเพิ่มโทษ
/// </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>
[HttpGet("c-pm-30/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType30CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_002",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-31 คำสั่งงดโทษ "
/// <summary>
/// คำสั่ง C-PM-31 คำสั่งงดโทษ
/// </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>
[HttpGet("c-pm-31/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType31CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_001",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-32 คำสั่งยุติเรื่อง "
/// <summary>
/// คำสั่ง C-PM-32 คำสั่งยุติเรื่อง
/// </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>
[HttpGet("c-pm-32/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType32CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var data = new
{
template = "DP6_003",
reportName = "docx-report",
data = contentData
};
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
// using (var client = new HttpClient())
// {
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// // var res = await client.SendAsync(req);
// var res = await client.PostAsJsonAsync(apiUrl, data);
// var result = await res.Content.ReadAsStringAsync();
// return Success(res);
// }
return Success(contentData);
}
catch
{
throw;
}
}
#endregion
#endregion
}
}