Merge branch 'develop'
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m5s
Build & Deploy Discipline Service / build (push) Successful in 1m7s
Build & Deploy Insignia Service / build (push) Successful in 1m8s
Build & Deploy Placement Service / build (push) Successful in 1m9s
Build & Deploy Retirement Service / build (push) Successful in 1m19s

This commit is contained in:
harid 2025-10-24 15:38:17 +07:00
commit 0f45792e74
18 changed files with 112 additions and 81 deletions

View file

@ -57,7 +57,7 @@ jobs:
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
- name: Remote Deployment
uses: appleboy/ssh-action@v0.1.8
uses: appleboy/ssh-action@v1
with:
host: ${{env.DEPLOY_HOST}}
username: frappet

View file

@ -1573,9 +1573,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
Root = organizationName,
SumLeaveDay = grp.Sum(x => x.LeaveTotal),
sickDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
personalDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
personalDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
restDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
ordainDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
absentDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
@ -1585,9 +1585,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
therapyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
sickDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
restDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
ordainDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
absentDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
@ -1597,9 +1597,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
therapyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
sickDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
maternityDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
wifeDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
personalDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
personalDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
maternityDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
wifeDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
restDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
ordainDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
absentDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),

View file

@ -623,7 +623,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -322,6 +322,14 @@ namespace BMA.EHR.Leave.Service.Controllers
oldData.IsDefault = data.IsDefault;
oldData.IsActive = data.IsActive;
if (!data.IsActive)
{
// ลบรายการที่เคยผูกไว้ทั้งหมด
var userDutyTimes = await _context.UserDutyTimes.Where(x => x.DutyTimeId == oldData.Id).ToListAsync();
_context.UserDutyTimes.RemoveRange(userDutyTimes);
await _context.SaveChangesAsync();
}
await _dutyTimeRepository.UpdateAsync(oldData);
return Success(oldData);
@ -1296,7 +1304,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -1592,7 +1600,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -2429,7 +2437,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -918,7 +918,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -1535,7 +1535,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -1861,7 +1861,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -2133,52 +2133,64 @@ namespace BMA.EHR.Leave.Service.Controllers
int colCount = 10;
int totalRows = employees.Count;
// เตรียม List<object[]> สำหรับใช้กับ LoadFromArrays
var data = new List<object[]>(totalRows);
for (int i = 0; i < totalRows; i++)
// ตรวจสอบว่ามีข้อมูลหรือไม่
if (totalRows > 0)
{
var emp = employees[i];
data.Add(new object[]
// เตรียม List<object[]> สำหรับใช้กับ LoadFromArrays
var data = new List<object[]>(totalRows);
for (int i = 0; i < totalRows; i++)
{
emp.no,
emp.fullName,
emp.dutyTimeName,
emp.checkInDate,
emp.checkInLocation,
emp.checkInTime,
emp.checkedOutDate,
emp.checkOutLocation,
emp.checkOutTime,
emp.remark
});
var emp = employees[i];
data.Add(new object[]
{
emp.no,
emp.fullName,
emp.dutyTimeName,
emp.checkInDate,
emp.checkInLocation,
emp.checkInTime,
emp.checkedOutDate,
emp.checkOutLocation,
emp.checkOutTime,
emp.remark
});
}
// เขียนข้อมูลลง Excel ครั้งเดียว
worksheet.Cells[startRow, 1].LoadFromArrays(data);
// กำหนดสไตล์ตัวบาง + ขอบ
using (var range = worksheet.Cells[startRow, 1, startRow + totalRows - 1, colCount])
{
range.Style.Font.Bold = false;
range.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
// Center Align: คอลัมน์ 1 (A), 3 (C), 4 (D), 6 (F), 7 (G), 9 (I)
var centerColumns = new[] { 1, 3, 4, 6, 7, 9 };
foreach (var col in centerColumns)
{
worksheet.Cells[startRow, col, startRow + totalRows - 1, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
}
// Left Align: คอลัมน์ 2 (B), 5 (E), 8 (H), 10 (J)
var leftColumns = new[] { 2, 5, 8, 10 };
foreach (var col in leftColumns)
{
worksheet.Cells[startRow, col, startRow + totalRows - 1, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
}
}
}
// เขียนข้อมูลลง Excel ครั้งเดียว
worksheet.Cells[startRow, 1].LoadFromArrays(data);
// กำหนดสไตล์ตัวบาง + ขอบ
using (var range = worksheet.Cells[startRow, 1, startRow + totalRows - 1, colCount])
else
{
range.Style.Font.Bold = false;
range.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
range.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
// Center Align: คอลัมน์ 1 (A), 3 (C), 4 (D), 6 (F), 7 (G), 9 (I)
var centerColumns = new[] { 1, 3, 4, 6, 7, 9 };
foreach (var col in centerColumns)
{
worksheet.Cells[startRow, col, startRow + totalRows - 1, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
}
// Left Align: คอลัมน์ 2 (B), 5 (E), 8 (H), 10 (J)
var leftColumns = new[] { 2, 5, 8, 10 };
foreach (var col in leftColumns)
{
worksheet.Cells[startRow, col, startRow + totalRows - 1, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
}
// กรณีไม่มีข้อมูล ใส่ข้อความแจ้ง
worksheet.Cells[startRow, 1].Value = "ไม่มีข้อมูล";
worksheet.Cells[startRow, 1, startRow, colCount].Merge = true;
worksheet.Cells[startRow, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
worksheet.Cells[startRow, 1].Style.Font.Bold = true;
}
// ส่วนสรุปท้ายตาราง
@ -2267,7 +2279,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -2376,7 +2388,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -1635,7 +1635,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -1820,7 +1820,7 @@ namespace BMA.EHR.Leave.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -13,6 +13,7 @@ using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Swashbuckle.AspNetCore.Annotations;
using System.Diagnostics;
using System.Net.Http.Headers;
using System.Security.Claims;
@ -99,7 +100,7 @@ namespace BMA.EHR.Placement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -229,7 +230,12 @@ namespace BMA.EHR.Placement.Service.Controllers
else if (role == "NORMAL")
{
placementAppointments = placementAppointments
.Where(x => node == 0 ? x.child1DnaId == null : (node == 1 ? x.child2DnaId == null : (node == 2 ? x.child3DnaId == null : (node == 3 ? x.child4DnaId == null : true)))).ToList();
.Where(
x => node == 0 ? x.child1DnaId == null
: (node == 1 ? x.child1DnaId != null && x.child2DnaId == null
: (node == 2 ? x.child2DnaId != null && x.child3DnaId == null
: (node == 3 ? x.child3DnaId != null && x.child4DnaId == null : true)))
).ToList();
}
return Success(placementAppointments);
}
@ -322,7 +328,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.CreatedAt,
p.Reason,
p.EducationOld,
EducationOld = !string.IsNullOrEmpty(p.EducationOld) ? p.EducationOld : "ปริญญาตรี",
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
@ -510,6 +516,11 @@ namespace BMA.EHR.Placement.Service.Controllers
placementAppointment.child4Old = org.result.child4;
placementAppointment.child4OldId = org.result.child4Id;
placementAppointment.child4ShortNameOld = org.result.child4ShortName;
placementAppointment.rootDnaId = org.result.rootDnaId;
placementAppointment.child1DnaId = org.result.child1DnaId;
placementAppointment.child2DnaId = org.result.child2DnaId;
placementAppointment.child3DnaId = org.result.child3DnaId;
placementAppointment.child4DnaId = org.result.child4DnaId;
placementAppointment.posMasterNoOld = org.result.posMasterNo;
placementAppointment.posTypeOldId = org.result.posTypeId;
placementAppointment.posTypeNameOld = org.result.posTypeName;

View file

@ -98,7 +98,7 @@ namespace BMA.EHR.Placement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -86,7 +86,7 @@ namespace BMA.EHR.Placement.Service.Controllers
{
Id = x.FirstOrDefault().Year,
Name = x.FirstOrDefault().Year + 543,
}).ToList();
}).OrderByDescending(x => x.Id).ToList();
return Success(_data);
}

View file

@ -99,7 +99,7 @@ namespace BMA.EHR.Placement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -100,7 +100,7 @@ namespace BMA.EHR.Placement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -100,7 +100,7 @@ namespace BMA.EHR.Placement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -192,7 +192,7 @@ namespace BMA.EHR.Placement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -104,7 +104,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -100,7 +100,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -115,7 +115,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -257,7 +257,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -366,7 +366,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -2137,7 +2137,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}

View file

@ -196,7 +196,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -305,7 +305,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}
@ -2053,7 +2053,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
? profileAdmin?.RootDnaId
: "";
}
else if (role == "ROOT" && role == "PARENT")
else if (role == "ROOT" || role == "PARENT")
{
nodeId = profileAdmin?.RootDnaId;
}