diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index 7f804153..02a993ac 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -6574,6 +6574,76 @@ namespace BMA.EHR.Command.Service.Controllers
#endregion
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-11
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command11/report")]
+ public async Task> PostReportCommand11([FromBody] ReportPersonRequest reqss)
+ {
+ try
+ {
+ var resultData = new List();
+
+ 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(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(_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;
+ }
+
+ }
+
///
/// ออกคำสั่ง C-PM-11
///
@@ -6608,6 +6678,76 @@ namespace BMA.EHR.Command.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-12
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command12/report")]
+ public async Task> PostReportCommand12([FromBody] ReportPersonRequest reqss)
+ {
+ try
+ {
+ var resultData = new List();
+
+ 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(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(_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;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-12
///
@@ -6642,6 +6782,30 @@ namespace BMA.EHR.Command.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-19
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command19/report")]
+ public async Task> PostReportCommand19([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.RetirementDischarges
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
///
/// ออกคำสั่ง C-PM-19
///
@@ -6676,6 +6840,30 @@ namespace BMA.EHR.Command.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-20
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command20/report")]
+ public async Task> PostReportcommand20([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.RetirementExpulsions
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
///
/// ออกคำสั่ง C-PM-20
///
@@ -6710,6 +6898,68 @@ namespace BMA.EHR.Command.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-21
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command21/report")]
+ public async Task> PostReportcommand21([FromBody] ReportPersonRequest req_)
+ {
+ try
+ {
+ var resultData = new List();
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile-employee/report-temp";
+
+ var response = new PassSalaryResponse();
+ 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(result);
+
+ var seq = 1;
+ foreach (var d in response!.result)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = d.citizenId,
+ Prefix = d.prefix == null ? "" : d.prefix,
+ FirstName = d.firstName == null ? "" : d.firstName,
+ LastName = d.lastName == null ? "" : d.lastName,
+ RefPlacementProfileId = d.id,
+ RefDisciplineId = d.id,
+ Organization = d.organization,
+ PositionName = d.positionName,
+ PositionLevel = d.positionLevel,
+ PositionType = d.positionType,
+ PositionNumber = d.positionNumber,
+ BirthDate = d.birthDate,
+ };
+ seq++;
+
+ resultData.Add(receiver);
+ }
+ }
+
+ return Success(resultData);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-21
///
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs
index 18412174..d8b869d2 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs
@@ -568,6 +568,72 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-15
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report")]
+ public async Task> PostReport([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.PlacementOfficers
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
+ ///
+ /// เอกสารแนบท้าย C-PM-15
+ ///
+ /// Record Id ของคำสั่ง
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report/attachment")]
+ [AllowAnonymous]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostReportAttachment([FromBody] ReportPersonRequest req)
+ {
+ try
+ {
+ var report_data = await _context.PlacementOfficers
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .Select(p => new
+ {
+ //Seq = r.Sequence.ToString().ToThaiNumber(),
+ //CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
+ //FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
+ Seq = "",
+ CitizenId = "",
+ FullName = "",
+ PositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
+ Organization = p.Organization == null ? "" : p.Organization,
+ StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(),
+ EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(),
+ Reason = p.Reason == null ? "" : p.Reason.ToThaiNumber()
+ })
+ .ToListAsync();
+ return Success(report_data);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-15
///
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs
index 03a6e88c..ae052aeb 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs
@@ -880,6 +880,88 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success(position);
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-14
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report")]
+ public async Task> PostReport([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.PlacementReceives
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
+ ///
+ /// เอกสารแนบท้าย C-PM-14
+ ///
+ /// Record Id ของคำสั่ง
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report/attachment")]
+ [AllowAnonymous]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostReportAttachment([FromBody] ReportPersonRequest req)
+ {
+ try
+ {
+ var report_data = await _context.PlacementReceives
+ .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.OrganizationPositionOld ?? "",
+ OldPositionName = p.OrganizationPositionOld ?? "",
+ OldPositionLevel = p.PositionLevelOld ?? "",
+ OldPositionType = p.PositionTypeOld ?? "",
+ OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
+ OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().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,
+ })
+ .ToListAsync();
+ return Success(report_data);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-14
///
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs
index c5bbb70b..69fe576e 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs
@@ -475,6 +475,29 @@ namespace BMA.EHR.Placement.Service.Controllers
// return Success();
// }
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-16
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report")]
+ public async Task> PostReport([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.PlacementRepatriations
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
///
/// ออกคำสั่ง C-PM-16
///
diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs
index 92b571bf..aeb6ff96 100644
--- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs
+++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs
@@ -758,6 +758,77 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-13
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report")]
+ public async Task> PostReport([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.PlacementTransfers
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
+ ///
+ /// เอกสารแนบท้าย C-PM-13
+ ///
+ /// Record Id ของคำสั่ง
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report/attachment")]
+ [AllowAnonymous]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostReportAttachment([FromBody] ReportPersonRequest req)
+ {
+ try
+ {
+ var report_data = await _context.PlacementTransfers
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .Select(p => new
+ {
+ //Seq = r.Sequence.ToString().ToThaiNumber(),
+ //CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
+ //FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
+ Seq = "",
+ CitizenId = "",
+ FullName = "",
+ Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
+ PositionName = p.PositionOld == null ? "" : p.PositionOld,
+ PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
+ PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
+ PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
+ Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
+ ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(),
+ //ReceiveOrganizationName = r.Command!.ReceiveOrganizationName ?? "",
+ ReceiveOrganizationName = "",
+ Reason = p.Reason ?? ""
+ })
+ .ToListAsync();
+ return Success(report_data);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-13
///
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
index fde6ce3e..9fc364de 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs
@@ -625,6 +625,85 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-08
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("appoint/report")]
+ public async Task> 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();
+ }
+
+ ///
+ /// เอกสารแนบท้าย C-PM-08
+ ///
+ /// Record Id ของคำสั่ง
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("appoint/report/attachment")]
+ [AllowAnonymous]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> 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;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-08
///
@@ -696,6 +775,85 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-09
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("out/report")]
+ public async Task> 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();
+ }
+
+ ///
+ /// เอกสารแนบท้าย C-PM-09
+ ///
+ /// Record Id ของคำสั่ง
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("out/report/attachment")]
+ [AllowAnonymous]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> 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;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-09
///
@@ -766,76 +924,5 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
return Success();
}
-
- ///
- /// ออกคำสั่ง C-PM-18
- ///
- ///
- ///
- /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
- /// ไม่ได้ Login เข้าระบบ
- /// เมื่อเกิดข้อผิดพลาดในการทำงาน
- [HttpPost("leave/report/excecute")]
- public async Task> PostReportExecuteLeave([FromBody] ReportExecuteRequest req)
- {
- // create new profile
- foreach (var recv in req.refIds)
- {
- var data = await _context.RetirementOuts
- .FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
-
- if (data == null)
- throw new Exception(GlobalMessages.DataNotFound);
-
- var baseAPI = _configuration["API"];
- var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
-
- 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.Post, apiUrl);
- var _res = await client.PostAsJsonAsync(apiUrl, new
- {
- isLeave = true,
- leaveReason = "ให้ออกจากราชการ",
- dateLeave = recv.commandAffectDate,
- });
- var _result = await _res.Content.ReadAsStringAsync();
- }
-
- var apiUrlSalary = $"{baseAPI}/org/profile/salary";
- 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.Post, apiUrlSalary);
- var _res = await client.PostAsJsonAsync(apiUrlSalary, new
- {
- profileId = data.profileId,
- date = recv.commandAffectDate,
- amount = recv.amount,
- positionSalaryAmount = recv.positionSalaryAmount,
- mouthSalaryAmount = recv.mouthSalaryAmount,
- posNo = data.PositionNumberOld,
- position = data.PositionOld,
- positionLine = "",
- positionPathSide = "",
- positionExecutive = "",
- positionType = data.PositionTypeOld,
- positionLevel = data.PositionLevelOld,
- refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
- templateDoc = recv.templateDoc,
- });
- var _result = await _res.Content.ReadAsStringAsync();
- }
-
- // update placementstatus
- data.Status = "DONE";
-
- await _context.SaveChangesAsync();
- }
- return Success();
- }
}
}
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs
index 51c253c8..0cc77964 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs
@@ -464,5 +464,99 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
+
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-18
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command18/report")]
+ public async Task> PostReportCommand18([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.RetirementResigns
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
+ ///
+ /// ออกคำสั่ง C-PM-18
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("command18/report/excecute")]
+ public async Task> PostReportExecuteLeave([FromBody] ReportExecuteRequest req)
+ {
+ // create new profile
+ foreach (var recv in req.refIds)
+ {
+ var data = await _context.RetirementOuts
+ .FirstOrDefaultAsync(x => x.Id == Guid.Parse(recv.refId));
+
+ if (data == null)
+ throw new Exception(GlobalMessages.DataNotFound);
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/org/profile/leave/{data.profileId}";
+
+ 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.Post, apiUrl);
+ var _res = await client.PostAsJsonAsync(apiUrl, new
+ {
+ isLeave = true,
+ leaveReason = "ให้ออกจากราชการ",
+ dateLeave = recv.commandAffectDate,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ var apiUrlSalary = $"{baseAPI}/org/profile/salary";
+ 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.Post, apiUrlSalary);
+ var _res = await client.PostAsJsonAsync(apiUrlSalary, new
+ {
+ profileId = data.profileId,
+ date = recv.commandAffectDate,
+ amount = recv.amount,
+ positionSalaryAmount = recv.positionSalaryAmount,
+ mouthSalaryAmount = recv.mouthSalaryAmount,
+ posNo = data.PositionNumberOld,
+ position = data.PositionOld,
+ positionLine = "",
+ positionPathSide = "",
+ positionExecutive = "",
+ positionType = data.PositionTypeOld,
+ positionLevel = data.PositionLevelOld,
+ refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
+ templateDoc = recv.templateDoc,
+ });
+ var _result = await _res.Content.ReadAsStringAsync();
+ }
+
+ // update placementstatus
+ data.Status = "DONE";
+
+ await _context.SaveChangesAsync();
+ }
+ return Success();
+ }
}
}
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
index 5c81b0a7..f83fd2c5 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs
@@ -1629,6 +1629,73 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
return Success(retirementQuestionnaireQuestion);
}
+ ///
+ /// ส่งรายชื่อออกคำสั่ง C-PM-17
+ ///
+ ///
+ ///
+ /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report")]
+ public async Task> PostReport([FromBody] ReportPersonRequest req)
+ {
+ var placementProfiles = await _context.RetirementResigns
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .ToListAsync();
+ foreach (var placementProfile in placementProfiles)
+ {
+ // update placementstatus
+ placementProfile.Status = "REPORT";
+ }
+ await _context.SaveChangesAsync();
+ return Success();
+ }
+
+ ///
+ /// เอกสารแนบท้าย C-PM-17
+ ///
+ /// Record Id ของคำสั่ง
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("report/report/attachment")]
+ [AllowAnonymous]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostReportAttachment([FromBody] ReportPersonRequest req)
+ {
+ try
+ {
+ var report_data = await _context.RetirementResigns
+ .Where(x => req.refIds.Contains(x.Id.ToString()))
+ .Select(p => new
+ {
+ //Seq = r.Sequence.ToString().ToThaiNumber(),
+ //CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
+ //FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
+ PositionName = p.PositionOld ?? "",
+ Organization = p.OrganizationPositionOld ?? "",
+ PositionLevel = p.PositionLevelOld ?? "",
+ PositionType = p.PositionTypeOld ?? "",
+ PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
+ ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
+ Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
+ Remark = p.Reason ?? "",
+ RemarkHorizontal = p.RemarkHorizontal,
+ })
+ .ToListAsync();
+ return Success(report_data);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// ออกคำสั่ง C-PM-17
///