แนบไฟลืหนังสือเวียน
This commit is contained in:
parent
d47404a5b4
commit
7fd22e2c10
9 changed files with 83 additions and 11 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
public string? ProfileType { get; set; }
|
public string? ProfileType { get; set; }
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
public string Position { get; set; }
|
public dynamic Position { get; set; }
|
||||||
public string PosNo { get; set; }
|
public string PosNo { get; set; }
|
||||||
public string Rank { get; set; }
|
public string Rank { get; set; }
|
||||||
public string Salary { get; set; }
|
public string Salary { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@
|
||||||
public static readonly string OCNotFound = "ไม่พบหน่วยงานที่ระบุในระบบ";
|
public static readonly string OCNotFound = "ไม่พบหน่วยงานที่ระบุในระบบ";
|
||||||
public static readonly string InsigniaManageOrgLimit = "จำนวนการจัดสรรเครื่องราชฯ หน่วยงานเกินจำนวน";
|
public static readonly string InsigniaManageOrgLimit = "จำนวนการจัดสรรเครื่องราชฯ หน่วยงานเกินจำนวน";
|
||||||
public static readonly string InsigniaBorrowOrgLimit = "จำนวนการจัดสรรเครื่องราชฯ หน่วยงานเกินจำนวนของหน่วยงานที่ได้รับ";
|
public static readonly string InsigniaBorrowOrgLimit = "จำนวนการจัดสรรเครื่องราชฯ หน่วยงานเกินจำนวนของหน่วยงานที่ได้รับ";
|
||||||
|
public static readonly string InsigniaNoBorrow = "ไม่สามารถยืมเครื่องราชฯ นี้ได้เนื่องจากสถานะรอการบันทึกข้อมูล";
|
||||||
public static readonly string InsigniaBorrowNotFound = "ไม่พบรายการยืมเครื่องราชฯ";
|
public static readonly string InsigniaBorrowNotFound = "ไม่พบรายการยืมเครื่องราชฯ";
|
||||||
public static readonly string InsigniaNotReturn = "รายการยืมเครื่องราชนี้ได้ทำการยืมไว้แล้ว";
|
public static readonly string InsigniaNotReturn = "รายการยืมเครื่องราชนี้ได้ทำการยืมไว้แล้ว";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -420,6 +420,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
|
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
|
||||||
if (insigniaNoteProfile == null)
|
if (insigniaNoteProfile == null)
|
||||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
|
||||||
|
if (insigniaNoteProfile.Status != "DONE")
|
||||||
|
return Error(GlobalMessages.InsigniaNoBorrow);
|
||||||
|
|
||||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||||
|
|
@ -433,7 +435,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(GlobalMessages.InsigniaManageOrgNotFound);
|
return Error(GlobalMessages.InsigniaManageOrgNotFound);
|
||||||
|
|
||||||
var insigniaManageProfile = await _context.InsigniaManageProfiles.AsQueryable()
|
var insigniaManageProfile = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.InsigniaNoteProfile == insigniaNoteProfile && x.InsigniaManageOrganiation == insigniaManageOrganiation && x.Status == false);
|
.FirstOrDefaultAsync(x => x.InsigniaNoteProfile == insigniaNoteProfile && x.Status == false);
|
||||||
if (insigniaManageProfile != null)
|
if (insigniaManageProfile != null)
|
||||||
return Error(GlobalMessages.InsigniaNotReturn);
|
return Error(GlobalMessages.InsigniaNotReturn);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
|
||||||
},
|
},
|
||||||
"EPPlus": {
|
"EPPlus": {
|
||||||
"ExcelPackage": {
|
"ExcelPackage": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"realm": "bma-ehr",
|
"realm": "bma-ehr",
|
||||||
"auth-server-url": "https://identity.frappet.com",
|
"auth-server-url": "https://id.frappet.synology.me",
|
||||||
"ssl-required": "external",
|
"ssl-required": "external",
|
||||||
"resource": "bma-ehr",
|
"resource": "bma-ehr",
|
||||||
"public-client": true
|
"public-client": true
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,75 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 36-บันทึกเวียนแจ้งการถึงแก่กรรม
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">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("copy/36/{exportType}/{id}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetDeceasedReportCopyAsync(Guid id, string exportType = "pdf")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var head = await _repository.GetHeadRetirementDeceasedAsync(id);
|
||||||
|
var data = await _repository.GetRetirementDeceasedAsync(id);
|
||||||
|
if (data != null || head != null)
|
||||||
|
{
|
||||||
|
var mergeData = new
|
||||||
|
{
|
||||||
|
Oc = head.GetType().GetProperty("Oc").GetValue(head),
|
||||||
|
Number = head.GetType().GetProperty("Number").GetValue(head),
|
||||||
|
Date = head.GetType().GetProperty("Date").GetValue(head),
|
||||||
|
Subject = head.GetType().GetProperty("Subject").GetValue(head),
|
||||||
|
Send = head.GetType().GetProperty("Send").GetValue(head),
|
||||||
|
FullName = data.GetType().GetProperty("FullName").GetValue(data),
|
||||||
|
Position = data.GetType().GetProperty("Position").GetValue(data),
|
||||||
|
Reason = data.GetType().GetProperty("Reason").GetValue(data),
|
||||||
|
DeceasedDate = data.GetType().GetProperty("Date").GetValue(data),
|
||||||
|
CurrentDate = data.GetType().GetProperty("CurrentDate").GetValue(data),
|
||||||
|
DeceasedNumber = data.GetType().GetProperty("Number").GetValue(data),
|
||||||
|
Location = data.GetType().GetProperty("Location").GetValue(data),
|
||||||
|
};
|
||||||
|
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 rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
|
||||||
|
ReportPackager reportPacker = new ReportPackager();
|
||||||
|
Telerik.Reporting.Report? report = null;
|
||||||
|
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
|
{
|
||||||
|
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||||
|
}
|
||||||
|
report.DataSource = mergeData;
|
||||||
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
{
|
||||||
|
ReportDocument = report,
|
||||||
|
};
|
||||||
|
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||||
|
return File(result.DocumentBytes, mimeType, $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.{exportType.Trim().ToLower()}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// อัปไฟล์บันทึกเวียนแจ้งการถึงแก่กรรม
|
/// อัปไฟล์บันทึกเวียนแจ้งการถึงแก่กรรม
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -551,7 +551,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
payload_attach.Add(new PayloadAttachment
|
payload_attach.Add(new PayloadAttachment
|
||||||
{
|
{
|
||||||
name = "หนังสือเวียนถึงแก่กรรม",
|
name = "หนังสือเวียนถึงแก่กรรม",
|
||||||
url = $"{_configuration["API"]}/order/download/attachment/{retirementDeceased.DocumentForward.Id}"
|
url = $"{_configuration["API"]}/copy/36/pdf/{retirementDeceased.Id}"
|
||||||
});
|
});
|
||||||
|
|
||||||
var payload = new CommandPayload()
|
var payload = new CommandPayload()
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ namespace BMA.EHR.Retirement.Service.Requests
|
||||||
public class RetirementDeceasedAddNotiPerson
|
public class RetirementDeceasedAddNotiPerson
|
||||||
{
|
{
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
public bool IsSendMail { get; set; }
|
public bool IsSendMail { get; set; } = true;
|
||||||
public bool IsSendInbox { get; set; }
|
public bool IsSendInbox { get; set; } = true;
|
||||||
public bool IsSendNotification { get; set; }
|
public bool IsSendNotification { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue