Merge branch 'develop' into work
This commit is contained in:
commit
4bb0af5404
7 changed files with 12936 additions and 21 deletions
2
.github/workflows/release_command.yaml
vendored
2
.github/workflows/release_command.yaml
vendored
|
|
@ -16,7 +16,7 @@ env:
|
||||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
# act workflow_dispatch -W .github/workflows/release_command.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||||
release-dev:
|
release-dev:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,23 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
#region " Private "
|
#region " Private "
|
||||||
|
|
||||||
private async Task GetReceiverForByCommndTypeAsync(Command command)
|
#region " List Receiver "
|
||||||
|
|
||||||
|
private async Task<List<CommandReceiver>> GetReceiverForByCommndTypeAsync(Command command)
|
||||||
{
|
{
|
||||||
switch (command.CommandType.Category.Trim().ToUpper())
|
var result = new List<CommandReceiver>();
|
||||||
|
|
||||||
|
switch (command.CommandType.CommandCode.Trim().ToUpper())
|
||||||
{
|
{
|
||||||
case "C-PM-01":
|
case "C-PM-01":
|
||||||
await GetReceiver01(command);
|
case "C-PM-02":
|
||||||
|
case "C-PM-03":
|
||||||
|
result = await GetReceiver01(command);
|
||||||
break;
|
break;
|
||||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -53,10 +61,13 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task GetReceiver01(Command command)
|
private async Task<List<CommandReceiver>> GetReceiver01(Command command)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var result = new List<CommandReceiver>();
|
||||||
|
|
||||||
|
|
||||||
// 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
|
// 1. หารายชื่อที่ถูกเลือกไปแล้ว ในประเภทเดียวกัน
|
||||||
var otherCommandReceivers = await _dbContext.Set<CommandReceiver>()
|
var otherCommandReceivers = await _dbContext.Set<CommandReceiver>()
|
||||||
.Include(x => x.Command)
|
.Include(x => x.Command)
|
||||||
|
|
@ -70,7 +81,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
var appointPeople = await _dbContext.Set<PlacementProfile>()
|
var appointPeople = await _dbContext.Set<PlacementProfile>()
|
||||||
.Include(x => x.Prefix)
|
.Include(x => x.Prefix)
|
||||||
.Include(x => x.OrganizationPosition)
|
.Include(x => x.OrganizationPosition)
|
||||||
.ThenInclude(x => x.Organization)
|
.ThenInclude(x => x!.Organization)
|
||||||
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
|
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
|
||||||
.Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
|
.Where(x => !otherCommandReceivers.Contains(x.CitizenId!))
|
||||||
.Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
|
.Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN")
|
||||||
|
|
@ -94,9 +105,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
};
|
};
|
||||||
seq++;
|
seq++;
|
||||||
|
|
||||||
command.Receivers.Add(receiver);
|
result.Add(receiver);
|
||||||
}
|
}
|
||||||
await _dbContext.SaveChangesAsync();
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -106,6 +118,13 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " Execute and Deploy "
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region " Override "
|
#region " Override "
|
||||||
|
|
||||||
public override async Task<Command?> GetByIdAsync(Guid id)
|
public override async Task<Command?> GetByIdAsync(Guid id)
|
||||||
|
|
@ -151,10 +170,80 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
#region " Command Receiver "
|
#region " Command Receiver "
|
||||||
|
|
||||||
|
public async Task SaveSelectedReceiverAsync(Guid id, List<Guid> selected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _dbContext.Set<Command>()
|
||||||
|
.Include(x => x.Receivers)
|
||||||
|
.Include(x => x.CommandType)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
|
if (command == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
|
var appointPeople = await _dbContext.Set<PlacementProfile>()
|
||||||
|
.Include(x => x.Prefix)
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.ThenInclude(x => x!.Organization)
|
||||||
|
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
|
||||||
|
.Where(x => selected.Contains(x.Id))
|
||||||
|
.OrderBy(x => x.ExamNumber)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
_dbContext.Set<CommandReceiver>().RemoveRange(command.Receivers);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
var seq = 1;
|
||||||
|
foreach (var item in appointPeople)
|
||||||
|
{
|
||||||
|
|
||||||
|
var receiver = new CommandReceiver
|
||||||
|
{
|
||||||
|
Sequence = seq,
|
||||||
|
CitizenId = item.CitizenId!,
|
||||||
|
Prefix = item.Prefix!.Name,
|
||||||
|
FirstName = item.Firstname!,
|
||||||
|
LastName = item.Lastname!,
|
||||||
|
RefPlacementProfileId = item.Id
|
||||||
|
};
|
||||||
|
seq++;
|
||||||
|
|
||||||
|
command.Receivers.Add(receiver);
|
||||||
|
}
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<CommandReceiver>> GetReceiverForCommandAsync(Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _dbContext.Set<Command>()
|
||||||
|
.Include(x => x.Receivers)
|
||||||
|
.Include(x => x.CommandType)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
||||||
|
if (command == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
else
|
||||||
|
return await GetReceiverForByCommndTypeAsync(command);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<CommandReceiver>> GetReceiverByCommmandIdAsync(Guid Id)
|
public async Task<List<CommandReceiver>> GetReceiverByCommmandIdAsync(Guid Id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// ปรับใหม่ให้อ่านจาก database ล้วนๆ
|
||||||
var command = await _dbContext.Set<Command>()
|
var command = await _dbContext.Set<Command>()
|
||||||
.Include(x => x.Receivers)
|
.Include(x => x.Receivers)
|
||||||
.Include(x => x.CommandType)
|
.Include(x => x.CommandType)
|
||||||
|
|
@ -170,10 +259,8 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await GetReceiverForByCommndTypeAsync(command);
|
// returrn empty list
|
||||||
|
return new List<CommandReceiver>();
|
||||||
// query for new list
|
|
||||||
return command.Receivers!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -711,14 +798,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
var data = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||||
.Include(x => x.OrganizationAgency)
|
//.Include(x => x.OrganizationAgency)
|
||||||
.Include(x => x.OrganizationGovernmentAgency)
|
//.Include(x => x.OrganizationGovernmentAgency)
|
||||||
.FirstOrDefaultAsync(o => o.Id == ocId);
|
.FirstOrDefaultAsync(o => o.Id == ocId);
|
||||||
|
|
||||||
if (data == null)
|
if (data == null)
|
||||||
throw new Exception(GlobalMessages.OrganizationNotFound);
|
throw new Exception(GlobalMessages.OrganizationNotFound);
|
||||||
|
|
||||||
return data.OrganizationAgency!.Id;
|
return data.OrganizationAgencyId!.Value;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using BMA.EHR.Application.Repositories;
|
using Amazon.S3.Model.Internal.MarshallTransformations;
|
||||||
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Repositories.Commands;
|
using BMA.EHR.Application.Repositories.Commands;
|
||||||
using BMA.EHR.Application.Requests.Commands;
|
using BMA.EHR.Application.Requests.Commands;
|
||||||
using BMA.EHR.Command.Service.Requests;
|
using BMA.EHR.Command.Service.Requests;
|
||||||
|
|
@ -493,7 +494,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PM7-26 : ข้อมูลเลือกรายชื่อออกคำสั่ง
|
/// PM7-26 : ข้อมูลเลือกรายชื่อออกคำสั่ง ** ยังไม่ได้กรองหน่วยงาน ** ** แสดงรายการจากระบบบรรจุ **
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -509,8 +510,57 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO : หาค่า Education มาแสดง
|
// TODO : หาค่า Education มาแสดง
|
||||||
var receivers = (await _repository.GetReceiverByCommmandIdAsync(orderId))
|
var existed = await _repository.GetReceiverByCommmandIdAsync(orderId);
|
||||||
|
|
||||||
|
var receivers = (await _repository.GetReceiverForCommandAsync(orderId))
|
||||||
.OrderBy(x => x.Sequence)
|
.OrderBy(x => x.Sequence)
|
||||||
|
.Select(r => new CommandReceiverResponse
|
||||||
|
{
|
||||||
|
RefRecordId = r.RefPlacementProfileId!.Value,
|
||||||
|
PersonalId = r.Id,
|
||||||
|
Sequence = r.Sequence,
|
||||||
|
IdCard = r.CitizenId,
|
||||||
|
Name = $"{r.Prefix!}{r.FirstName!} {r.LastName!}",
|
||||||
|
SelectStatus = existed.FirstOrDefault(x => x.RefPlacementProfileId!.Value == r.RefPlacementProfileId!.Value) != null,
|
||||||
|
Education = "" // ยังหาไม่เจอว่าอยุ่ field ไหน
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
foreach (var r in receivers)
|
||||||
|
{
|
||||||
|
var salary = await _repository.GetPlacementSalaryAsync(r.RefRecordId);
|
||||||
|
|
||||||
|
r.SalaryAmount = salary.SalaryAmount;
|
||||||
|
r.PositionSalaryAmount = salary.PositionSalaryAmount;
|
||||||
|
r.MonthSalaryAmount = salary.MonthSalaryAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success(receivers);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ข้อมูลเลือกรายชื่อออกคำสั่ง ** ที่ได้เลือกเอาไว้แล้ว **
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("persons-selected/{orderId}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetCommandSelectReceiverAsync(Guid orderId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var receivers = (await _repository.GetReceiverByCommmandIdAsync(orderId))
|
||||||
|
.OrderBy(x => x.Sequence)
|
||||||
.Select(r => new CommandReceiverResponse
|
.Select(r => new CommandReceiverResponse
|
||||||
{
|
{
|
||||||
RefRecordId = r.RefPlacementProfileId!.Value,
|
RefRecordId = r.RefPlacementProfileId!.Value,
|
||||||
|
|
@ -540,7 +590,33 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PM7-27 : ข้อมูลเลือกรายชื่อออกคำสั่ง ** ยังไม่ได้กรองหน่วยงาน **
|
/// บันทึกข้อมูลเลือกรายชื่อออกคำสั่ง ** ที่ได้เลือกเอาไว้แล้ว **
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderId">Record Id ของคำสั่ง</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost("persons/{orderId}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> SaveCommandSelectReceiverAsync(Guid orderId,[FromBody] List<Guid> selected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _repository.SaveSelectedReceiverAsync(orderId, selected);
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PM7-27 : ลบข้อมูลเลือกรายชื่อออกคำสั่ง
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// ** ยังไม่ได้กรองหน่วยงาน **
|
/// ** ยังไม่ได้กรองหน่วยงาน **
|
||||||
|
|
@ -935,8 +1011,8 @@ namespace BMA.EHR.Command.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var record = await _repository.GetCommandReceiverAsync(personalId);
|
var record = await _repository.GetCommandReceiverAsync(personalId);
|
||||||
|
|
||||||
var data = await _repository.GetPlacementSalaryAsync(record!.RefPlacementProfileId!.Value);
|
var data = await _repository.GetPlacementSalaryAsync(record!.RefPlacementProfileId!.Value);
|
||||||
|
|
||||||
return Success(data);
|
return Success(data);
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,16 @@ namespace BMA.EHR.Domain.Models.HR
|
||||||
|
|
||||||
[Comment("ตำแหน่ง (รายละเอียด)")]
|
[Comment("ตำแหน่ง (รายละเอียด)")]
|
||||||
public string? SalaryClass { get; set; }
|
public string? SalaryClass { get; set; }
|
||||||
|
|
||||||
[Comment("เอกสารอ้างอิง")]
|
[Comment("เอกสารอ้างอิง")]
|
||||||
public string? SalaryRef { get; set; }
|
public string? SalaryRef { get; set; }
|
||||||
public virtual List<ProfileSalaryHistory> ProfileSalaryHistorys { get; set; } = new List<ProfileSalaryHistory>();
|
public virtual List<ProfileSalaryHistory> ProfileSalaryHistorys { get; set; } = new List<ProfileSalaryHistory>();
|
||||||
public virtual Profile? Profile { get; set; }
|
public virtual Profile? Profile { get; set; }
|
||||||
|
|
||||||
|
[Comment("เลขที่คำสั่ง")]
|
||||||
|
public string CommandNo { get; set; }
|
||||||
|
|
||||||
|
[Comment("ประเภทคำสั่ง")]
|
||||||
|
public string CommandTypeName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12693
BMA.EHR.Infrastructure/Migrations/20230808033217_Add field to ProfileSalary Table.Designer.cs
generated
Normal file
12693
BMA.EHR.Infrastructure/Migrations/20230808033217_Add field to ProfileSalary Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,42 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddfieldtoProfileSalaryTable : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CommandNo",
|
||||||
|
table: "ProfileSalaries",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "เลขที่คำสั่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "CommandTypeName",
|
||||||
|
table: "ProfileSalaries",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "ประเภทคำสั่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CommandNo",
|
||||||
|
table: "ProfileSalaries");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CommandTypeName",
|
||||||
|
table: "ProfileSalaries");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4403,6 +4403,16 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("double")
|
.HasColumnType("double")
|
||||||
.HasComment("เงินเดือน");
|
.HasComment("เงินเดือน");
|
||||||
|
|
||||||
|
b.Property<string>("CommandNo")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เลขที่คำสั่ง");
|
||||||
|
|
||||||
|
b.Property<string>("CommandTypeName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภทคำสั่ง");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime(6)")
|
.HasColumnType("datetime(6)")
|
||||||
.HasColumnOrder(100)
|
.HasColumnOrder(100)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue