แก้ env
This commit is contained in:
parent
41d28c4d7f
commit
b37ca083ba
13 changed files with 633 additions and 65 deletions
|
|
@ -602,6 +602,78 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-39 "
|
||||
|
||||
private async Task</*byte[]*/dynamic> GenerateCommandReportType39_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var positionList = await _repository.GetReceiverPositionByCommandIdAsync(commandId);
|
||||
|
||||
var command = new
|
||||
{
|
||||
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
PositionList = 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,
|
||||
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
||||
};
|
||||
return command;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task</*byte[]*/dynamic> GenerateCommandReportType39_Attachment(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
var command = new
|
||||
{
|
||||
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||
CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-",
|
||||
};
|
||||
var data = await _commandReportRepository.GetCommandType03AttachmentAsync(commandId);
|
||||
return new
|
||||
{
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear,
|
||||
IssuerOrganizationName = command.IssuerOrganizationName,
|
||||
CommandExcecuteDate = command.CommandExcecuteDate,
|
||||
data = data,
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-05 "
|
||||
|
||||
private async Task</*byte[]*/dynamic> GenerateCommandReportType05_Cover(Guid commandId, string exportType)
|
||||
|
|
@ -2370,7 +2442,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
||||
employee = receiver,
|
||||
};
|
||||
|
||||
|
||||
return command;
|
||||
//return new
|
||||
//{
|
||||
|
|
@ -3291,6 +3363,102 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-39 คำสั่งเลื่อน : สำหรับข้าราชการ กทม. เดิม "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-39 คำสั่งเลื่อน : สำหรับข้าราชการ กทม. เดิม
|
||||
/// </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-39/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType39CoverReportAsync(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;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType39_Cover(id, exportType);
|
||||
//return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
template = "C-PM-39",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// เอกสารแนบท้าย C-PM-39 คำสั่งเลื่อน : สำหรับข้าราชการ กทม. เดิม
|
||||
/// </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-39/attachment/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType39AttachmentReportAsync(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
var contentData = await GenerateCommandReportType39_Attachment(id, exportType);
|
||||
//return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
template = "C-PM-39-attachment",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-05 คำสั่งแต่งตั้ง "
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue