เพิ่มรับคืนเครื่องราช
This commit is contained in:
parent
59f782e8cf
commit
1619a502d4
22 changed files with 33518 additions and 41 deletions
4
.github/workflows/release_orgEmployee.yaml
vendored
4
.github/workflows/release_orgEmployee.yaml
vendored
|
|
@ -10,9 +10,9 @@ on:
|
|||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-ore-employee-service
|
||||
IMAGE_NAME: ehr/bma-ehr-org-employee-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-ore-employee
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-org-employee
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
|
|
|
|||
|
|
@ -18,10 +18,14 @@ namespace BMA.EHR.Application.Repositories
|
|||
{
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
public InsigniaPeriodsRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
private readonly MinIOService _documentService;
|
||||
public InsigniaPeriodsRepository(IApplicationDBContext dbContext,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_documentService = documentService;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<InsigniaPeriod>> FindByNameAsync(string name)
|
||||
|
|
@ -5706,6 +5710,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
else
|
||||
{
|
||||
var request = await _dbContext.Set<InsigniaRequest>()
|
||||
.Include(x => x.Document)
|
||||
.Include(x => x.Organization)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
.Where(x => x.Organization != null)
|
||||
|
|
@ -5721,7 +5726,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
RequestId = request == null ? null : request.Id,
|
||||
RequestNote = request == null ? "" : request.RequestNote,
|
||||
RequestStatus = request == null ? null : request.RequestStatus,
|
||||
OrganizationName = request == null ? "" : request.Organization.OrganizationOrganization.Name
|
||||
OrganizationName = request == null ? "" : request.Organization.OrganizationOrganization.Name,
|
||||
Document = request == null ? null : (request.Document == null ? null : await _documentService.ImagesPath(request.Document.Id)),
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -5850,7 +5856,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
IsApprove = h.IsApprove,
|
||||
RequestDate = h.RequestDate,
|
||||
Status = h.Status,
|
||||
RequestNote = h.Reason,
|
||||
RequestNote = h.ReasonReject,
|
||||
Reason = h.Reason,
|
||||
// Docs = GetDocFile(h.Profile.Id),
|
||||
MatchingConditions = h.MatchingConditions == null ? null : JsonConvert.DeserializeObject<List<MatchingCondition>>(h.MatchingConditions)
|
||||
})).ToList();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -28,7 +29,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false,string seperator = " ")
|
||||
public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false, string seperator = " ")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -96,6 +97,62 @@ namespace BMA.EHR.Application.Repositories
|
|||
throw;
|
||||
}
|
||||
}
|
||||
private List<string> GetOcNameFullPath(Guid id, bool showRoot = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ocList = new List<string>();
|
||||
|
||||
var oc = (from o in _dbContext.Set<OrganizationEntity>().Include(x => x.Parent).Include(x => x.OrganizationOrganization).Where(x => x.OrganizationOrganization != null).AsQueryable()
|
||||
join oc_name in _dbContext.Set<OrganizationOrganization>().AsQueryable() on o.OrganizationOrganization.Id equals oc_name.Id
|
||||
where o.Parent != null
|
||||
select new
|
||||
{
|
||||
Id = o.Id,
|
||||
Name = oc_name.Name,
|
||||
o.IsActive,
|
||||
o.Parent
|
||||
}).FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||
|
||||
if (oc == null)
|
||||
return ocList;
|
||||
|
||||
ocList.Add(oc.Name);
|
||||
|
||||
if (oc.Parent?.Id != null)
|
||||
{
|
||||
ocList.AddRange(GetOcNameFullPath(oc.Parent.Id, showRoot));
|
||||
}
|
||||
|
||||
return ocList;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
private string FindOCFullPath(Guid id, bool showRoot = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ocList = GetOcNameFullPath(id, showRoot);
|
||||
var ret = String.Empty;
|
||||
foreach (var oc in ocList)
|
||||
{
|
||||
ret = oc + "/" + ret;
|
||||
}
|
||||
|
||||
if (ret.Length > 2)
|
||||
ret = ret.Substring(0, ret.Length - 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly InsigniaPeriodsRepository _repositoryInsignia;
|
||||
private readonly string CRLF = "\r\n";
|
||||
|
||||
#endregion
|
||||
|
|
@ -30,14 +31,16 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region " Constructor and Destructor "
|
||||
|
||||
public InsigniaReportRepository(IApplicationDBContext dbContext,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
InsigniaPeriodsRepository repositoryInsignia,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_repositoryInsignia = repositoryInsignia;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -904,6 +907,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
//noti ยื่นเสนอคน
|
||||
public async Task NotifyInsignia()
|
||||
{
|
||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||
|
|
@ -931,6 +936,147 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
}
|
||||
|
||||
//ล็อกข้อมูล โอนคนไปบันทึกผล
|
||||
public async Task LockInsignia()
|
||||
{
|
||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||
.AsQueryable()
|
||||
.Include(x => x.InsigniaRequests)
|
||||
.Include(x => x.ReliefDoc)
|
||||
.ToListAsync();
|
||||
foreach (var insigniaPeriod in insigniaPeriods)
|
||||
{
|
||||
if (insigniaPeriod.EndDate.Date.AddDays(5) == DateTime.Now.Date)
|
||||
continue;
|
||||
insigniaPeriod.IsLock = true;
|
||||
var insigniaNote = await _dbContext.Set<InsigniaNote>()
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.RequestInsignia)
|
||||
.FirstOrDefaultAsync(x => x.Year == insigniaPeriod.Year);
|
||||
if (insigniaNote == null)
|
||||
{
|
||||
insigniaNote = new InsigniaNote
|
||||
{
|
||||
// Round = insigniaPeriod.Round,
|
||||
Name = $"รอบการเสนอขอพระราชทานเครื่องราชปี {insigniaPeriod.Year + 543}",
|
||||
Year = insigniaPeriod.Year,
|
||||
// StartDate = insigniaPeriod.StartDate,
|
||||
// EndDate = insigniaPeriod.EndDate,
|
||||
// Amount = insigniaPeriod.Amount,
|
||||
// ReliefDoc = insigniaPeriod.ReliefDoc,
|
||||
CreatedUserId = "System Administrator",
|
||||
CreatedFullName = "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = "System Administrator",
|
||||
LastUpdateUserId = "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _dbContext.Set<InsigniaNote>().AddAsync(insigniaNote);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
insigniaNote = await _dbContext.Set<InsigniaNote>()
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.Include(x => x.InsigniaNoteProfiles)
|
||||
.ThenInclude(x => x.RequestInsignia)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaNote.Id);
|
||||
}
|
||||
var requestOlds = await _dbContext.Set<InsigniaRequest>()
|
||||
.Where(p => p.Period == insigniaPeriod)
|
||||
.Where(p => p.RequestStatus == "st5")
|
||||
.ToListAsync();
|
||||
foreach (var requestOld in requestOlds)
|
||||
{
|
||||
var profileOlds = await _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Include(x => x.Profile)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.Where(p => p.Request == requestOld)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var profileOld in profileOlds)
|
||||
{
|
||||
if (profileOld.Status == "DELETE" || profileOld.Status == "REJECT")
|
||||
continue;
|
||||
var noreProfileOld = insigniaNote.InsigniaNoteProfiles
|
||||
.Where(x => x.Profile == profileOld.Profile)
|
||||
.FirstOrDefault();
|
||||
if (noreProfileOld != null)
|
||||
{
|
||||
noreProfileOld.RequestDate = profileOld.RequestDate;
|
||||
noreProfileOld.Salary = profileOld.Salary;
|
||||
noreProfileOld.IsApprove = profileOld.IsApprove;
|
||||
noreProfileOld.RequestInsignia = profileOld.RequestInsignia;
|
||||
noreProfileOld.CreatedUserId = "System Administrator";
|
||||
noreProfileOld.CreatedFullName = "";
|
||||
noreProfileOld.CreatedAt = DateTime.Now;
|
||||
noreProfileOld.LastUpdateFullName = "System Administrator";
|
||||
noreProfileOld.LastUpdateUserId = "";
|
||||
noreProfileOld.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (profileOld.Profile == null)
|
||||
continue;
|
||||
await _dbContext.Set<InsigniaNoteProfile>().AddAsync(new InsigniaNoteProfile
|
||||
{
|
||||
RequestDate = profileOld.RequestDate,
|
||||
Salary = profileOld.Salary,
|
||||
IsApprove = profileOld.IsApprove,
|
||||
Status = "PENDING",
|
||||
Profile = profileOld.Profile,
|
||||
RequestInsignia = profileOld.RequestInsignia,
|
||||
OrganizationOrganizationSend = profileOld.Profile == null || profileOld.Profile.OcId == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(profileOld.Profile.OcId.Value, false, false),
|
||||
InsigniaNote = insigniaNote,
|
||||
CreatedUserId = "System Administrator",
|
||||
CreatedFullName = "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = "System Administrator",
|
||||
LastUpdateUserId = "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
//คำนวนผู้ได้รับเครื่องราช
|
||||
public async Task CalInsignaiRequestBkk()
|
||||
{
|
||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var insigniaPeriod in insigniaPeriods)
|
||||
{
|
||||
if (insigniaPeriod.StartDate == DateTime.Now.Date)
|
||||
continue;
|
||||
var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||
if (organizationType == null)
|
||||
continue;
|
||||
var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||
foreach (var organization in organizations)
|
||||
{
|
||||
if (organization == null)
|
||||
continue;
|
||||
|
||||
var result = await _repositoryInsignia.GetInsigniaRequest(insigniaPeriod.Id, organization.Id);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
string requestStatus = result.RequestStatus;
|
||||
var candidate = await _repositoryInsignia.GetInsigniaCandidateBKK(insigniaPeriod.Id, organization.Id);
|
||||
// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await _repositoryInsignia.InsertCandidate(period, organization.Id, candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
public bool IsApprove { get; set; }
|
||||
public DateTime? RequestDate { get; set; }
|
||||
public string? RequestNote { get; set; }
|
||||
public string? Reason { get; set; }
|
||||
public List<InsigniaRequestDoc>? Docs { get; set; }
|
||||
|
||||
public List<MatchingCondition> MatchingConditions { get; set; } = new List<MatchingCondition>();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace BMA.EHR.Application.Requests
|
|||
public string RequestNote { get; set; }
|
||||
public string RequestStatus { get; set; }
|
||||
public string OrganizationName { get; set; }
|
||||
public string? Document { get; set; }
|
||||
public bool IsLock { get; set; }
|
||||
public List<InsigniaRequestItem> Items { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using BMA.EHR.Domain.Models.Base;
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Insignias
|
||||
{
|
||||
|
|
@ -40,6 +41,18 @@ namespace BMA.EHR.Domain.Models.Insignias
|
|||
public string? Address { get; set; }
|
||||
[Comment("ทะเบียนฐานันดร")]
|
||||
public string? Issue { get; set; }
|
||||
[Comment("วันที่รับเครื่องราชฯ")]
|
||||
public DateTime? DateReceiveInsignia { get; set; }
|
||||
[Comment("หลักฐานรับเครื่องราชฯ")]
|
||||
public Document? DocReceiveInsignia { get; set; }
|
||||
[Comment("หน่วยงานรับเครื่องราชฯ")]
|
||||
public OrganizationOrganization? OrgReceiveInsignia { get; set; }
|
||||
[Comment("วันที่คืนเครื่องราชฯ")]
|
||||
public DateTime? DateReturnInsignia { get; set; }
|
||||
[Comment("หลักฐานคืนเครื่องราชฯ")]
|
||||
public Document? DocReturnInsignia { get; set; }
|
||||
[Comment("หน่วยงานคืนเครื่องราชฯ")]
|
||||
public OrganizationOrganization? OrgReturnInsignia { get; set; }
|
||||
public Profile Profile { get; set; }
|
||||
public Insignia RequestInsignia { get; set; }
|
||||
public InsigniaNote InsigniaNote { get; set; }
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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
|
||||
{
|
||||
|
|
@ -18,6 +19,8 @@ namespace BMA.EHR.Domain.Models.Insignias
|
|||
public InsigniaPeriod Period { get; set; }
|
||||
|
||||
public OrganizationEntity Organization { get; set; }
|
||||
[Comment("Fk Id Document")]
|
||||
public Document? Document { get; set; }
|
||||
|
||||
public virtual List<InsigniaRequestProfile> RequestProfiles { get; set; } = new List<InsigniaRequestProfile>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ namespace BMA.EHR.Domain.Models.Insignias
|
|||
public string Status { get; set; } = "PENDING";
|
||||
|
||||
[Comment("เหตุผลไม่ยื่นขอ")]
|
||||
public string? ReasonReject { get; set; }
|
||||
|
||||
[Comment("เหตุผลการได้รับเครื่องราชฯ")]
|
||||
public string? Reason { get; set; }
|
||||
|
||||
public Profile Profile { get; set; }
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@
|
|||
|
||||
#region " OrganizationEmployee "
|
||||
public static readonly string OrganizationEmployeeNotFound = "ไม่พบข้อมูลโครงสร้างตำแหน่งลูกจ้าง";
|
||||
public static readonly string OrganizationEmployeeDupicate = "โครงสร้างตำแหน่งลูกจ้าง บุคคลนี้ไว้อยู่แล้ว";
|
||||
#endregion
|
||||
|
||||
#region " Insignia "
|
||||
|
|
|
|||
16329
BMA.EHR.Infrastructure/Migrations/20230926085215_update table insigniaperiod add reason.Designer.cs
generated
Normal file
16329
BMA.EHR.Infrastructure/Migrations/20230926085215_update table insigniaperiod add reason.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableinsigniaperiodaddreason : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DocumentId",
|
||||
table: "InsigniaRequests",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Reason",
|
||||
table: "InsigniaRequestProfiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "เหตุผลการได้รับเครื่องราชฯ",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true,
|
||||
oldComment: "เหตุผลไม่ยื่นขอ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ReasonReject",
|
||||
table: "InsigniaRequestProfiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "เหตุผลไม่ยื่นขอ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InsigniaRequests_DocumentId",
|
||||
table: "InsigniaRequests",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_InsigniaRequests_Documents_DocumentId",
|
||||
table: "InsigniaRequests",
|
||||
column: "DocumentId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_InsigniaRequests_Documents_DocumentId",
|
||||
table: "InsigniaRequests");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_InsigniaRequests_DocumentId",
|
||||
table: "InsigniaRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocumentId",
|
||||
table: "InsigniaRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReasonReject",
|
||||
table: "InsigniaRequestProfiles");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Reason",
|
||||
table: "InsigniaRequestProfiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "เหตุผลไม่ยื่นขอ",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true,
|
||||
oldComment: "เหตุผลการได้รับเครื่องราชฯ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
16381
BMA.EHR.Infrastructure/Migrations/20230926094505_update table insignianoteprofile add return.Designer.cs
generated
Normal file
16381
BMA.EHR.Infrastructure/Migrations/20230926094505_update table insignianoteprofile add return.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,165 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableinsignianoteprofileaddreturn : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DateReceiveInsignia",
|
||||
table: "InsigniaNoteProfiles",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
comment: "วันที่รับเครื่องราชฯ");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DateReturnInsignia",
|
||||
table: "InsigniaNoteProfiles",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
comment: "วันที่คืนเครื่องราชฯ");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DocReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DocReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "OrgReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "OrgReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InsigniaNoteProfiles_DocReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "DocReceiveInsigniaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InsigniaNoteProfiles_DocReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "DocReturnInsigniaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InsigniaNoteProfiles_OrgReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "OrgReceiveInsigniaId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InsigniaNoteProfiles_OrgReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "OrgReturnInsigniaId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_Documents_DocReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "DocReceiveInsigniaId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_Documents_DocReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "DocReturnInsigniaId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReceiveIns~",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "OrgReceiveInsigniaId",
|
||||
principalTable: "OrganizationOrganizations",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReturnInsi~",
|
||||
table: "InsigniaNoteProfiles",
|
||||
column: "OrgReturnInsigniaId",
|
||||
principalTable: "OrganizationOrganizations",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_Documents_DocReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_Documents_DocReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReceiveIns~",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReturnInsi~",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_InsigniaNoteProfiles_DocReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_InsigniaNoteProfiles_DocReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_InsigniaNoteProfiles_OrgReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_InsigniaNoteProfiles_OrgReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DateReceiveInsignia",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DateReturnInsignia",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrgReceiveInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrgReturnInsigniaId",
|
||||
table: "InsigniaNoteProfiles");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5665,6 +5665,20 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่ได้รับพระราชทานเครื่องราชฯ");
|
||||
|
||||
b.Property<DateTime?>("DateReceiveInsignia")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่รับเครื่องราชฯ");
|
||||
|
||||
b.Property<DateTime?>("DateReturnInsignia")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("วันที่คืนเครื่องราชฯ");
|
||||
|
||||
b.Property<Guid?>("DocReceiveInsigniaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("DocReturnInsigniaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("InsigniaNoteId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -5702,6 +5716,12 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("หมายเลขประกาศนียบัตรกำกับเครื่องราชฯ");
|
||||
|
||||
b.Property<Guid?>("OrgReceiveInsigniaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("OrgReturnInsigniaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("OrganizationOrganizationReceive")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สังกัด ณ วันที่ได้รับพระราชทานเครื่องราชฯ");
|
||||
|
|
@ -5745,8 +5765,16 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocReceiveInsigniaId");
|
||||
|
||||
b.HasIndex("DocReturnInsigniaId");
|
||||
|
||||
b.HasIndex("InsigniaNoteId");
|
||||
|
||||
b.HasIndex("OrgReceiveInsigniaId");
|
||||
|
||||
b.HasIndex("OrgReturnInsigniaId");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.HasIndex("RequestInsigniaId");
|
||||
|
|
@ -5878,6 +5906,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<Guid?>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
|
|
@ -5914,6 +5945,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.HasIndex("PeriodId");
|
||||
|
|
@ -5979,6 +6012,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลการได้รับเครื่องราชฯ");
|
||||
|
||||
b.Property<string>("ReasonReject")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลไม่ยื่นขอ");
|
||||
|
||||
|
|
@ -14721,12 +14758,28 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaNoteProfile", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "DocReceiveInsignia")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocReceiveInsigniaId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "DocReturnInsignia")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocReturnInsigniaId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Insignias.InsigniaNote", "InsigniaNote")
|
||||
.WithMany("InsigniaNoteProfiles")
|
||||
.HasForeignKey("InsigniaNoteId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrgReceiveInsignia")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrgReceiveInsigniaId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrgReturnInsignia")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrgReturnInsigniaId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
|
|
@ -14739,8 +14792,16 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DocReceiveInsignia");
|
||||
|
||||
b.Navigation("DocReturnInsignia");
|
||||
|
||||
b.Navigation("InsigniaNote");
|
||||
|
||||
b.Navigation("OrgReceiveInsignia");
|
||||
|
||||
b.Navigation("OrgReturnInsignia");
|
||||
|
||||
b.Navigation("Profile");
|
||||
|
||||
b.Navigation("RequestInsignia");
|
||||
|
|
@ -14757,6 +14818,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrganizationId")
|
||||
|
|
@ -14769,6 +14834,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("Organization");
|
||||
|
||||
b.Navigation("Period");
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
period_round = p.Round,
|
||||
period_start = p.StartDate,
|
||||
period_end = p.EndDate,
|
||||
period_status = _repository.CalStatusByDate(p.StartDate, p.EndDate, p.Year.ToString()),
|
||||
period_status = p.IsLock == true ? "DONE" : (p.InsigniaRequests.Count() == 0 ? "WAITTING" : "PENDING"),
|
||||
period_year = p.Year,
|
||||
period_isActive = p.IsActive,
|
||||
period_doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
|
||||
|
|
@ -121,7 +121,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
period_round = p.Round,
|
||||
period_start = p.StartDate,
|
||||
period_end = p.EndDate,
|
||||
period_status = _repository.CalStatusByDate(p.StartDate, p.EndDate, p.Year.ToString()),
|
||||
period_status = p.IsLock == true ? "DONE" : (p.InsigniaRequests.Count() == 0 ? "WAITTING" : "PENDING"),
|
||||
period_year = p.Year,
|
||||
period_isActive = p.IsActive,
|
||||
period_doc = p.ReliefDoc == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ReliefDoc.Id,
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
RequestNote = result.RequestNote,
|
||||
IsLock = result.IsLock,
|
||||
OrganizationName = result.OrganizationName,
|
||||
Document = result.Document,
|
||||
Items = new List<InsigniaRequestItem>()
|
||||
};
|
||||
if (RoleAdmin == true && result.RequestStatus != "st5")
|
||||
|
|
@ -664,7 +665,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("officer/approve/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt2(Guid id, Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId)
|
||||
{
|
||||
await _repository.SaveAprove(id, ocId);
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
|
|
@ -673,6 +674,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
{
|
||||
requestNew.RequestStatus = "st3";
|
||||
requestNew.RequestNote = "";
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-ae15-40a2-8331-3e2e6d9d9a86"),
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ยื่นข้อมูลขอมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ยื่นข้อมูลขอมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
"",
|
||||
true
|
||||
);
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -689,7 +697,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("officer/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt1([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
{
|
||||
await _repository.SaveAprove(id, ocId);
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
|
|
@ -706,7 +714,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// เปลี่ยน status เป็น st5 ผอ.หน่วยอนุมัติ "
|
||||
/// เปลี่ยน status เป็น st6 ผอ.หน่วยอนุมัติ "
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -714,14 +722,28 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("director/approve/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt6(Guid id, Guid ocId)
|
||||
{
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
if (requestNew != null)
|
||||
{
|
||||
requestNew.RequestStatus = "st5";
|
||||
requestNew.RequestStatus = "st6";
|
||||
requestNew.RequestNote = "";
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ยื่นข้อมูลขอมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ยื่นข้อมูลขอมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
"",
|
||||
true
|
||||
);
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e658"),
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ยื่นข้อมูลขอมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ยื่นข้อมูลขอมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
"",
|
||||
true
|
||||
);
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -738,14 +760,60 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("director/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt4([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
{
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
var requestNew = await _context.InsigniaRequests
|
||||
.Include(x => x.Organization)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
.Include(x => x.Period)
|
||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
if (requestNew != null)
|
||||
{
|
||||
requestNew.RequestStatus = "st4";
|
||||
requestNew.RequestNote = req.Reason;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-adff-47b0-8762-41cd5c991001"),
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ตีกลับข้อมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
$"{(requestNew.Organization.OrganizationOrganization == null ? null : requestNew.Organization.OrganizationOrganization.Name)} ตีกลับข้อมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
"",
|
||||
true
|
||||
);
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
else
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// เปลี่ยน status เป็น st5 สกจ. หน่วยไม่อนุมัติ "
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("head/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt5([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||
{
|
||||
var requestId = await _repository.GetRequestId(id, ocId);
|
||||
var requestNew = await _context.InsigniaRequests
|
||||
.Include(x => x.Organization)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
.Include(x => x.Period)
|
||||
.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||
if (requestNew != null)
|
||||
{
|
||||
requestNew.RequestStatus = "st5";
|
||||
requestNew.RequestNote = req.Reason;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-ae15-40a2-8331-3e2e6d9d9a86"),
|
||||
$"สกจ. ตีกลับข้อมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
$"สกจ. ตีกลับข้อมูลผู้มีสิทธิ์ได้รับเครื่องราชฯ {requestNew.Period.Name}",
|
||||
"",
|
||||
true
|
||||
);
|
||||
_context.SaveChanges();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -814,7 +882,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaRequestProfile == null)
|
||||
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
||||
insigniaRequestProfile.Status = "REJECT";
|
||||
insigniaRequestProfile.Reason = req.Reason;
|
||||
insigniaRequestProfile.ReasonReject = req.Reason;
|
||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -838,7 +906,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaRequestProfile == null)
|
||||
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
||||
insigniaRequestProfile.Status = "DELETE";
|
||||
insigniaRequestProfile.Reason = req.Reason;
|
||||
insigniaRequestProfile.ReasonReject = req.Reason;
|
||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -992,6 +1060,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Profile = profile,
|
||||
RequestInsignia = insignia,
|
||||
Request = insigniaRequest,
|
||||
Reason = req.Reason,
|
||||
RequestDate = DateTime.Now,
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
|
|
@ -1261,6 +1330,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Address = x.Address,
|
||||
Number = x.Number,
|
||||
Salary = x.Salary,
|
||||
DateReceiveInsignia = x.DateReceiveInsignia,
|
||||
DocReceiveInsignia = x.DocReceiveInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReceiveInsignia.Id,
|
||||
OrgReceiveInsignia = x.OrgReceiveInsignia == null ? "-" : x.OrgReceiveInsignia.Name,
|
||||
DateReturnInsignia = x.DateReturnInsignia,
|
||||
DocReturnInsignia = x.DocReturnInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReturnInsignia.Id,
|
||||
OrgReturnInsignia = x.OrgReturnInsignia == null ? "-" : x.OrgReturnInsignia.Name,
|
||||
}).ToListAsync();
|
||||
var _insigniaNoteProfiles = new List<dynamic>();
|
||||
foreach (var insigniaNoteProfile in insigniaNoteProfiles)
|
||||
|
|
@ -1292,6 +1367,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
insigniaNoteProfile.Address,
|
||||
insigniaNoteProfile.Number,
|
||||
insigniaNoteProfile.Salary,
|
||||
insigniaNoteProfile.DateReceiveInsignia,
|
||||
DocReceiveInsignia = insigniaNoteProfile.DocReceiveInsignia == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(insigniaNoteProfile.DocReceiveInsignia),
|
||||
insigniaNoteProfile.OrgReceiveInsignia,
|
||||
insigniaNoteProfile.DateReturnInsignia,
|
||||
DocReturnInsignia = insigniaNoteProfile.DocReturnInsignia == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(insigniaNoteProfile.DocReturnInsignia),
|
||||
insigniaNoteProfile.OrgReturnInsignia,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -2042,8 +2123,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
{
|
||||
workSheet.Cells[row, 1].Value = insigniaPeriod.Organization.OrganizationOrganization == null ? "-" : insigniaPeriod.Organization.OrganizationOrganization.Name;
|
||||
workSheet.Cells[row, 2].Value = item.Profile.CitizenId;
|
||||
workSheet.Cells[row, 3].Value = item.Profile.Prefix == null ? "-" : item.Profile.Prefix.Name;
|
||||
workSheet.Cells[row, 4].Value = "-";
|
||||
workSheet.Cells[row, 3].Value = item.Profile.Prefix == null ? "-" : ((item.Profile.Prefix.Name == "นาย" || item.Profile.Prefix.Name == "นาง" || item.Profile.Prefix.Name == "นางสาว") ? item.Profile.Prefix.Name : "-");
|
||||
workSheet.Cells[row, 4].Value = item.Profile.Prefix == null ? "-" : ((item.Profile.Prefix.Name == "นาย" || item.Profile.Prefix.Name == "นาง" || item.Profile.Prefix.Name == "นางสาว") ? "-" : item.Profile.Prefix.Name);
|
||||
workSheet.Cells[row, 5].Value = item.Profile.FirstName;
|
||||
workSheet.Cells[row, 6].Value = item.Profile.LastName;
|
||||
workSheet.Cells[row, 7].Value = item.Profile.Gender == null ? "-" : item.Profile.Gender.Name;
|
||||
|
|
@ -2090,5 +2171,105 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
System.IO.File.Delete(exportFile);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload เอกสาร เครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <param name="requestId">Id รอบเครื่องราช</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("upload/{requestId:length(36)}"), DisableRequestSizeLimit]
|
||||
public async Task<ActionResult<ResponseObject>> UpdatePersonDeferment([FromForm] ImportFileRequest req, Guid requestId)
|
||||
{
|
||||
var insigniaRequest = await _context.InsigniaRequests.Where(x => x.Id == requestId).FirstOrDefaultAsync();
|
||||
if (insigniaRequest == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound, 404);
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
insigniaRequest.Document = doc;
|
||||
}
|
||||
insigniaRequest.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaRequest.LastUpdateUserId = UserId ?? "";
|
||||
insigniaRequest.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ยื่นรายการคืนเครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <param name="insigniaNoteProfileId">Id บุคคลบันทึกผลเครื่องราชฯ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("note/return/{insigniaNoteProfileId:length(36)}"), DisableRequestSizeLimit]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateReturnNoteInsignia([FromForm] InsigniaNoteReturnRequest req, Guid insigniaNoteProfileId)
|
||||
{
|
||||
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.Where(x => x.Id == insigniaNoteProfileId).FirstOrDefaultAsync();
|
||||
if (insigniaNoteProfile == null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound, 404);
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
insigniaNoteProfile.DocReturnInsignia = doc;
|
||||
}
|
||||
insigniaNoteProfile.OrgReturnInsignia = await _context.OrganizationOrganizations.Where(x => x.Id == req.OrgId).FirstOrDefaultAsync();
|
||||
insigniaNoteProfile.DateReturnInsignia = req.Date;
|
||||
insigniaNoteProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaNoteProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaNoteProfile.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ยื่นรายการรับเครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <param name="insigniaNoteProfileId">Id บุคคลบันทึกผลเครื่องราชฯ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("note/receive/{insigniaNoteProfileId:length(36)}"), DisableRequestSizeLimit]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateReceiveNoteInsignia([FromForm] InsigniaNoteReturnRequest req, Guid insigniaNoteProfileId)
|
||||
{
|
||||
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.Where(x => x.Id == insigniaNoteProfileId).FirstOrDefaultAsync();
|
||||
if (insigniaNoteProfile == null)
|
||||
return Error(GlobalMessages.InsigniaRequestProfileNotFound, 404);
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
var file = Request.Form.Files[0];
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
insigniaNoteProfile.DocReceiveInsignia = doc;
|
||||
}
|
||||
insigniaNoteProfile.OrgReceiveInsignia = await _context.OrganizationOrganizations.Where(x => x.Id == req.OrgId).FirstOrDefaultAsync();
|
||||
insigniaNoteProfile.DateReceiveInsignia = req.Date;
|
||||
insigniaNoteProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
insigniaNoteProfile.LastUpdateUserId = UserId ?? "";
|
||||
insigniaNoteProfile.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,8 @@ var app = builder.Build();
|
|||
if (manager != null)
|
||||
{
|
||||
manager.AddOrUpdate("แจ้งเตือนรอบเครื่องราชฯ", Job.FromExpression<InsigniaReportRepository>(x => x.NotifyInsignia()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
manager.AddOrUpdate("ล็อกข้อมูลรอบเครื่องราชฯ", Job.FromExpression<InsigniaReportRepository>(x => x.LockInsignia()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
manager.AddOrUpdate("คำนวนผู้ได้รับเครื่องราชฯ", Job.FromExpression<InsigniaReportRepository>(x => x.CalInsignaiRequestBkk()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
}
|
||||
|
||||
// apply migrations
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ namespace BMA.EHR.Insignia.Service.Requests
|
|||
public Guid ProfileId { get; set; }
|
||||
public Guid insigniaId { get; set; }
|
||||
public Guid insigniaPeriodId { get; set; }
|
||||
public string? Reason { get; set; }
|
||||
}
|
||||
}
|
||||
12
BMA.EHR.Insignia.Service/Requests/InsigniaReturnRequest.cs
Normal file
12
BMA.EHR.Insignia.Service/Requests/InsigniaReturnRequest.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Insignia.Service.Requests
|
||||
{
|
||||
public class InsigniaNoteReturnRequest
|
||||
{
|
||||
public List<FormFile>? File { get; set; }
|
||||
public DateTime? Date { get; set; }
|
||||
public Guid OrgId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -432,28 +432,47 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
.FirstOrDefaultAsync(x => x.Id == req.OrganizationEmployeeId);
|
||||
if (organizationEmployee == null)
|
||||
return Error(GlobalMessages.OrganizationEmployeeNotFound, 404);
|
||||
var organizationEmployeeProfile = await _context.OrganizationEmployees
|
||||
.Include(x => x.Profile)
|
||||
// var organizationEmployeeProfile = await _context.OrganizationEmployees
|
||||
// .Include(x => x.Profile)
|
||||
// .FirstOrDefaultAsync(x => x.Profile == profile);
|
||||
// if (organizationEmployeeProfile != null)
|
||||
// organizationEmployeeProfile.Profile = null;
|
||||
var organizationEmployeeProfileDup = await _context.OrganizationEmployeeProfiles
|
||||
.FirstOrDefaultAsync(x => x.Profile != profile && x.OrgEmployee == organizationEmployee);
|
||||
if (organizationEmployeeProfileDup != null)
|
||||
return Error(GlobalMessages.OrganizationEmployeeDupicate);
|
||||
var organizationEmployeeProfile = await _context.OrganizationEmployeeProfiles
|
||||
.FirstOrDefaultAsync(x => x.Profile == profile);
|
||||
if (organizationEmployeeProfile != null)
|
||||
organizationEmployeeProfile.Profile = null;
|
||||
|
||||
var data = new OrganizationEmployeeProfile
|
||||
if (organizationEmployeeProfile == null)
|
||||
{
|
||||
OrgEmployee = organizationEmployee,
|
||||
Profile = profile,
|
||||
Status = "PENDING",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.OrganizationEmployeeProfiles.AddAsync(data);
|
||||
var data = new OrganizationEmployeeProfile
|
||||
{
|
||||
OrgEmployee = organizationEmployee,
|
||||
Profile = profile,
|
||||
Status = "PENDING",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.OrganizationEmployeeProfiles.AddAsync(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
organizationEmployeeProfile.OrgEmployee = organizationEmployee;
|
||||
organizationEmployeeProfile.Status = "PENDING";
|
||||
organizationEmployeeProfile.CreatedUserId = UserId ?? "System Administrator";
|
||||
organizationEmployeeProfile.CreatedFullName = FullName ?? "";
|
||||
organizationEmployeeProfile.CreatedAt = DateTime.Now;
|
||||
organizationEmployeeProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
organizationEmployeeProfile.LastUpdateUserId = UserId ?? "";
|
||||
organizationEmployeeProfile.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
// organizationEmployee.Profile = profile;
|
||||
// organizationEmployee.IsPublic = false;
|
||||
_context.SaveChanges();
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
Organization = req.Organization,
|
||||
Reason = req.Reason,
|
||||
Date = req.Date,
|
||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue