fix defect and add new api

This commit is contained in:
Suphonchai Phoonsawat 2024-01-08 09:31:56 +07:00
parent 576c43749a
commit 019a400028
7 changed files with 1180 additions and 6 deletions

View file

@ -147,6 +147,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
{
var rawData = _dbContext.Set<LeaveRequest>()
.Include(x => x.Type)
.Where(x => x.LeaveStatus != "DRAFT")
.AsQueryable();
@ -307,6 +308,20 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
await _appDbContext.SaveChangesAsync();
}
public async Task SendToOfficerAsync(Guid id)
{
var rawData = await GetByIdAsync(id);
if (rawData == null)
{
throw new Exception(GlobalMessages.DataNotFound);
}
rawData.LeaveStatus = "NEW";
//rawData.ApproveStep = "st2";
await UpdateAsync(rawData);
}
public async Task OfficerApproveLeaveRequest(Guid id)
{
var rawData = await GetByIdAsync(id);

View file

@ -139,5 +139,20 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
[Comment("ช่วงของการลา เช่น ลาทั้งวัน ครึ่งวันเช้า ครึ่งวันบ่าย")]
public string? LeaveRange { get; set; } = string.Empty;
[Comment("เรียนใคร")]
public string? Dear { get; set; } = string.Empty;
[Comment("code ของประเภทการลา")]
public string? LeaveTypeCode { get; set; } = string.Empty;
[Comment("ตำแหน่งผู้ยื่นขอ")]
public string? PositionName { get; set; } = string.Empty;
[Comment("ระดับผู้ยื่นขอ")]
public string? PositionLevelName { get; set; } = string.Empty;
[Comment("สังกัดผู้ยื่นขอ")]
public string? OrganizationName { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,980 @@
// <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("20240108021420_Add Field to LeaveRequest Dear,Posoition")]
partial class AddFieldtoLeaveRequestDearPosoition
{
/// <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.Documents.Document", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime(6)");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<int>("FileSize")
.HasColumnType("int");
b.Property<string>("FileType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<Guid>("ObjectRefId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.ToTable("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Code")
.IsRequired()
.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>("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<int>("Limit")
.HasColumnType("int")
.HasComment("จำนวนวันลาสูงสุดประจำปี");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการลา");
b.HasKey("Id");
b.ToTable("LeaveTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AbsentDayAt")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayGetIn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayLocation")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("AbsentDayRegistorDate")
.HasColumnType("datetime(6)");
b.Property<string>("AbsentDaySummon")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ApproveStep")
.HasColumnType("longtext")
.HasComment("step การอนุมัติ st1 = จทน.อนุมัตื,st2 = ผู้บังคับบัญชา อนุมัติ ");
b.Property<string>("CancelLeaveWrote")
.HasColumnType("longtext")
.HasComment("เขียนที่ (ขอยกเลิก)");
b.Property<string>("CoupleDayCountryHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayEndDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDayLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayLevelCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayPosition")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayStartDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDaySumTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayTotalHistory")
.IsRequired()
.HasColumnType("longtext");
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>("Dear")
.HasColumnType("longtext")
.HasComment("เรียนใคร");
b.Property<bool>("HajjDayStatus")
.HasColumnType("tinyint(1)");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)");
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>("LeaveAddress")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานที่ติดต่อขณะลา");
b.Property<DateTime?>("LeaveBirthDate")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveCancelComment")
.HasColumnType("longtext")
.HasComment("เหตุผลในการขอยกเลิก");
b.Property<Guid?>("LeaveCancelDocumentId")
.HasColumnType("char(36)");
b.Property<string>("LeaveCancelStatus")
.HasColumnType("longtext")
.HasComment("สถานะของคำขอยกเลิก");
b.Property<string>("LeaveComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้บังคับบัญชา");
b.Property<string>("LeaveDetail")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดการลา");
b.Property<string>("LeaveDirectorComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้อำนวยการสำนัก");
b.Property<Guid?>("LeaveDocumentId")
.HasColumnType("char(36)");
b.Property<Guid?>("LeaveDraftDocumentId")
.HasColumnType("char(36)");
b.Property<DateTime>("LeaveEndDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีสิ้นสุดลา");
b.Property<DateTime?>("LeaveGovernmentDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("LeaveLast")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveNumber")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หมายเลขที่ติดต่อขณะลา");
b.Property<string>("LeaveRange")
.HasColumnType("longtext")
.HasComment("ช่วงของการลา เช่น ลาทั้งวัน ครึ่งวันเช้า ครึ่งวันบ่าย");
b.Property<int?>("LeaveSalary")
.HasColumnType("int");
b.Property<string>("LeaveSalaryText")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("LeaveStartDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีเริ่มต้นลา");
b.Property<string>("LeaveStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะของคำร้อง");
b.Property<double>("LeaveTotal")
.HasColumnType("double");
b.Property<string>("LeaveTypeCode")
.HasColumnType("longtext")
.HasComment("code ของประเภทการลา");
b.Property<string>("LeaveWrote")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เขียนที่");
b.Property<string>("OrdainDayBuddhistLentAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayBuddhistLentName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("OrdainDayOrdination")
.HasColumnType("datetime(6)");
b.Property<bool>("OrdainDayStatus")
.HasColumnType("tinyint(1)");
b.Property<string>("OrganizationName")
.HasColumnType("longtext")
.HasComment("สังกัดผู้ยื่นขอ");
b.Property<string>("PositionLevelName")
.HasColumnType("longtext")
.HasComment("ระดับผู้ยื่นขอ");
b.Property<string>("PositionName")
.HasColumnType("longtext")
.HasComment("ตำแหน่งผู้ยื่นขอ");
b.Property<double>("RestDayCurrentTotal")
.HasColumnType("double");
b.Property<double>("RestDayOldTotal")
.HasColumnType("double");
b.Property<string>("StudyDayCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayDegreeLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayScholarship")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDaySubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingSubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayUniversityName")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TypeId")
.HasColumnType("char(36)");
b.Property<string>("WifeDayDateBorn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("WifeDayName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LeaveCancelDocumentId");
b.HasIndex("LeaveDocumentId");
b.HasIndex("LeaveDraftDocumentId");
b.HasIndex("TypeId");
b.ToTable("LeaveRequests");
});
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<string>("EditReason")
.HasColumnType("longtext")
.HasComment("เหตุผลการอนุมัติ/ไม่อนุมัติขอลงเวลาพิเศษ");
b.Property<string>("EditStatus")
.HasColumnType("longtext")
.HasComment("สถานะการของลงเวลาพิเศษ");
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.Requests.LeaveRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveCancelDocument")
.WithMany()
.HasForeignKey("LeaveCancelDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDocument")
.WithMany()
.HasForeignKey("LeaveDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDraftDocument")
.WithMany()
.HasForeignKey("LeaveDraftDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LeaveCancelDocument");
b.Navigation("LeaveDocument");
b.Navigation("LeaveDraftDocument");
b.Navigation("Type");
});
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
}
}
}

View file

@ -0,0 +1,78 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class AddFieldtoLeaveRequestDearPosoition : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Dear",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "เรียนใคร")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "LeaveTypeCode",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "code ของประเภทการลา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OrganizationName",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "สังกัดผู้ยื่นขอ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionLevelName",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "ระดับผู้ยื่นขอ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionName",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "ตำแหน่งผู้ยื่นขอ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Dear",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "LeaveTypeCode",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "OrganizationName",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "PositionLevelName",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "PositionName",
table: "LeaveRequests");
}
}
}

View file

@ -208,6 +208,10 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Dear")
.HasColumnType("longtext")
.HasComment("เรียนใคร");
b.Property<bool>("HajjDayStatus")
.HasColumnType("tinyint(1)");
@ -309,6 +313,10 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
b.Property<double>("LeaveTotal")
.HasColumnType("double");
b.Property<string>("LeaveTypeCode")
.HasColumnType("longtext")
.HasComment("code ของประเภทการลา");
b.Property<string>("LeaveWrote")
.IsRequired()
.HasColumnType("longtext")
@ -340,6 +348,18 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
b.Property<bool>("OrdainDayStatus")
.HasColumnType("tinyint(1)");
b.Property<string>("OrganizationName")
.HasColumnType("longtext")
.HasComment("สังกัดผู้ยื่นขอ");
b.Property<string>("PositionLevelName")
.HasColumnType("longtext")
.HasComment("ระดับผู้ยื่นขอ");
b.Property<string>("PositionName")
.HasColumnType("longtext")
.HasComment("ตำแหน่งผู้ยื่นขอ");
b.Property<double>("RestDayCurrentTotal")
.HasColumnType("double");

