เหตุผลอนุมัติระบบลา

This commit is contained in:
Kittapath 2023-08-29 14:17:28 +07:00
parent 2fd30e815c
commit 677ec75c66
5 changed files with 16019 additions and 6 deletions

View file

@ -41,12 +41,16 @@ namespace BMA.EHR.Domain.Models.Retirement
public bool IsActive { get; set; } = true; public bool IsActive { get; set; } = true;
[Comment("สถานะยับยั้งผู้ดูแล")] [Comment("สถานะยับยั้งผู้ดูแล")]
public bool? OligarchReject { get; set; } public bool? OligarchReject { get; set; }
[Comment("เหตุผลอนุมัติผู้ดูแล")]
public string? OligarchApproveReason { get; set; }
[Comment("เหตุผลยับยั้งผู้ดูแล")] [Comment("เหตุผลยับยั้งผู้ดูแล")]
public string? OligarchRejectReason { get; set; } public string? OligarchRejectReason { get; set; }
[Comment("วันที่ยับยั้งผู้ดูแล")] [Comment("วันที่ยับยั้งผู้ดูแล")]
public DateTime? OligarchRejectDate { get; set; } public DateTime? OligarchRejectDate { get; set; }
[Comment("สถานะยับยั้งผู้บังคับบัญชา")] [Comment("สถานะยับยั้งผู้บังคับบัญชา")]
public bool? CommanderReject { get; set; } public bool? CommanderReject { get; set; }
[Comment("เหตุผลอนุมัติผู้บังคับบัญชา")]
public string? CommanderApproveReason { get; set; }
[Comment("เหตุผลยับยั้งผู้บังคับบัญชา")] [Comment("เหตุผลยับยั้งผู้บังคับบัญชา")]
public string? CommanderRejectReason { get; set; } public string? CommanderRejectReason { get; set; }
[Comment("วันที่ยับยั้งผู้บังคับบัญชา")] [Comment("วันที่ยับยั้งผู้บังคับบัญชา")]

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableresignaddcommander2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "CommanderApproveReason",
table: "RetirementResigns",
type: "longtext",
nullable: true,
comment: "เหตุผลอนุมัติผู้บังคับบัญชา")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OligarchApproveReason",
table: "RetirementResigns",
type: "longtext",
nullable: true,
comment: "เหตุผลอนุมัติผู้ดูแล")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CommanderApproveReason",
table: "RetirementResigns");
migrationBuilder.DropColumn(
name: "OligarchApproveReason",
table: "RetirementResigns");
}
}
}

View file

@ -13569,6 +13569,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติ"); .HasComment("เหตุผลอนุมัติ");
b.Property<string>("CommanderApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติผู้บังคับบัญชา");
b.Property<bool?>("CommanderReject") b.Property<bool?>("CommanderReject")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
.HasComment("สถานะยับยั้งผู้บังคับบัญชา"); .HasComment("สถานะยับยั้งผู้บังคับบัญชา");
@ -13627,6 +13631,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("สถานที่ยื่นขอลาออกราชการ"); .HasComment("สถานที่ยื่นขอลาออกราชการ");
b.Property<string>("OligarchApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติผู้ดูแล");
b.Property<bool?>("OligarchReject") b.Property<bool?>("OligarchReject")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
.HasComment("สถานะยับยั้งผู้ดูแล"); .HasComment("สถานะยับยั้งผู้ดูแล");

View file

@ -215,9 +215,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.PositionNumberOld, p.PositionNumberOld,
p.OrganizationPositionOld, p.OrganizationPositionOld,
p.OligarchReject, p.OligarchReject,
p.OligarchApproveReason,
p.OligarchRejectReason, p.OligarchRejectReason,
p.OligarchRejectDate, p.OligarchRejectDate,
p.CommanderReject, p.CommanderReject,
p.CommanderApproveReason,
p.CommanderRejectReason, p.CommanderRejectReason,
p.CommanderRejectDate, p.CommanderRejectDate,
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }), RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
@ -259,9 +261,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.IsActive, data.IsActive,
data.CreatedAt, data.CreatedAt,
data.OligarchReject, data.OligarchReject,
data.OligarchApproveReason,
data.OligarchRejectReason, data.OligarchRejectReason,
data.OligarchRejectDate, data.OligarchRejectDate,
data.CommanderReject, data.CommanderReject,
data.CommanderApproveReason,
data.CommanderRejectReason, data.CommanderRejectReason,
data.CommanderRejectDate, data.CommanderRejectDate,
Docs = retirementResignDocs, Docs = retirementResignDocs,
@ -465,6 +469,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success(); return Success();
} }
/// <summary> /// <summary>
/// ผู้บังคับบัญชา อนุมัติคำลาออก /// ผู้บังคับบัญชา อนุมัติคำลาออก
/// </summary> /// </summary>
@ -475,7 +480,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("commander/confirm/{id:length(36)}")] [HttpPut("commander/confirm/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonDateRequest req, Guid id) public async Task<ActionResult<ResponseObject>> CommanderConfirm([FromBody] RetirementReasonRequest req, Guid id)
{ {
var updated = await _context.RetirementResigns var updated = await _context.RetirementResigns
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
@ -484,6 +489,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
// updated.Status = "APPROVE"; // updated.Status = "APPROVE";
updated.CommanderReject = false; updated.CommanderReject = false;
updated.CommanderApproveReason = req.Reason;
updated.LastUpdateFullName = FullName ?? "System Administrator"; updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
@ -502,7 +508,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("commander/reject/{id:length(36)}")] [HttpPut("commander/reject/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonDateRequest req, Guid id) public async Task<ActionResult<ResponseObject>> CommanderReject([FromBody] RetirementReasonDateRequest req, Guid id)
{ {
var updated = await _context.RetirementResigns var updated = await _context.RetirementResigns
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
@ -530,15 +536,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("oligarch/confirm/{id:length(36)}")] [HttpPut("oligarch/confirm/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonDateRequest req, Guid id) public async Task<ActionResult<ResponseObject>> OligarchConfirm([FromBody] RetirementReasonRequest req, Guid id)
{ {
var updated = await _context.RetirementResigns var updated = await _context.RetirementResigns
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
if (updated == null) if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404); return Error(GlobalMessages.RetirementResignNotFound, 404);
// updated.Status = "APPROVE"; updated.Status = "APPROVE";
updated.OligarchReject = false; updated.OligarchReject = false;
updated.OligarchApproveReason = req.Reason;
updated.LastUpdateFullName = FullName ?? "System Administrator"; updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
@ -557,14 +564,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response> /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response> /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("oligarch/reject/{id:length(36)}")] [HttpPut("oligarch/reject/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonDateRequest req, Guid id) public async Task<ActionResult<ResponseObject>> OligarchReject([FromBody] RetirementReasonDateRequest req, Guid id)
{ {
var updated = await _context.RetirementResigns var updated = await _context.RetirementResigns
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
if (updated == null) if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404); return Error(GlobalMessages.RetirementResignNotFound, 404);
// updated.Status = "REJECT"; updated.Status = "REJECT";
updated.OligarchReject = true; updated.OligarchReject = true;
updated.OligarchRejectReason = req.Reason; updated.OligarchRejectReason = req.Reason;
updated.OligarchRejectDate = req.Date; updated.OligarchRejectDate = req.Date;