Merge branch 'develop' into working
Some checks failed
release-dev / release-dev (push) Failing after 13s

This commit is contained in:
Suphonchai Phoonsawat 2025-01-27 11:07:16 +07:00
commit b2141b0be7
21 changed files with 58373 additions and 56 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
{
@ -6530,30 +6530,35 @@ namespace BMA.EHR.Application.Repositories
var allOfficerProfilesByRoot =
(await _userProfileRepository.GetOfficerProfileByRootIdAsync(ocId, AccessToken));
var allEmployeeProfileByRoot =
(await _userProfileRepository.GetEmployeeProfileByRootIdAsync(ocId, AccessToken));
var period = await _dbContext.Set<InsigniaPeriod>().Include(x => x.InsigniaEmployees).FirstOrDefaultAsync(p => p.Id == periodId);
var allEmployeeProfileByRoot = new List<GetProfileByRootIdDto>();
if (period != null && period.InsigniaEmployees != null)
{
allEmployeeProfileByRoot =
(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

@ -910,17 +910,17 @@ namespace BMA.EHR.Application.Repositories.Reports
? "🗹"
: "☐";
var passResult1 = evaluate_assign.result.evaluate.pass_result == 1
? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็น ควรให้รับราชการต่อไป"
: "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็น ควรให้รับราชการต่อไป";
? no == 1 ? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป"
: no == 1 ? "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้รับราชการต่อไป";
var passResult2 = evaluate_assign.result.evaluate.pass_result == 2
? "🗹 ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกราชการต่อไป"
: "☐ ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกราชการต่อไป";
? no == 1 ? "🗹 ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกจากราชการ" : "🗹 ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกราชการ"
: no == 1 ? "☐ ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกจากราชการ" : "☐ ต่ำกว่ามาตรฐานที่กำหนด เห็นควรให้ออกราชการ";
var passResult3 = evaluate_assign.result.evaluate.pass_result == 3
? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน"
: "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน";
var passResult = evaluate_assign.result.evaluate.pass_result == 1
? "เห็นควรให้รับราชการต่อไป"
? no == 1 ? "เห็นควรให้ทดลองปฏิบัติหน้าที่ราชการต่อไป" : "เห็นควรให้รับราชการต่อไป"
: evaluate_assign.result.evaluate.pass_result == 2
? "เห็นควรให้ออกจากราชการ"
: $"เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน";
@ -947,10 +947,10 @@ namespace BMA.EHR.Application.Repositories.Reports
ExpandMonth = expandMonth,
ChairmanName = string.IsNullOrEmpty(evaluate_assign.result.chairman.name) ? string.Empty : evaluate_assign.result.chairman.name,
ChairmanPosition = string.IsNullOrEmpty(evaluate_assign.result.chairman.Position) ? string.Empty : evaluate_assign.result.chairman.Position,
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.result.evaluate.chairman_dated.ToThaiFullDate().ToString().ToThaiNumber(),
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.result.evaluate?.chairman_dated?.ToThaiFullDate().ToString().ToThaiNumber(),
CommanderName = string.IsNullOrEmpty(evaluate_assign.result.commander.name) ? string.Empty : evaluate_assign.result.commander.name,
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.Position) ? string.Empty : evaluate_assign.result.commander.Position,
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.result.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(),
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.result.evaluate?.director1_dated?.ToThaiFullDate().ToString().ToThaiNumber(),
Name = evaluate_assign.result.experimentee.name,
RoundNo = no.ToString().ToThaiNumber(),
DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-",

View file

@ -129,6 +129,36 @@ namespace BMA.EHR.Application.Repositories
}
}
public async Task<List<GetProfileByRootIdDto>> GetEmployeeProfileByPositionAsync(Guid rootId, dynamic empPosId, string? accessToken)
{
try
{
var apiPath = $"{_configuration["API"]}/org/dotnet/find/employee/position";
var apiKey = _configuration["API_KEY"];
var body = new
{
rootId,
empPosId
};
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
if (apiResult != null)
{
var raw = JsonConvert.DeserializeObject<GetProfileByRootIdResultDto>(apiResult);
if (raw != null)
return raw.Result;
}
return null;
}
catch
{
throw;
}
}
public async Task<GetProfileByKeycloakIdDto?> GetProfileByKeycloakIdAsync(Guid keycloakId, string? accessToken)
{
try

View file

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

View file

@ -100,9 +100,9 @@ namespace BMA.EHR.Application.Responses
public int pass_result { get; set; }
public int expand_month { get; set; }
public string reson { get; set; }
public DateTime chairman_dated { get; set; }
public DateTime director1_dated { get; set; }
public DateTime director2_dated { get; set; }
public DateTime? chairman_dated { get; set; }
public DateTime? director1_dated { get; set; }
public DateTime? director2_dated { get; set; }
public string createdAt { get; set; }
public string updatedAt { get; set; }
}

