ให้ออกลูกจ้าง
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
kittapath 2025-01-27 10:14:54 +07:00
parent 8a3baab88f
commit 87e8c17309
9 changed files with 19456 additions and 68 deletions

View file

@ -243,6 +243,7 @@ namespace BMA.EHR.Application.Repositories
{
try
{
Console.WriteLine(ocId);
var period = await _dbContext.Set<InsigniaPeriod>().FirstOrDefaultAsync(p => p.Id == periodId);
if (period == null)
@ -293,7 +294,6 @@ namespace BMA.EHR.Application.Repositories
Root = p.Root,
});
// check วันที่บรรจะต้องน้อยกว่า 29/5/ปี-8 ขอ บม.
var s1 = ((from p in inst_profile
where p.ProfileDateAppoint <= new DateTime(period.Year - 8, 5, 29)
@ -340,7 +340,7 @@ namespace BMA.EHR.Application.Repositories
{
Condition =
$"2.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับปฏิบัติการ (8,340) แต่ไม่ถึงขั้นต่ำของอัตราเงินเดือนข้าราชการพลเรือนระดับชำนาญการ (15,050)",
Result = $"อัตราค่าจ้าง {p.SalaryCondition.Value.ToString("#,##0")}"
Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}"
},
}
})).ToList();
@ -445,7 +445,7 @@ namespace BMA.EHR.Application.Repositories
{
Condition =
$"1.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับปฏิบัติการ (8,340) แต่ไม่ถึงขั้นต่ำของอัตราเงินเดือนข้าราชการพลเรือนระดับชำนาญการ (15,050)",
Result = $"อัตราค่าจ้าง {p.SalaryCondition.Value.ToString("#,##0")}"
Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}"
},
new MatchingCondition
{
@ -548,7 +548,7 @@ namespace BMA.EHR.Application.Repositories
{
Condition =
$"1.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับปฏิบัติการ (8,340) แต่ไม่ถึงขั้นต่ำของอัตราเงินเดือนข้าราชการพลเรือนระดับชำนาญการ (15,050)",
Result = $"อัตราค่าจ้าง {p.SalaryCondition.Value.ToString("#,##0")}"
Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}"
},
new MatchingCondition
{
@ -734,7 +734,7 @@ namespace BMA.EHR.Application.Repositories
{
Condition =
$"2.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับชำนาญการขึ้นไป (15,050)",
Result = $"อัตราค่าจ้าง {p.SalaryCondition.Value.ToString("#,##0")}"
Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}"
},
}
})).ToList();
@ -841,7 +841,7 @@ namespace BMA.EHR.Application.Repositories
{
Condition =
$"1.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับชำนาญการขึ้นไป (15,050)",
Result = $"อัตราค่าจ้าง {p.SalaryCondition.Value.ToString("#,##0")}"
Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}"
},
new MatchingCondition
{
@ -945,7 +945,7 @@ namespace BMA.EHR.Application.Repositories
{
Condition =
$"1.ได้รับอัตราค่าจ้างตั้งแต่อัตราเงินเดือนขั้นต่ำของข้าราขการพลเรือนระดับชำนาญการขึ้นไป (15,050)",
Result = $"อัตราค่าจ้าง {p.SalaryCondition.Value.ToString("#,##0")}"
Result = $"อัตราค่าจ้าง {p?.SalaryCondition?.ToString("#,##0")??""}"
},
new MatchingCondition
{
@ -6535,30 +6535,30 @@ namespace BMA.EHR.Application.Repositories
if (period != null && period.InsigniaEmployees != null)
{
allEmployeeProfileByRoot =
(await _userProfileRepository.GetEmployeeProfileByPositionAsync(period.InsigniaEmployees.Select(x => x.RefId), AccessToken));
(await _userProfileRepository.GetEmployeeProfileByPositionAsync(ocId, period.InsigniaEmployees.Select(x => x.RefId), AccessToken));
}
var type_coin = await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot);
var type1_level1 = await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot);
var type1_level2 = await GetInsigniaCandidate_Type1_Level2(periodId, ocId, allOfficerProfilesByRoot);
var type1_level3 = await GetInsigniaCandidate_Type1_Level3(periodId, ocId, allOfficerProfilesByRoot);
var type1_level4 = await GetInsigniaCandidate_Type1_Level4(periodId, ocId, allOfficerProfilesByRoot);
var type2_level5 = await GetInsigniaCandidate_Type2_Level5(periodId, ocId, allOfficerProfilesByRoot);
var type2_level6 = await GetInsigniaCandidate_Type2_Level6(periodId, ocId, allOfficerProfilesByRoot);
var type2_level7 = await GetInsigniaCandidate_Type2_Level7(periodId, ocId, allOfficerProfilesByRoot);
var type2_level8 = await GetInsigniaCandidate_Type2_Level8(periodId, ocId, allOfficerProfilesByRoot);
var type_coin = allOfficerProfilesByRoot.Count() > 0 ? await GetCoinCandidate(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type1_level1 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type1_Level1(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type1_level2 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type1_Level2(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type1_level3 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type1_Level3(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type1_level4 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type1_Level4(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type2_level5 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type2_Level5(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type2_level6 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type2_Level6(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type2_level7 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type2_Level7(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type2_level8 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type2_Level8(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type2_level9_1 =
await GetInsigniaCandidate_Type2_Level9_1(periodId, ocId, allOfficerProfilesByRoot);
allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type2_Level9_1(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type2_level9_2 =
await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot);
var type3_level10 = await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot);
var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot);
var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot);
var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot);
allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type2_Level9_2(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type3_level10 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type3_Level10(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type3_level11 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type3_Level11(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type4_level10 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type4_Level10(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var type4_level11 = allOfficerProfilesByRoot.Count() > 0 ? await GetInsigniaCandidate_Type4_Level11(periodId, ocId, allOfficerProfilesByRoot) : new List<InsigniaResultSet>();
var employee_type1 = await GetEmployeeInsignia_Type1(periodId, ocId, allEmployeeProfileByRoot);
var employee_type2 = await GetEmployeeInsignia_Type2(periodId, ocId, allEmployeeProfileByRoot);
var employee_type1 = allEmployeeProfileByRoot.Count() > 0 ? await GetEmployeeInsignia_Type1(periodId, ocId, allEmployeeProfileByRoot) : new List<InsigniaResultSet>();
var employee_type2 = allEmployeeProfileByRoot.Count() > 0 ? await GetEmployeeInsignia_Type2(periodId, ocId, allEmployeeProfileByRoot) : new List<InsigniaResultSet>();
// union result
foreach (var r in type_coin)

View file

@ -129,7 +129,7 @@ namespace BMA.EHR.Application.Repositories
}
}
public async Task<List<GetProfileByRootIdDto>> GetEmployeeProfileByPositionAsync(dynamic empPosId, string? accessToken)
public async Task<List<GetProfileByRootIdDto>> GetEmployeeProfileByPositionAsync(Guid rootId, dynamic empPosId, string? accessToken)
{
try
{
@ -138,6 +138,7 @@ namespace BMA.EHR.Application.Repositories
var body = new
{
rootId,
empPosId
};

View file

@ -16,7 +16,7 @@ namespace BMA.EHR.Application.Requests
public int Amount { get; set; }
public int Round { get; set; }
public List<string>? EmpPosId { get; set; }
public string[] EmpPosId { get; set; }
public FormFile? File { get; set; }
}
}

View file

@ -1,15 +1,13 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
using System.ComponentModel.DataAnnotations.Schema;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Documents;
namespace BMA.EHR.Domain.Models.Insignias
{
public class InsigniaEmployee : EntityBase
{
[Comment("Fk Table InsigniaPeriod")]
public InsigniaPeriod InsigniaPeriod { get; set; }
[Comment("id ตำแหน่งลูกจ้าง")]
public string? RefId { get; set; }
}
}

View file

@ -0,0 +1,88 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableInsigniaPeriodaddInsigniaEmployee1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InsigniaEmployees_InsigniaPeriods_InsigniaPeriodId",
table: "InsigniaEmployees");
migrationBuilder.AlterColumn<string>(
name: "RefId",
table: "InsigniaEmployees",
type: "longtext",
nullable: true,
comment: "id ตำแหน่งลูกจ้าง",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "InsigniaPeriodId",
table: "InsigniaEmployees",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaEmployees_InsigniaPeriods_InsigniaPeriodId",
table: "InsigniaEmployees",
column: "InsigniaPeriodId",
principalTable: "InsigniaPeriods",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InsigniaEmployees_InsigniaPeriods_InsigniaPeriodId",
table: "InsigniaEmployees");
migrationBuilder.AlterColumn<string>(
name: "RefId",
table: "InsigniaEmployees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "id ตำแหน่งลูกจ้าง")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "InsigniaPeriodId",
table: "InsigniaEmployees",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaEmployees_InsigniaPeriods_InsigniaPeriodId",
table: "InsigniaEmployees",
column: "InsigniaPeriodId",
principalTable: "InsigniaPeriods",
principalColumn: "Id");
}
}
}

View file

@ -5676,7 +5676,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid?>("InsigniaPeriodId")
b.Property<Guid>("InsigniaPeriodId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
@ -5699,7 +5699,8 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("RefId")
.HasColumnType("longtext");
.HasColumnType("longtext")
.HasComment("id ตำแหน่งลูกจ้าง");
b.HasKey("Id");
@ -18005,9 +18006,13 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaEmployee", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", null)
b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", "InsigniaPeriod")
.WithMany("InsigniaEmployees")
.HasForeignKey("InsigniaPeriodId");
.HasForeignKey("InsigniaPeriodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("InsigniaPeriod");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaManage", b =>

View file

@ -241,22 +241,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
LastUpdatedAt = DateTime.Now,
RevisionId = revisionId ?? Guid.Empty
};
if (req.EmpPosId != null && req.EmpPosId.Count() != 0)
foreach (var item in req.EmpPosId)
{
foreach (var item in req.EmpPosId)
{
period.InsigniaEmployees.Add(
new InsigniaEmployee
{
RefId = item,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
var insigniaEmployee =
new InsigniaEmployee
{
InsigniaPeriod = period,
RefId = item,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.InsigniaEmployees.AddAsync(insigniaEmployee);
}
await _context.InsigniaPeriods.AddAsync(period);
await _context.SaveChangesAsync();
@ -358,22 +357,19 @@ namespace BMA.EHR.Insignia.Service.Controllers
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
_context.InsigniaEmployees.RemoveRange(uppdated.InsigniaEmployees);
if (req.EmpPosId != null && req.EmpPosId.Count() != 0)
foreach (var item in req.EmpPosId)
{
foreach (var item in req.EmpPosId)
{
uppdated.InsigniaEmployees.Add(
new InsigniaEmployee
{
RefId = item,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
uppdated.InsigniaEmployees.Add(
new InsigniaEmployee
{
RefId = item,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
if (Request.Form.Files != null && Request.Form.Files.Count != 0)

View file

@ -68,8 +68,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
[HttpGet("{type}")]
public async Task<ActionResult<ResponseObject>> GetListByAdmin(string type)
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISMISS");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -103,6 +103,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var retirementOuts = await _context.RetirementOuts.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => x.profileType.Trim().ToUpper().Contains(type.Trim().ToUpper()))
// .Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
.Select(p => new
{