View file

@ -151,7 +151,7 @@ namespace BMA.EHR.Leave.Service.Controllers
LeaveSalaryText = req.LeaveSalaryText ?? "",
LeaveStatus = "NEW",
LeaveStatus = "DRAFT",
KeycloakUserId = userId,
ApproveStep = APPROVE_STEP_CREATE
};
@ -273,6 +273,24 @@ namespace BMA.EHR.Leave.Service.Controllers
break;
}
// add dear and oc_data
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty);
var approver = string.Empty;
if (rootOc != null)
{
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
if (list.Count > 0)
approver = list.First().Name;
}
leaveRequest.LeaveTypeCode = leaveType.Code;
leaveRequest.Dear = approver;
leaveRequest.PositionName = profile.Position == null ? "" : profile.Position.Name;
leaveRequest.PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name;
leaveRequest.OrganizationName = profile.Oc ?? "";
// save to database
await _leaveRequestRepository.AddAsync(leaveRequest);
@ -328,11 +346,14 @@ namespace BMA.EHR.Leave.Service.Controllers
{
DateSendLeave = DateTime.Now.Date,
LeaveTypeName = leaveType.Name,
Dear = approver,
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
Dear = approver,
PositionName = profile.Position == null ? "" : profile.Position.Name,
PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
OrganizationName = profile.Oc ?? "",
LeaveLimit = leaveType.Limit,
LeaveTotal = sumLeave,
LeaveRemain = leaveType.Limit - sumLeave,
@ -592,6 +613,12 @@ namespace BMA.EHR.Leave.Service.Controllers
CoupleDayStartDateHistory = rawData.CoupleDayStartDateHistory,
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
Dear = rawData.Dear ?? "",
PositionName = rawData.PositionName ?? "",
PositionLevelName = rawData.PositionLevelName ?? "",
OrganizationName = rawData.OrganizationName ?? "",
LeaveTypeCode = rawData.LeaveTypeCode ?? ""
};
return Success(result);
@ -892,6 +919,26 @@ namespace BMA.EHR.Leave.Service.Controllers
return Success();
}
/// <summary>
/// LV2_021 - ส่งคำขอลา
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("user/send/{id:guid}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> SendLeaveRequestAsync(Guid id,
[FromBody] LeaveRequestApproveDto req)
{
await _leaveRequestRepository.SendToOfficerAsync(id);
return Success();
}
/// <summary>
/// LV2_017 - ผู้มีอำนาจไม่อนุมัติการลา (ADMIN)
/// </summary>
@ -971,9 +1018,7 @@ namespace BMA.EHR.Leave.Service.Controllers
Id = rawData.Id,
ReasonCommander = rawData.LeaveComment ?? "",
ReasonOligarch = rawData.LeaveDirectorComment ?? "",
PositionName = profile.Position == null ? "" : profile.Position.Name,
PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
OrganizationName = profile.Oc ?? "",
LeaveTypeName = rawData.Type.Name,
LeaveTypeId = rawData.Type.Id,
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
@ -1038,7 +1083,18 @@ namespace BMA.EHR.Leave.Service.Controllers
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
Dear = approver,
// Dear = approver,
// PositionName = profile.Position == null ? "" : profile.Position.Name,
// PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
// OrganizationName = profile.Oc ?? "",
// เปลี่ยนมาอ่านจากฐานข้อมูลแทน read_db
Dear = rawData.Dear ?? "",
PositionName = rawData.PositionName ?? "",
PositionLevelName = rawData.PositionLevelName ?? "",
OrganizationName = rawData.OrganizationName ?? "",
ApproveStep = rawData.ApproveStep ?? "-",
LeaveLimit = rawData.Type.Limit,

View file

@ -114,5 +114,15 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
public DateTime CoupleDayEndDateHistory { get; set; } = DateTime.Now;
public string CoupleDaySumTotalHistory { get; set; } = string.Empty;
public string? Dear { get; set; } = string.Empty;
public string? LeaveTypeCode { get; set; } = string.Empty;
public string? PositionName { get; set; } = string.Empty;
public string? PositionLevelName { get; set; } = string.Empty;
public string? OrganizationName { get; set; } = string.Empty;
}
}