LV1_018 - รายการลงเวลากรณีพิเศษ (ADMIN)
This commit is contained in:
parent
e76d994098
commit
a8379303f9
8 changed files with 761 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
using BMA.EHR.Application.Messaging;
|
using BMA.EHR.Application.Messaging;
|
||||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
|
|
@ -52,5 +53,25 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " Methods "
|
||||||
|
|
||||||
|
public async Task<List<AdditionalCheckRequest>> GetAdditionalCheckRequests(int year, int month)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<AdditionalCheckRequest>().AsQueryable()
|
||||||
|
.Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,22 @@ namespace BMA.EHR.Application.Repositories
|
||||||
|
|
||||||
#region " Methods "
|
#region " Methods "
|
||||||
|
|
||||||
|
public async Task<Profile?> GetProfileByKeycloakIdAsync(Guid keycloakId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<Profile>().AsQueryable()
|
||||||
|
.Include(p => p.Prefix)
|
||||||
|
.FirstOrDefaultAsync(p => p.KeycloakId == keycloakId);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<bool> UpdateDutyTimeAsync(Guid profileId, Guid roundId, DateTime effectiveDate)
|
public async Task<bool> UpdateDutyTimeAsync(Guid profileId, Guid roundId, DateTime effectiveDate)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
||||||
public string Description { get; set; } = string.Empty;
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Comment("สถานะการอนุมัติ")]
|
[Comment("สถานะการอนุมัติ")]
|
||||||
public bool IsApproved { get; set; } = false;
|
public string Status { get; set; } = "PENDING"; // APPROVE,REJECT
|
||||||
|
|
||||||
[Comment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ")]
|
[Comment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ")]
|
||||||
public string? Comment { get; set; } = string.Empty;
|
public string? Comment { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,544 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
|
{
|
||||||
|
[DbContext(typeof(LeaveDbContext))]
|
||||||
|
[Migration("20231124043728_change status field in AdditionalCheckInRequest Table")]
|
||||||
|
partial class changestatusfieldinAdditionalCheckInRequestTable
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.9")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.AdditionalCheckRequest", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CheckDate")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("*วันที่ลงเวลา");
|
||||||
|
|
||||||
|
b.Property<bool>("CheckInEdit")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("*ขอลงเวลาช่วงเช้า");
|
||||||
|
|
||||||
|
b.Property<bool>("CheckOutEdit")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("*ขอลงเวลาช่วงบ่าย");
|
||||||
|
|
||||||
|
b.Property<string>("Comment")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
|
||||||
|
|
||||||
|
b.Property<Guid>("KeycloakUserId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะการอนุมัติ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("AdditionalCheckRequests");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("Description")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("คำอธิบาย");
|
||||||
|
|
||||||
|
b.Property<string>("EndTimeAfternoon")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เวลาออกงานช่วงบ่าย");
|
||||||
|
|
||||||
|
b.Property<string>("EndTimeMorning")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เวลาออกงานช่วงเช้า");
|
||||||
|
|
||||||
|
b.Property<bool>("IsActive")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDefault")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("StartTimeAfternoon")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เวลาเข้างานช่วงบ่าย");
|
||||||
|
|
||||||
|
b.Property<string>("StartTimeMorning")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เวลาเข้างานช่วงเช้า");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("DutyTimes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CheckIn")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("วัน เวลา เข้างาน");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInImageUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("รูปถ่ายสถานที่ Check-In");
|
||||||
|
|
||||||
|
b.Property<double>("CheckInLat")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดละติจูด Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInLocationName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
|
||||||
|
|
||||||
|
b.Property<double>("CheckInLon")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดลองจิจูด Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInPOI")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInRemark")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInStatus")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะ Check-In");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CheckOut")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("วัน เวลา ออกงาน");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutImageUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("รูปถ่ายสถานที่ Check-Out");
|
||||||
|
|
||||||
|
b.Property<double>("CheckOutLat")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดละติจูด Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutLocationName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
|
||||||
|
|
||||||
|
b.Property<double>("CheckOutLon")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดลองจิจูด Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutPOI")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutRemark")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutStatus")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะ Check-Out");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLocationCheckIn")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLocationCheckOut")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
|
||||||
|
|
||||||
|
b.Property<bool>("IsProcess")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("นำไปประมวลผลแล้วหรือยัง");
|
||||||
|
|
||||||
|
b.Property<Guid>("KeycloakUserId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัส User ของ Keycloak");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ProcessUserTimeStamps");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<Guid>("DutyTimeId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัสรอบการลงเวลา");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("EffectiveDate")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("วันที่มีผล");
|
||||||
|
|
||||||
|
b.Property<bool>("IsProcess")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("ทำการประมวลผลแล้วหรือยัง");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid>("ProfileId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
|
||||||
|
|
||||||
|
b.Property<string>("Remark")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("หมายเหตุ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DutyTimeId");
|
||||||
|
|
||||||
|
b.ToTable("UserDutyTimes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CheckIn")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("วัน เวลา เข้างาน");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInImageUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("รูปถ่ายสถานที่ Check-In");
|
||||||
|
|
||||||
|
b.Property<double>("CheckInLat")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดละติจูด Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInLocationName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
|
||||||
|
|
||||||
|
b.Property<double>("CheckInLon")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดลองจิจูด Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInPOI")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
|
||||||
|
|
||||||
|
b.Property<string>("CheckInRemark")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("CheckOut")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasComment("วัน เวลา ออกงาน");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutImageUrl")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("รูปถ่ายสถานที่ Check-Out");
|
||||||
|
|
||||||
|
b.Property<double>("CheckOutLat")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดละติจูด Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutLocationName")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
|
||||||
|
|
||||||
|
b.Property<double>("CheckOutLon")
|
||||||
|
.HasColumnType("double")
|
||||||
|
.HasComment("พิกัดลองจิจูด Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutPOI")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
|
||||||
|
|
||||||
|
b.Property<string>("CheckOutRemark")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLocationCheckIn")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLocationCheckOut")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
|
||||||
|
|
||||||
|
b.Property<bool>("IsProcess")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("นำไปประมวลผลแล้วหรือยัง");
|
||||||
|
|
||||||
|
b.Property<Guid>("KeycloakUserId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("รหัส User ของ Keycloak");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("UserTimeStamps");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", "DutyTime")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("DutyTimeId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("DutyTime");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class changestatusfieldinAdditionalCheckInRequestTable : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsApproved",
|
||||||
|
table: "AdditionalCheckRequests");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Status",
|
||||||
|
table: "AdditionalCheckRequests",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการอนุมัติ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Status",
|
||||||
|
table: "AdditionalCheckRequests");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsApproved",
|
||||||
|
table: "AdditionalCheckRequests",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false,
|
||||||
|
comment: "สถานะการอนุมัติ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -68,10 +68,6 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
|
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
|
||||||
|
|
||||||
b.Property<bool>("IsApproved")
|
|
||||||
.HasColumnType("tinyint(1)")
|
|
||||||
.HasComment("สถานะการอนุมัติ");
|
|
||||||
|
|
||||||
b.Property<Guid>("KeycloakUserId")
|
b.Property<Guid>("KeycloakUserId")
|
||||||
.HasColumnType("char(36)")
|
.HasColumnType("char(36)")
|
||||||
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
|
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
|
||||||
|
|
@ -95,6 +91,11 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||||
.HasColumnOrder(102)
|
.HasColumnOrder(102)
|
||||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สถานะการอนุมัติ");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("AdditionalCheckRequests");
|
b.ToTable("AdditionalCheckRequests");
|
||||||
|
|
|
||||||
|
|
@ -866,6 +866,97 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LV1_018 - รายการลงเวลากรณีพิเศษ (ADMIN)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// </returns>
|
||||||
|
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("admin/edit")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetAdditionalCheckRequestAsync([Required] int year, [Required] int month, [Required] int page = 1, [Required] int pageSize = 10, string keyword = "")
|
||||||
|
{
|
||||||
|
var rawData = await _additionalCheckRequestRepository.GetAdditionalCheckRequests(year, month);
|
||||||
|
|
||||||
|
var getDefaultRound = await _dutyTimeRepository.GetDefaultAsync();
|
||||||
|
if (getDefaultRound == null)
|
||||||
|
{
|
||||||
|
return Error("ไม่พบรอบลงเวลา Default", (int)StatusCodes.Status404NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new List<GetAdditionalCheckRequestDto>();
|
||||||
|
|
||||||
|
foreach (var data in rawData)
|
||||||
|
{
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(data.KeycloakUserId);
|
||||||
|
if (profile == null)
|
||||||
|
{
|
||||||
|
return Error(GlobalMessages.DataNotFound, (int)StatusCodes.Status404NotFound);
|
||||||
|
}
|
||||||
|
var userRound = await _dutyTimeRepository.GetByIdAsync(profile.DutyTimeId ?? Guid.Empty);
|
||||||
|
var checkInData = await _userTimeStampRepository.GetTimestampByDateAsync(data.KeycloakUserId, data.CheckDate);
|
||||||
|
|
||||||
|
var duty = userRound ?? getDefaultRound;
|
||||||
|
|
||||||
|
// create result object to return
|
||||||
|
var resObj = new GetAdditionalCheckRequestDto
|
||||||
|
{
|
||||||
|
Id = data.Id,
|
||||||
|
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
|
||||||
|
CreatedAt = data.CreatedAt,
|
||||||
|
CheckDate = data.CheckDate,
|
||||||
|
CheckInEdit = data.CheckInEdit,
|
||||||
|
CheckOutEdit = data.CheckOutEdit,
|
||||||
|
|
||||||
|
CheckInTime = checkInData == null ? "00:00" : checkInData.CheckIn.ToString("HH:mm"),
|
||||||
|
CheckOutTime = checkInData == null ? "00:00" : checkInData.CheckOut == null ? "00:00" : checkInData.CheckOut.Value.ToString("HH:mm"),
|
||||||
|
|
||||||
|
CheckInStatus = checkInData == null ? null :
|
||||||
|
DateTime.Parse(checkInData.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
|
||||||
|
DateTime.Parse($"{checkInData.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ?
|
||||||
|
"LATE" :
|
||||||
|
"NORMAL",
|
||||||
|
|
||||||
|
CheckOutStatus = checkInData == null ? null :
|
||||||
|
checkInData.CheckOut == null ? null :
|
||||||
|
DateTime.Parse(checkInData.CheckOut.Value.ToString("yyyy-MM-dd HH:mm")) <
|
||||||
|
DateTime.Parse($"{checkInData.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||||
|
"LATE" :
|
||||||
|
"NORMAL",
|
||||||
|
|
||||||
|
StartTimeMorning = duty.StartTimeMorning,
|
||||||
|
EndTimeMorning = duty.EndTimeMorning,
|
||||||
|
StartTimeAfternoon = duty.StartTimeAfternoon,
|
||||||
|
EndTimeAfternoon = duty.EndTimeAfternoon,
|
||||||
|
|
||||||
|
Reason = data.Comment ?? "",
|
||||||
|
Status = data.Status,
|
||||||
|
Description = data.Description,
|
||||||
|
|
||||||
|
StatusSort = data.Status.Trim().ToLower() == "pending" ? 1 :
|
||||||
|
data.Status.Trim().ToLower() == "approve" ? 2 : 3,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
result.Add(resObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyword != "")
|
||||||
|
{
|
||||||
|
result = result.Where(x => x.FullName.Contains(keyword)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var pageResult = result.Skip((page - 1) * pageSize).Take(pageSize)
|
||||||
|
.OrderBy(x => x.StatusSort)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return Success(new { data = pageResult, total = result.Count });
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
namespace BMA.EHR.Leave.Service.DTOs.AdditionalCheck
|
||||||
|
{
|
||||||
|
public class GetAdditionalCheckRequestDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public string FullName { get; set; }
|
||||||
|
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
|
||||||
|
public DateTime CheckDate { get; set; }
|
||||||
|
|
||||||
|
public bool CheckInEdit { get; set; }
|
||||||
|
|
||||||
|
public bool CheckOutEdit { get; set; }
|
||||||
|
|
||||||
|
public string CheckInTime { get; set; }
|
||||||
|
|
||||||
|
public string CheckOutTime { get; set; }
|
||||||
|
|
||||||
|
public string? CheckInStatus { get; set; }
|
||||||
|
|
||||||
|
public string? CheckOutStatus { get; set; }
|
||||||
|
|
||||||
|
public string StartTimeMorning { get; set; }
|
||||||
|
|
||||||
|
public string EndTimeMorning { get; set; }
|
||||||
|
|
||||||
|
public string StartTimeAfternoon { get; set; }
|
||||||
|
|
||||||
|
public string EndTimeAfternoon { get; set; }
|
||||||
|
|
||||||
|
public string Reason { get; set; }
|
||||||
|
|
||||||
|
public string Status { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public int StatusSort { get; set; } = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue