From 08c144066b26bd37168ecae0fead67824c6264f1 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 4 Feb 2025 17:20:40 +0700 Subject: [PATCH] =?UTF-8?q?fix=20SIT=20=E0=B8=A3=E0=B8=B2=E0=B8=A2?= =?UTF-8?q?=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A?= =?UTF-8?q?=E0=B8=9A=E0=B8=A3=E0=B8=A3=E0=B8=88=E0=B8=B8=20=E0=B9=81?= =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=87=E0=B8=95=E0=B8=B1=E0=B9=89=E0=B8=87?= =?UTF-8?q?=20=E0=B8=A2=E0=B9=89=E0=B8=B2=E0=B8=A2=20=E0=B9=82=E0=B8=AD?= =?UTF-8?q?=E0=B8=99>>=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2?= =?UTF-8?q?=E0=B8=99=E0=B8=88=E0=B8=B3=E0=B8=99=E0=B8=A7=E0=B8=99=E0=B8=A5?= =?UTF-8?q?=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=88=E0=B8=B3=20=E0=B8=81=E0=B8=97?= =?UTF-8?q?=E0=B8=A1.=20=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B9=84=E0=B8=94?= =?UTF-8?q?=E0=B9=89=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=20=E0=B9=81=E0=B8=95?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B8=95=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B9=81?= =?UTF-8?q?=E0=B8=A5=E0=B8=B0=E0=B8=A2=E0=B9=89=E0=B8=B2=E0=B8=A2=20(?= =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B8=96=E0=B8=B9=E0=B8=81=E0=B8=9A=E0=B8=B1?= =?UTF-8?q?=E0=B8=99=E0=B8=97=E0=B8=B6=E0=B8=81=E0=B8=A5=E0=B8=87=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99)=20#1085?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlacementAppointmentController.cs | 41 +++++++++++++++++++ .../Controllers/PlacementController.cs | 20 ++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index 02809ccb..57fbd85e 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -1815,5 +1815,46 @@ namespace BMA.EHR.Placement.Service.Controllers } return Success(); } + + /// + /// ออกคำสั่ง C-PM-21 คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ (ใช้สำหรับรายงานจำนวนลูกจ้างประจำ กทม. ที่ได้รับการจ้าง แต่งตั้งและย้าย) + /// + /// + /// + /// ค่าตัวแปรที่ส่งมาไม่ถูกต้อง + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("employee-appoint-21/report/excecute")] + public async Task> PostReportAppointExecute([FromBody] ReportExecutePlacementAppointRequest req) + { + + if (req == null || req.profileEmps.Length == 0) + return Error("ไม่พบรายชื่อรายการแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ", 404); + + foreach (var profile in req.profileEmps) + { + var placementAppointEmployee = new PlacementAppointmentEmployee + { + profileId = profile.profileId, + prefix = profile.prefix, + firstName = profile.firstName, + lastName = profile.lastName, + citizenId = profile.citizenId, + root = profile.root, + rootId = profile.rootId, + rootShortName = profile.rootShortName, + + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + CreatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + }; + await _context.PlacementAppointmentEmployee.AddAsync(placementAppointEmployee); + } + await _context.SaveChangesAsync(); + return Success(); + } } } diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index c1d26bd2..6fe0ae1d 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -3221,7 +3221,15 @@ namespace BMA.EHR.Placement.Service.Controllers }) .ToList(); - var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pae_count = _context.PlacementAppointmentEmployee + .Where(x => + x.CreatedAt.Date >= startDate && + x.CreatedAt.Date <= endDate && + x.rootId.Contains(item.rootId)) + .Count(); + + //var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pa_appoint = pae_count; var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0; @@ -3254,7 +3262,15 @@ namespace BMA.EHR.Placement.Service.Controllers }) .ToList(); - var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pae_count = _context.PlacementAppointmentEmployee + .Where(x => + x.CreatedAt.Date >= startDate && + x.CreatedAt.Date <= endDate && + x.rootId.Contains(item.rootId)) + .Count(); + + //var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pa_appoint = pae_count; var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;