From 64f0e992836b8c2316bd6a063cbb209a8d75754f Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 2 Oct 2024 16:10:16 +0700 Subject: [PATCH] no message --- .../Controllers/OrderController.cs | 86 ++++++++++ .../Controllers/RetirementOtherController.cs | 158 ++++++++++++++++++ 2 files changed, 244 insertions(+) diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index f4a848c2..7b191ff2 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -6574,6 +6574,91 @@ namespace BMA.EHR.Command.Service.Controllers #endregion + /// + /// ส่งรายชื่อออกคำสั่ง C-PM-11 + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("appoint/report")] + public async Task> PostReportAppoint([FromBody] ReportPersonRequest req) + { + //var placementProfiles = await _context.PlacementAppointments + // .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-11 + /// + /// 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.PlacementAppointments + // .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.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); + return null; + } + catch + { + throw; + } + } + /// /// ออกคำสั่ง C-PM-11 /// @@ -6608,6 +6693,7 @@ namespace BMA.EHR.Command.Service.Controllers return Success(); } + //bright 12 /// /// ออกคำสั่ง C-PM-12 /// diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs index 1ba37ef2..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 ///