View file

@ -1745,7 +1745,8 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
FirstName = item.FirstName,
LastName = item.LastName,
//Organization = item.Organization,
Organization = (item.child4 == null ? "" : item.child4 + " ") +
Organization = (item.Position == null ? "" : item.Position + " ") +
(item.child4 == null ? "" : item.child4 + " ") +
(item.child3 == null ? "" : item.child3 + " ") +
(item.child2 == null ? "" : item.child2 + " ") +
(item.child1 == null ? "" : item.child1 + " ") +

View file

@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
using BMA.EHR.Domain.Models.Base;
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

@ -29,6 +29,7 @@ namespace BMA.EHR.Domain.Models.Insignias
[Comment("สถานะการ Freez ข้อมูล")]
public bool IsLock { get; set; } = false;
public virtual List<InsigniaRequest> InsigniaRequests { get; set; }
public virtual List<InsigniaEmployee> InsigniaEmployees { get; set; }
public Guid? RevisionId { get; set; }
}

View file

@ -382,6 +382,18 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("ชื่อระดับตำแหน่ง")]
public string? posLevelNameOld { get; set; }
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
public string? commandId { get; set; }
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
public string? refCommandCode { get; set; }
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
public DateTime? refCommandDate { get; set; }
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
public string? refCommandName { get; set; }
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
public string? refCommandNo { get; set; }
[MaxLength(200), Comment("โทรศัพท์มือถือ")]
public string? templateDoc { get; set; }
[Comment("Id รูปโปรไฟล์")]
public virtual Document? ProfileImg { get; set; }

View file

@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementProfileaddcommand : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "commandId",
table: "PlacementProfiles",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "refCommandCode",
table: "PlacementProfiles",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "refCommandDate",
table: "PlacementProfiles",
type: "datetime(6)",
maxLength: 200,
nullable: true,
comment: "โทรศัพท์มือถือ");
migrationBuilder.AddColumn<string>(
name: "refCommandName",
table: "PlacementProfiles",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "refCommandNo",
table: "PlacementProfiles",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "templateDoc",
table: "PlacementProfiles",
type: "varchar(200)",
maxLength: 200,
nullable: true,
comment: "โทรศัพท์มือถือ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "commandId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "refCommandCode",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "refCommandDate",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "refCommandName",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "refCommandNo",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "templateDoc",
table: "PlacementProfiles");
}
}
}

View file

@ -0,0 +1,57 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableInsigniaPeriodaddInsigniaEmployee : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InsigniaEmployees",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
RefId = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
InsigniaPeriodId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_InsigniaEmployees", x => x.Id);
table.ForeignKey(
name: "FK_InsigniaEmployees_InsigniaPeriods_InsigniaPeriodId",
column: x => x.InsigniaPeriodId,
principalTable: "InsigniaPeriods",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_InsigniaEmployees_InsigniaPeriodId",
table: "InsigniaEmployees",
column: "InsigniaPeriodId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InsigniaEmployees");
}
}
}

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

@ -5648,6 +5648,67 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("TypeLeaves");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaEmployee", 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>("InsigniaPeriodId")
.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>("RefId")
.HasColumnType("longtext")
.HasComment("id ตำแหน่งลูกจ้าง");
b.HasKey("Id");
b.HasIndex("InsigniaPeriodId");
b.ToTable("InsigniaEmployees");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaManage", b =>
{
b.Property<Guid>("Id")
@ -12657,6 +12718,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child4");
b.Property<string>("commandId")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("โทรศัพท์มือถือ");
b.Property<int?>("node")
.HasColumnType("int")
.HasComment("ระดับโครงสร้าง");
@ -12765,6 +12831,26 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("profileId");
b.Property<string>("refCommandCode")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("โทรศัพท์มือถือ");
b.Property<DateTime?>("refCommandDate")
.HasMaxLength(200)
.HasColumnType("datetime(6)")
.HasComment("โทรศัพท์มือถือ");
b.Property<string>("refCommandName")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("โทรศัพท์มือถือ");
b.Property<string>("refCommandNo")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("โทรศัพท์มือถือ");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
@ -12789,6 +12875,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน root");
b.Property<string>("templateDoc")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("โทรศัพท์มือถือ");
b.Property<string>("typeCommand")
.HasColumnType("longtext")
.HasComment("ประเภทคำสั่ง");
@ -17913,6 +18004,17 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("ProfileTraining");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaEmployee", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", "InsigniaPeriod")
.WithMany("InsigniaEmployees")
.HasForeignKey("InsigniaPeriodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("InsigniaPeriod");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaManage", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.Insignia", "Insignia")
@ -19081,6 +19183,8 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaPeriod", b =>
{
b.Navigation("InsigniaEmployees");
b.Navigation("InsigniaRequests");
});

View file

@ -312,6 +312,7 @@ namespace BMA.EHR.Infrastructure.Persistence
public DbSet<InsigniaPeriod> InsigniaPeriods { get; set; }
public DbSet<InsigniaRequest> InsigniaRequests { get; set; }
public DbSet<InsigniaEmployee> InsigniaEmployees { get; set; }
public DbSet<InsigniaRequestProfile> InsigniaRequestProfiles { get; set; }
public DbSet<InsigniaManage> InsigniaManages { get; set; }
public DbSet<InsigniaNoteProfile> InsigniaNoteProfiles { get; set; }

View file

@ -92,6 +92,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var insigniaPeriods = await _context.InsigniaPeriods.AsQueryable()
.Include(x => x.InsigniaEmployees)
.OrderByDescending(x => x.Year)
.ThenByDescending(x => x.StartDate)
.Select(p => new
@ -105,6 +106,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
period_status = p.IsLock == true ? "DONE" : (p.InsigniaRequests.Count() == 0 ? "WAITTING" : "PENDING"),
period_year = p.Year,
period_isActive = p.IsActive,
empPosId = p.InsigniaEmployees.Select(x => x.RefId),
period_doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
period_revision = p.RevisionId,
})
@ -123,6 +125,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
period_status = insigniaPeriod.period_status,
period_year = insigniaPeriod.period_year,
period_isActive = insigniaPeriod.period_isActive,
empPosId = insigniaPeriod.empPosId,
period_doc = insigniaPeriod.period_doc == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(insigniaPeriod.period_doc),
period_revision = insigniaPeriod.period_revision,
};
@ -151,6 +154,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data = await _context.InsigniaPeriods.AsQueryable()
.Include(x => x.InsigniaEmployees)
.Where(x => x.Id == id)
.Select(p => new
{
@ -163,6 +167,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
period_status = p.IsLock == true ? "DONE" : (p.InsigniaRequests.Count() == 0 ? "WAITTING" : "PENDING"),
period_year = p.Year,
period_isActive = p.IsActive,
empPosId = p.InsigniaEmployees.Select(x => x.RefId),
period_doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
})
.FirstOrDefaultAsync();
@ -180,6 +185,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
period_status = data.period_status,
period_year = data.period_year,
period_isActive = data.period_isActive,
empPosId = data.empPosId,
period_doc = data.period_doc == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.period_doc),
};
@ -235,6 +241,22 @@ namespace BMA.EHR.Insignia.Service.Controllers
LastUpdatedAt = DateTime.Now,
RevisionId = revisionId ?? Guid.Empty
};
foreach (var item in req.EmpPosId)
{
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();
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
@ -318,6 +340,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Error(GlobalMessages.InsigniaDupicate);
var uppdated = await _context.InsigniaPeriods.AsQueryable()
.Include(x => x.InsigniaEmployees)
.Include(x => x.ReliefDoc)
.FirstOrDefaultAsync(x => x.Id == id);
@ -333,6 +356,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
_context.InsigniaEmployees.RemoveRange(uppdated.InsigniaEmployees);
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,
});
}
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{

View file

@ -2317,26 +2317,28 @@ namespace BMA.EHR.Insignia.Service.Controllers
var row = 2;
foreach (var item in requestProfiles)
{
workSheet.Cells[row, 1].Value = item.Root;
workSheet.Cells[row, 2].Value = item.CitizenId;
workSheet.Cells[row, 1].Value = item.Root == null ? "-" : item.Root;
workSheet.Cells[row, 2].Value = item.CitizenId == null ? "-" : item.CitizenId;
workSheet.Cells[row, 3].Value = item.Prefix == null ? "-" : ((item.Prefix == "นาย" || item.Prefix == "นาง" || item.Prefix == "นางสาว") ? item.Prefix : "-");
workSheet.Cells[row, 4].Value = item.Prefix == null ? "-" : ((item.Prefix == "นาย" || item.Prefix == "นาง" || item.Prefix == "นางสาว") ? "-" : item.Prefix);
workSheet.Cells[row, 5].Value = item.FirstName;
workSheet.Cells[row, 6].Value = item.LastName;
workSheet.Cells[row, 5].Value = item.FirstName == null ? "-" : item.FirstName;
workSheet.Cells[row, 6].Value = item.LastName == null ? "-" : item.LastName;
workSheet.Cells[row, 7].Value = item.Gender == null ? "-" : item.Gender;
workSheet.Cells[row, 8].Value = item.BirthDate == null ? "" : item.BirthDate.Value.ToThaiDate();
workSheet.Cells[row, 9].Value = item.DateAppoint == null ? "" : item.DateAppoint.Value.ToThaiDate();
workSheet.Cells[row, 12].Value = "";
workSheet.Cells[row, 13].Value = item.PosLevelName == null ? "" : item.PosLevelName;
workSheet.Cells[row, 14].Value = "";
workSheet.Cells[row, 15].Value = null;
workSheet.Cells[row, 16].Value = item.Position ?? "";
workSheet.Cells[row, 8].Value = item.BirthDate == null ? "-" : item.BirthDate.Value.ToThaiDate();
workSheet.Cells[row, 9].Value = item.DateAppoint == null ? "-" : item.DateAppoint.Value.ToThaiDate();
workSheet.Cells[row, 10].Value = "-";
workSheet.Cells[row, 11].Value = "-";
workSheet.Cells[row, 12].Value = "-";
workSheet.Cells[row, 13].Value = item.PosLevelName == null ? "-" : item.PosLevelName;
workSheet.Cells[row, 14].Value = "-";
workSheet.Cells[row, 15].Value = "-";
workSheet.Cells[row, 16].Value = item.Position == null ? "-" : item.Position;
workSheet.Cells[row, 17].Value = item.Amount == null ? 0 : item.Amount;
workSheet.Cells[row, 18].Value = null;
workSheet.Cells[row, 18].Value = "-";
workSheet.Cells[row, 19].Value = item.PositionSalaryAmount == null ? 0 : item.PositionSalaryAmount;
workSheet.Cells[row, 20].Value = item.LastInsigniaName;
workSheet.Cells[row, 21].Value = "";
workSheet.Cells[row, 22].Value = null;
workSheet.Cells[row, 20].Value = item.LastInsigniaName == null ? "-" : item.LastInsigniaName;
workSheet.Cells[row, 21].Value = "-";
workSheet.Cells[row, 22].Value = "-";
row++;
}
excel.Save();

View file

@ -218,6 +218,12 @@ namespace BMA.EHR.Placement.Service.Controllers
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.PositionCandidate,
x.commandId,
x.refCommandCode,
x.refCommandDate,
x.refCommandName,
x.refCommandNo,
x.templateDoc,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result1 = new List<dynamic>();
@ -275,6 +281,12 @@ namespace BMA.EHR.Placement.Service.Controllers
p.posLevelCandidate,
p.posTypeCandidate,
p.positionCandidate,
p.commandId,
p.refCommandCode,
p.refCommandDate,
p.refCommandName,
p.refCommandNo,
p.templateDoc,
};
result1.Add(_data1);
}
@ -330,6 +342,12 @@ namespace BMA.EHR.Placement.Service.Controllers
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.PositionCandidate,
x.commandId,
x.refCommandCode,
x.refCommandDate,
x.refCommandName,
x.refCommandNo,
x.templateDoc,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result = new List<dynamic>();
@ -387,6 +405,12 @@ namespace BMA.EHR.Placement.Service.Controllers
p.posLevelCandidate,
p.posTypeCandidate,
p.positionCandidate,
p.commandId,
p.refCommandCode,
p.refCommandDate,
p.refCommandName,
p.refCommandNo,
p.templateDoc,
};
result.Add(_data);
}
@ -1803,7 +1827,19 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
placementProfile.ForEach(profile => profile.PlacementStatus = "DONE");
placementProfile.ForEach(profile =>
{
profile.PlacementStatus = "DONE";
if (req.refIds.Length > 0)
{
profile.commandId = req.refIds[0].commandId;
profile.refCommandCode = req.refIds[0].refCommandCode;
profile.refCommandDate = req.refIds[0].commandAffectDate;
profile.refCommandName = req.refIds[0].refCommandName;
profile.refCommandNo = $"{req.refIds[0].commandNo}/{req.refIds[0].commandYear.ToThaiYear()}";
profile.templateDoc = req.refIds[0].templateDoc;
}
});
await _context.SaveChangesAsync();
}
}
@ -2110,7 +2146,19 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
placementProfile.ForEach(profile => profile.PlacementStatus = "DONE");
placementProfile.ForEach(profile =>
{
profile.PlacementStatus = "DONE";
if (req.refIds.Length > 0)
{
profile.commandId = req.refIds[0].commandId;
profile.refCommandCode = req.refIds[0].refCommandCode;
profile.refCommandDate = req.refIds[0].commandAffectDate;
profile.refCommandName = req.refIds[0].refCommandName;
profile.refCommandNo = $"{req.refIds[0].commandNo}/{req.refIds[0].commandYear.ToThaiYear()}";
profile.templateDoc = req.refIds[0].templateDoc;
}
});
await _context.SaveChangesAsync();
}
}

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
{
@ -262,6 +263,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
var retirementOut = new RetirementOut
{
profileType = req.profileType.Trim().ToUpper(),
Status = "WAITTING",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",