แก้บันทึกพ้นราชการ (ยังไม่เสร็จ)
This commit is contained in:
parent
e55c0f746b
commit
2e7abdb60a
13 changed files with 12478 additions and 189 deletions
|
|
@ -7,10 +7,13 @@ namespace BMA.EHR.Domain.Models.MetaData
|
||||||
{
|
{
|
||||||
public class PositionEmployeeLevel : EntityBase
|
public class PositionEmployeeLevel : EntityBase
|
||||||
{
|
{
|
||||||
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")]
|
[Column(Order = 1), Comment("ลำดับ")]
|
||||||
|
public int? Order { get; set; }
|
||||||
|
|
||||||
|
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(Order = 2), Comment("สถานะการใช้งาน")]
|
[Column(Order = 3), Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,19 @@ namespace BMA.EHR.Domain.Models.MetaData
|
||||||
{
|
{
|
||||||
public class PositionLevel : EntityBase
|
public class PositionLevel : EntityBase
|
||||||
{
|
{
|
||||||
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อระดับตำแหน่ง")]
|
[Column(Order = 1), Comment("ลำดับ")]
|
||||||
|
public int? Order { get; set; }
|
||||||
|
|
||||||
|
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อระดับตำแหน่ง")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อย่อระดับตำแหน่ง")]
|
[Required, MaxLength(100), Column(Order = 3), Comment("ชื่อย่อระดับตำแหน่ง")]
|
||||||
public string ShortName { get; set; } = string.Empty;
|
public string ShortName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(Order = 3), Comment("ลำดับชั้นของระดับตำแหน่ง")]
|
[Column(Order = 4), Comment("ลำดับชั้นของระดับตำแหน่ง")]
|
||||||
public int Level { get; set; } = 0;
|
public int Level { get; set; } = 0;
|
||||||
|
|
||||||
[Column(Order = 4), Comment("สถานะการใช้งาน")]
|
[Column(Order = 5), Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,13 @@ namespace BMA.EHR.Domain.Models.MetaData
|
||||||
{
|
{
|
||||||
public class PositionType : EntityBase
|
public class PositionType : EntityBase
|
||||||
{
|
{
|
||||||
[Required, MaxLength(100), Column(Order = 1), Comment("ชื่อประเภทตำแหน่ง")]
|
[Column(Order = 1), Comment("ลำดับ")]
|
||||||
|
public int? Order { get; set; }
|
||||||
|
|
||||||
|
[Required, MaxLength(100), Column(Order = 2), Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Column(Order = 2), Comment("สถานะการใช้งาน")]
|
[Column(Order = 3), Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,13 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
{
|
{
|
||||||
[Comment("ครั้งที่")]
|
[Comment("ครั้งที่")]
|
||||||
public int Round { get; set; }
|
public int Round { get; set; }
|
||||||
|
[Comment("ประเภทคำสั่ง")]
|
||||||
|
public string? TypeReport { get; set; } = string.Empty;
|
||||||
[Comment("ปีงบประมาณ")]
|
[Comment("ปีงบประมาณ")]
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
[Comment("ประเภท")]
|
[Comment("ประเภท")]
|
||||||
public string Type { get; set; } = string.Empty;
|
public string Type { get; set; } = string.Empty;
|
||||||
|
public virtual List<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; } = new List<RetirementPeriodHistory>();
|
||||||
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
|
public virtual List<RetirementProfile> RetirementProfiles { get; set; } = new List<RetirementProfile>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
BMA.EHR.Domain/Models/Retirement/RetirementPeriodHistory.cs
Normal file
23
BMA.EHR.Domain/Models/Retirement/RetirementPeriodHistory.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.Retirement
|
||||||
|
{
|
||||||
|
public class RetirementPeriodHistory : EntityBase
|
||||||
|
{
|
||||||
|
[Comment("ครั้งที่")]
|
||||||
|
public int Round { get; set; }
|
||||||
|
[Comment("ประเภทคำสั่ง")]
|
||||||
|
public string? TypeReport { get; set; } = string.Empty;
|
||||||
|
[Comment("ปีงบประมาณ")]
|
||||||
|
public int Year { get; set; }
|
||||||
|
[Comment("จำนวนคน")]
|
||||||
|
public int Total { get; set; }
|
||||||
|
[Comment("ประเภท")]
|
||||||
|
public string Type { get; set; } = string.Empty;
|
||||||
|
[Comment("รายชื่อเกษียญ")]
|
||||||
|
public string ProfileFile { get; set; }
|
||||||
|
public RetirementPeriod RetirementPeriod { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11811
BMA.EHR.Infrastructure/Migrations/20230727073704_update Table positionpath add order.Designer.cs
generated
Normal file
11811
BMA.EHR.Infrastructure/Migrations/20230727073704_update Table positionpath add order.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,278 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updateTablepositionpathaddorder : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "PositionTypes",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อประเภทตำแหน่ง",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 2)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 1);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsActive",
|
||||||
|
table: "PositionTypes",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการใช้งาน",
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)",
|
||||||
|
oldComment: "สถานะการใช้งาน")
|
||||||
|
.Annotation("Relational:ColumnOrder", 3)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Order",
|
||||||
|
table: "PositionTypes",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ลำดับ")
|
||||||
|
.Annotation("Relational:ColumnOrder", 1);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "ShortName",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อย่อระดับตำแหน่ง",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อย่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 3)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อระดับตำแหน่ง",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 2)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 1);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Level",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
comment: "ลำดับชั้นของระดับตำแหน่ง",
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldComment: "ลำดับชั้นของระดับตำแหน่ง")
|
||||||
|
.Annotation("Relational:ColumnOrder", 4)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsActive",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการใช้งาน",
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)",
|
||||||
|
oldComment: "สถานะการใช้งาน")
|
||||||
|
.Annotation("Relational:ColumnOrder", 5)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 4);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Order",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ลำดับ")
|
||||||
|
.Annotation("Relational:ColumnOrder", 1);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "PositionEmployeeLevels",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 2)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 1);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsActive",
|
||||||
|
table: "PositionEmployeeLevels",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการใช้งาน",
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)",
|
||||||
|
oldComment: "สถานะการใช้งาน")
|
||||||
|
.Annotation("Relational:ColumnOrder", 3)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Order",
|
||||||
|
table: "PositionEmployeeLevels",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ลำดับ")
|
||||||
|
.Annotation("Relational:ColumnOrder", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Order",
|
||||||
|
table: "PositionTypes");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Order",
|
||||||
|
table: "PositionLevels");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Order",
|
||||||
|
table: "PositionEmployeeLevels");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "PositionTypes",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อประเภทตำแหน่ง",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 1)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsActive",
|
||||||
|
table: "PositionTypes",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการใช้งาน",
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)",
|
||||||
|
oldComment: "สถานะการใช้งาน")
|
||||||
|
.Annotation("Relational:ColumnOrder", 2)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "ShortName",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อย่อระดับตำแหน่ง",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อย่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 2)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อระดับตำแหน่ง",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 1)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Level",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
comment: "ลำดับชั้นของระดับตำแหน่ง",
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldComment: "ลำดับชั้นของระดับตำแหน่ง")
|
||||||
|
.Annotation("Relational:ColumnOrder", 3)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 4);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsActive",
|
||||||
|
table: "PositionLevels",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการใช้งาน",
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)",
|
||||||
|
oldComment: "สถานะการใช้งาน")
|
||||||
|
.Annotation("Relational:ColumnOrder", 4)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 5);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
table: "PositionEmployeeLevels",
|
||||||
|
type: "varchar(100)",
|
||||||
|
maxLength: 100,
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(100)",
|
||||||
|
oldMaxLength: 100,
|
||||||
|
oldComment: "ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.Annotation("Relational:ColumnOrder", 1)
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 2);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<bool>(
|
||||||
|
name: "IsActive",
|
||||||
|
table: "PositionEmployeeLevels",
|
||||||
|
type: "tinyint(1)",
|
||||||
|
nullable: false,
|
||||||
|
comment: "สถานะการใช้งาน",
|
||||||
|
oldClrType: typeof(bool),
|
||||||
|
oldType: "tinyint(1)",
|
||||||
|
oldComment: "สถานะการใช้งาน")
|
||||||
|
.Annotation("Relational:ColumnOrder", 2)
|
||||||
|
.OldAnnotation("Relational:ColumnOrder", 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6534,7 +6534,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Property<bool>("IsActive")
|
b.Property<bool>("IsActive")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(3)
|
||||||
.HasComment("สถานะการใช้งาน");
|
.HasComment("สถานะการใช้งาน");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
|
@ -6560,9 +6560,14 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("varchar(100)")
|
.HasColumnType("varchar(100)")
|
||||||
.HasColumnOrder(1)
|
.HasColumnOrder(2)
|
||||||
.HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
|
.HasComment("ชื่อระดับชั้นงานข้อมูลตำแหน่งของลูกจ้างกรุงเทพ");
|
||||||
|
|
||||||
|
b.Property<int?>("Order")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnOrder(1)
|
||||||
|
.HasComment("ลำดับ");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("PositionEmployeeLevels");
|
b.ToTable("PositionEmployeeLevels");
|
||||||
|
|
@ -7000,7 +7005,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Property<bool>("IsActive")
|
b.Property<bool>("IsActive")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasColumnOrder(4)
|
.HasColumnOrder(5)
|
||||||
.HasComment("สถานะการใช้งาน");
|
.HasComment("สถานะการใช้งาน");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
|
@ -7024,21 +7029,26 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Property<int>("Level")
|
b.Property<int>("Level")
|
||||||
.HasColumnType("int")
|
.HasColumnType("int")
|
||||||
.HasColumnOrder(3)
|
.HasColumnOrder(4)
|
||||||
.HasComment("ลำดับชั้นของระดับตำแหน่ง");
|
.HasComment("ลำดับชั้นของระดับตำแหน่ง");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("varchar(100)")
|
.HasColumnType("varchar(100)")
|
||||||
.HasColumnOrder(1)
|
.HasColumnOrder(2)
|
||||||
.HasComment("ชื่อระดับตำแหน่ง");
|
.HasComment("ชื่อระดับตำแหน่ง");
|
||||||
|
|
||||||
|
b.Property<int?>("Order")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnOrder(1)
|
||||||
|
.HasComment("ลำดับ");
|
||||||
|
|
||||||
b.Property<string>("ShortName")
|
b.Property<string>("ShortName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("varchar(100)")
|
.HasColumnType("varchar(100)")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(3)
|
||||||
.HasComment("ชื่อย่อระดับตำแหน่ง");
|
.HasComment("ชื่อย่อระดับตำแหน่ง");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
@ -7344,7 +7354,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Property<bool>("IsActive")
|
b.Property<bool>("IsActive")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(3)
|
||||||
.HasComment("สถานะการใช้งาน");
|
.HasComment("สถานะการใช้งาน");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
|
@ -7370,9 +7380,14 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("varchar(100)")
|
.HasColumnType("varchar(100)")
|
||||||
.HasColumnOrder(1)
|
.HasColumnOrder(2)
|
||||||
.HasComment("ชื่อประเภทตำแหน่ง");
|
.HasComment("ชื่อประเภทตำแหน่ง");
|
||||||
|
|
||||||
|
b.Property<int?>("Order")
|
||||||
|
.HasColumnType("int")
|
||||||
|
.HasColumnOrder(1)
|
||||||
|
.HasComment("ลำดับ");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("PositionTypes");
|
b.ToTable("PositionTypes");
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,8 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
|
|
||||||
#region " Retirement "
|
#region " Retirement "
|
||||||
|
|
||||||
|
public DbSet<RetirementPeriodHistory> RetirementPeriodHistorys { get; set; }
|
||||||
|
|
||||||
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
||||||
|
|
||||||
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly AmazonS3Client _s3Client;
|
private readonly AmazonS3Client _s3Client;
|
||||||
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
private string _bucketName = string.Empty;
|
private string _bucketName = string.Empty;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -25,10 +26,12 @@ namespace BMA.EHR.Application.Repositories
|
||||||
#region " Constructors "
|
#region " Constructors "
|
||||||
|
|
||||||
public MinIOService(ApplicationDBContext context,
|
public MinIOService(ApplicationDBContext context,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration,
|
||||||
|
IWebHostEnvironment hostingEnvironment)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
_hostingEnvironment = hostingEnvironment;
|
||||||
|
|
||||||
var config = new AmazonS3Config
|
var config = new AmazonS3Config
|
||||||
{
|
{
|
||||||
|
|
@ -252,5 +255,84 @@ namespace BMA.EHR.Application.Repositories
|
||||||
return "EMPLOYEE_TEMP";
|
return "EMPLOYEE_TEMP";
|
||||||
return "EMPLOYEE";
|
return "EMPLOYEE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task UploadFileAsyncTemp(string fileName, string subFolder)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var fileContents = File.ReadAllBytes(fileName);
|
||||||
|
System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents);
|
||||||
|
//var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName);
|
||||||
|
var fileExt = Path.GetExtension(fileName);
|
||||||
|
// var fileType = MimeTypeMap.GetMimeType(fileExt);
|
||||||
|
var file_name = Path.GetFileName(fileName);
|
||||||
|
|
||||||
|
var request = new PutObjectRequest
|
||||||
|
{
|
||||||
|
BucketName = $"{_bucketName}{subFolder}",
|
||||||
|
Key = file_name,
|
||||||
|
InputStream = filestream,
|
||||||
|
// ContentType = fileType,
|
||||||
|
CannedACL = S3CannedACL.PublicRead
|
||||||
|
};
|
||||||
|
|
||||||
|
await _s3Client.PutObjectAsync(request);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GenerateJsonFile(string json, string path, string fileName)
|
||||||
|
{
|
||||||
|
var tmpFile = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var tmpDir = Path.Combine(_hostingEnvironment.ContentRootPath, "tmp");
|
||||||
|
if (!Directory.Exists(tmpDir))
|
||||||
|
Directory.CreateDirectory(tmpDir);
|
||||||
|
|
||||||
|
tmpFile = Path.Combine(tmpDir, fileName);
|
||||||
|
SaveToJsonFile(tmpFile, json);
|
||||||
|
|
||||||
|
await UploadFileAsyncTemp(tmpFile, path);
|
||||||
|
|
||||||
|
return "EMPLOYEE";
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tmpFile != "")
|
||||||
|
{
|
||||||
|
if (System.IO.File.Exists(tmpFile))
|
||||||
|
System.IO.File.Delete(tmpFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveToJsonFile(string fileName, string data)
|
||||||
|
{
|
||||||
|
TextWriter writer = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
writer = new StreamWriter(fileName);
|
||||||
|
writer.Write(data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (writer != null)
|
||||||
|
writer.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -550,10 +550,29 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpPost("pass/disclaim")]
|
[HttpPost("pass/disclaim")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdatePersonDisclaim([FromBody] PersonDisclaimRequest req)
|
public async Task<ActionResult<ResponseObject>> UpdatePersonDisclaim([FromBody] PersonDisclaimRequest req)
|
||||||
{
|
{
|
||||||
var person = await _context.PlacementProfiles.FindAsync(req.PersonalId);
|
var person = await _context.PlacementProfiles
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.Include(x => x.PositionNumber)
|
||||||
|
.Include(x => x.PositionPath)
|
||||||
|
.Include(x => x.PositionLevel)
|
||||||
|
.Include(x => x.PositionLine)
|
||||||
|
.Include(x => x.PositionPathSide)
|
||||||
|
.Include(x => x.PositionType)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == req.PersonalId);
|
||||||
if (person == null)
|
if (person == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
person.OrganizationPosition = null;
|
||||||
|
person.PositionNumber = null;
|
||||||
|
person.PositionPath = null;
|
||||||
|
person.PositionLevel = null;
|
||||||
|
person.PositionLine = null;
|
||||||
|
person.PositionPathSide = null;
|
||||||
|
person.PositionType = null;
|
||||||
|
person.Amount = null;
|
||||||
|
person.MouthSalaryAmount = null;
|
||||||
|
person.PositionSalaryAmount = null;
|
||||||
|
person.RecruitDate = null;
|
||||||
person.RejectReason = req.Note;
|
person.RejectReason = req.Note;
|
||||||
person.PlacementStatus = "DISCLAIM";
|
person.PlacementStatus = "DISCLAIM";
|
||||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
|
@ -1046,11 +1065,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success(position);
|
return Success(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("position/{placementId:length(36)}")]
|
[HttpPut("position/{personalId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft([FromBody] List<Guid> items, Guid placementId)
|
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft([FromBody] List<Guid> items, Guid personalId)
|
||||||
{
|
{
|
||||||
var placement = await _context.Placements
|
var placement = await _context.Placements
|
||||||
.FirstOrDefaultAsync(x => x.Id == placementId);
|
.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||||
if (placement == null)
|
if (placement == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
|
@ -1066,5 +1085,35 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("position/clear/{personalId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft(Guid personalId)
|
||||||
|
{
|
||||||
|
var profile = await _context.PlacementProfiles
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.Include(x => x.PositionNumber)
|
||||||
|
.Include(x => x.PositionPath)
|
||||||
|
.Include(x => x.PositionLevel)
|
||||||
|
.Include(x => x.PositionLine)
|
||||||
|
.Include(x => x.PositionPathSide)
|
||||||
|
.Include(x => x.PositionType)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
profile.OrganizationPosition = null;
|
||||||
|
profile.PositionNumber = null;
|
||||||
|
profile.PositionPath = null;
|
||||||
|
profile.PositionLevel = null;
|
||||||
|
profile.PositionLine = null;
|
||||||
|
profile.PositionPathSide = null;
|
||||||
|
profile.PositionType = null;
|
||||||
|
profile.Amount = null;
|
||||||
|
profile.MouthSalaryAmount = null;
|
||||||
|
profile.PositionSalaryAmount = null;
|
||||||
|
profile.RecruitDate = null;
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,47 +51,90 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region " จัดลำดับเกษียณ "
|
#region " จัดลำดับเกษียณ "
|
||||||
private async Task GenOrderByYear(string type, int year)
|
private class ObjectOrderRetire
|
||||||
{
|
{
|
||||||
if (type.Trim().ToUpper().Contains("OFFICER"))
|
public int Order { get; set; }
|
||||||
{
|
public int? Order1 { get; set; }
|
||||||
var profiles = await _context.RetirementProfiles
|
public int? Order2 { get; set; }
|
||||||
.Where(x => x.RetirementPeriod.Year == year)
|
public int? Order3 { get; set; }
|
||||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
public string LastUpdateFullName { get; set; }
|
||||||
.OrderBy(x => x.Profile.OrganizationOrganization)
|
public string LastUpdateUserId { get; set; }
|
||||||
.ThenBy(x => x.Profile.PositionType == null ? null : x.Profile.PositionType.Name)
|
public DateTime? LastUpdatedAt { get; set; }
|
||||||
.ThenBy(x => x.Profile.PositionLevel == null ? null : x.Profile.PositionLevel.Name)
|
public Guid? Id { get; set; }
|
||||||
|
}
|
||||||
|
private async Task GenOrderByYear(Guid id)
|
||||||
|
{
|
||||||
|
var Org = await _context.Organizations.FirstOrDefaultAsync(x => x.OrganizationOrder == null);
|
||||||
|
var ocIdList = await _context.Organizations.Select(x => x.Id).ToListAsync();
|
||||||
|
if (Org != null)
|
||||||
|
ocIdList = _documentService.GetAllIdByRoot(Org.Id);
|
||||||
|
var retire = await _context.RetirementPeriods
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (retire == null)
|
||||||
|
return;
|
||||||
|
var _retireProfile = await _context.RetirementProfiles
|
||||||
|
.Where(x => x.RetirementPeriod == retire)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
var order = 1;
|
var profiles = new List<ObjectOrderRetire>();
|
||||||
foreach (var profile in profiles)
|
if (retire.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||||
{
|
|
||||||
profile.Order = order;
|
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
|
||||||
order++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type.Trim().ToUpper().Contains("EMPLOYEE"))
|
|
||||||
{
|
{
|
||||||
var profiles = await _context.RetirementProfiles
|
profiles = await (from x in _context.RetirementProfiles
|
||||||
.Where(x => x.RetirementPeriod.Year == year)
|
where x.RetirementPeriod == retire
|
||||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
select new ObjectOrderRetire
|
||||||
.OrderBy(x => x.Profile.OrganizationOrganization)
|
{
|
||||||
.ThenBy(x => x.Profile.EmployeeType)
|
Id = x.Id,
|
||||||
.ThenBy(x => x.Profile.PositionEmployeeLevel)
|
Order = x.Order,
|
||||||
.ToListAsync();
|
Order1 = x.Profile == null ? 999999999 : ocIdList.IndexOf((Guid)(x.Profile.OcId)),
|
||||||
var order = 1;
|
Order2 = x.Profile == null || x.Profile.PositionType == null ? 999999999 : x.Profile.PositionType.Order,
|
||||||
foreach (var profile in profiles)
|
Order3 = x.Profile == null || x.Profile.PositionLevel == null ? 999999999 : x.Profile.PositionLevel.Level,
|
||||||
{
|
LastUpdateFullName = x.LastUpdateFullName,
|
||||||
profile.Order = order;
|
LastUpdateUserId = x.LastUpdateUserId,
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
}).ToListAsync();
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
|
||||||
order++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_context.SaveChanges();
|
if (retire.Type.Trim().ToUpper().Contains("EMPLOYEE"))
|
||||||
|
{
|
||||||
|
profiles = await (from x in _context.RetirementProfiles
|
||||||
|
where x.RetirementPeriod == retire
|
||||||
|
// x.Profile.PositionEmployeeLevelId == null ? null : x.Profile.PositionEmployeeLevelId.Order
|
||||||
|
select new ObjectOrderRetire
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Order = x.Order,
|
||||||
|
Order1 = x.Profile == null ? null : ocIdList.IndexOf((Guid)(x.Profile.OcId)),
|
||||||
|
LastUpdateFullName = x.LastUpdateFullName,
|
||||||
|
LastUpdateUserId = x.LastUpdateUserId,
|
||||||
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
|
}).ToListAsync();
|
||||||
|
}
|
||||||
|
var _profiles = profiles.AsQueryable().OrderBy(x => x.Order1).ThenBy(x => x.Order2).ThenBy(x => x.Order3).ToList();
|
||||||
|
var order = 1;
|
||||||
|
foreach (var profile in _profiles)
|
||||||
|
{
|
||||||
|
var retireProfile = _retireProfile.Find(x => x.Id == profile.Id);
|
||||||
|
retireProfile.Order = order;
|
||||||
|
retireProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
retireProfile.LastUpdateUserId = UserId ?? "";
|
||||||
|
retireProfile.LastUpdatedAt = DateTime.Now;
|
||||||
|
order++;
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int SortOrg(Guid? ocId)
|
||||||
|
{
|
||||||
|
if (ocId == null)
|
||||||
|
return 999999999;
|
||||||
|
var Org = _context.Organizations.Include(x => x.OrganizationOrganization).FirstOrDefault(x => x.OrganizationOrder == null);
|
||||||
|
if (Org != null && Org.OrganizationOrganization != null && Org.OrganizationOrganization.Name.Contains("ปลัด"))
|
||||||
|
return -1;
|
||||||
|
var ocIdList = _context.Organizations.Select(x => x.Id).ToList();
|
||||||
|
if (Org != null)
|
||||||
|
ocIdList = _documentService.GetAllIdByRoot(Org.Id);
|
||||||
|
int index = ocIdList.IndexOf((Guid)ocId);
|
||||||
|
if (index == -1)
|
||||||
|
return 999999999;
|
||||||
|
return index;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -110,29 +153,20 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
if (type.Trim().ToUpper().Contains("OFFICER") || type.Trim().ToUpper().Contains("EMPLOYEE"))
|
if (type.Trim().ToUpper().Contains("OFFICER") || type.Trim().ToUpper().Contains("EMPLOYEE"))
|
||||||
{
|
{
|
||||||
var retire_old = await _context.RetirementPeriods
|
var retire_old = await _context.RetirementPeriodHistorys
|
||||||
.Include(x => x.RetirementProfiles)
|
|
||||||
.Where(x => x.Year == year)
|
.Where(x => x.Year == year)
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||||
.OrderByDescending(x => x.Round)
|
.OrderByDescending(x => x.Round)
|
||||||
.FirstOrDefaultAsync();
|
.Select(x => new
|
||||||
|
{
|
||||||
if (retire_old != null)
|
Id = x.Id,
|
||||||
{
|
CreatedAt = x.CreatedAt,
|
||||||
var data = await _context.RetirementPeriods
|
Year = x.Year,
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
Round = x.Round,
|
||||||
.Where(x => year > 0 ? (x.Year == year) : (x.Year > 0))
|
Total = x.Total,
|
||||||
.Select(x => new
|
})
|
||||||
{
|
.ToListAsync();
|
||||||
Id = x.Id,
|
return Success(retire_old);
|
||||||
CreatedAt = x.CreatedAt,
|
|
||||||
Year = x.Year,
|
|
||||||
Round = x.Round,
|
|
||||||
Total = retire_old.Id == x.Id ? retire_old.RetirementProfiles.Count() : retire_old.RetirementProfiles.Count() - x.RetirementProfiles.Where(x => x.Remove != "pending").Count(),
|
|
||||||
}).OrderByDescending(x => x.CreatedAt)
|
|
||||||
.ToListAsync();
|
|
||||||
return Success(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -147,61 +181,40 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("profile/{type}/{year}")]
|
[HttpGet("profile/{retire_history_id}/{option}/{type}/{year}")]
|
||||||
public async Task<ActionResult<ResponseObject>> CreateProfileRetirement(string type, int year)
|
public async Task<ActionResult<ResponseObject>> CreateProfileRetirement(Guid retire_history_id, string option, string type, int year)
|
||||||
{
|
{
|
||||||
var round = 1;
|
|
||||||
var retire_old = await _context.RetirementPeriods
|
|
||||||
.Include(x => x.RetirementProfiles)
|
|
||||||
.Where(x => x.Year == year)
|
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
|
||||||
.OrderByDescending(x => x.Round)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
if (retire_old != null)
|
|
||||||
round = retire_old.Round + 1;
|
|
||||||
if (!type.Trim().ToUpper().Contains("EMPLOYEE") && !type.Trim().ToUpper().Contains("OFFICER"))
|
if (!type.Trim().ToUpper().Contains("EMPLOYEE") && !type.Trim().ToUpper().Contains("OFFICER"))
|
||||||
return Error("ประเภทพ้นราชการไม่ถูกต้อง");
|
return Error("ประเภทพ้นราชการไม่ถูกต้อง");
|
||||||
|
|
||||||
var retire = new RetirementPeriod
|
var round = 1;
|
||||||
|
var retire = await _context.RetirementPeriods
|
||||||
|
.Include(x => x.RetirementPeriodHistorys)
|
||||||
|
.Include(x => x.RetirementProfiles)
|
||||||
|
.ThenInclude(x => x.Profile)
|
||||||
|
.Where(x => x.Year == year)
|
||||||
|
.Where(x => x.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (retire == null)
|
||||||
{
|
{
|
||||||
Round = round,
|
retire = new RetirementPeriod
|
||||||
Type = type.Trim().ToUpper(),
|
|
||||||
Year = year,
|
|
||||||
CreatedUserId = FullName ?? "",
|
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
|
||||||
CreatedAt = DateTime.Now,
|
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
|
||||||
LastUpdateUserId = UserId ?? "",
|
|
||||||
LastUpdatedAt = DateTime.Now,
|
|
||||||
};
|
|
||||||
await _context.RetirementPeriods.AddAsync(retire);
|
|
||||||
if (retire_old != null)
|
|
||||||
{
|
|
||||||
var profiles = await _context.RetirementProfiles
|
|
||||||
.Where(x => x.RetirementPeriod == retire_old)
|
|
||||||
.Where(x => x.Remove == "pending")
|
|
||||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
|
||||||
.ToListAsync();
|
|
||||||
foreach (var profile in profiles)
|
|
||||||
{
|
{
|
||||||
profile.RetirementPeriod = retire;
|
Round = round,
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
TypeReport = null,
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
Type = type.Trim().ToUpper(),
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
Year = year,
|
||||||
}
|
CreatedUserId = FullName ?? "",
|
||||||
}
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
else
|
CreatedAt = DateTime.Now,
|
||||||
{
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
await _context.RetirementPeriods.AddAsync(retire);
|
||||||
var profiles = await _context.Profiles.AsQueryable()
|
var profiles = await _context.Profiles.AsQueryable()
|
||||||
// .Where(x => x.BirthDate.CalculateRetireDate().Year == year)
|
|
||||||
.Where(x => x.ProfileType.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
.Where(x => x.ProfileType.Trim().ToUpper().Contains(type.Trim().ToUpper()))
|
||||||
// .Where(x => x.CitizenId == "0000000000001")
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
// var profiles = await (from p in _context.Profiles
|
|
||||||
// where p.BirthDate.CalculateRetireDate().Year == year
|
|
||||||
// select p)
|
|
||||||
// .ToListAsync();
|
|
||||||
profiles = profiles.Where(x => x.BirthDate.CalculateRetireDate().Year == year).ToList();
|
profiles = profiles.Where(x => x.BirthDate.CalculateRetireDate().Year == year).ToList();
|
||||||
var order = 1;
|
var order = 1;
|
||||||
foreach (var profile in profiles)
|
foreach (var profile in profiles)
|
||||||
|
|
@ -222,12 +235,52 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
await _context.RetirementProfiles.AddAsync(data);
|
await _context.RetirementProfiles.AddAsync(data);
|
||||||
order++;
|
order++;
|
||||||
}
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
await GenOrderByYear(retire.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var file_name = DateTime.Now.ToString();
|
||||||
|
await _documentService.GenerateJsonFile("xxx", "/retire", file_name);
|
||||||
|
var history = new RetirementPeriodHistory
|
||||||
|
{
|
||||||
|
RetirementPeriod = retire,
|
||||||
|
Round = retire.Round,
|
||||||
|
TypeReport = retire.TypeReport,
|
||||||
|
Year = retire.Year,
|
||||||
|
Type = retire.Type,
|
||||||
|
Total = retire.RetirementProfiles.Count(),
|
||||||
|
ProfileFile = file_name,
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
await _context.RetirementPeriodHistorys.AddAsync(history);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
retire.Round = retire.Round + 1;
|
||||||
|
retire.TypeReport = option.Trim().ToUpper();
|
||||||
|
retire.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
retire.LastUpdateUserId = UserId ?? "";
|
||||||
|
retire.LastUpdatedAt = DateTime.Now;
|
||||||
|
// retire_history_id
|
||||||
|
////ดึงไฟล์json
|
||||||
|
// foreach (var retire_profile in retire.RetirementProfiles)
|
||||||
|
// {
|
||||||
|
// retire_profile.Remove = retire_profile.Remove.Trim().ToUpper().Contains("CHANGE") ? "PENDING" : retire_profile.Remove;
|
||||||
|
// retire_profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
// retire_profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
// retire_profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
// }
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.SaveChanges();
|
await _context.SaveChangesAsync();
|
||||||
var profile_new = await _context.RetirementProfiles
|
var profile_new = await _context.RetirementProfiles
|
||||||
.Where(x => x.RetirementPeriod == retire)
|
.Where(x => x.RetirementPeriod == retire)
|
||||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Order = x.Order,
|
Order = x.Order,
|
||||||
|
|
@ -265,44 +318,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpGet("{retireId:length(36)}")]
|
[HttpGet("{retireId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetProfileRetirement(Guid retireId)
|
public async Task<ActionResult<ResponseObject>> GetProfileRetirement(Guid retireId)
|
||||||
{
|
{
|
||||||
var retire = await _context.RetirementPeriods
|
var retire = await _context.RetirementPeriodHistorys
|
||||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
||||||
|
|
||||||
var retire_old = await _context.RetirementPeriods
|
return Success(retire);
|
||||||
.Where(x => x.CreatedAt < retire.CreatedAt)
|
|
||||||
.Where(x => x.Year == retire.Year)
|
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var profile = await _context.RetirementProfiles
|
|
||||||
.Where(x => !retire_old.Contains(x.RetirementPeriod))
|
|
||||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
|
||||||
.Select(x => new
|
|
||||||
{
|
|
||||||
Order = x.Order,
|
|
||||||
Id = x.Id,
|
|
||||||
Reason = x.Reason,
|
|
||||||
Remove = x.Remove,
|
|
||||||
ProfileId = x.Profile.Id,
|
|
||||||
CitizenId = x.Profile.CitizenId,
|
|
||||||
Prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name,
|
|
||||||
FullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
|
||||||
OrganizationOrganization = x.Profile.OrganizationOrganization,
|
|
||||||
Oc = x.Profile.Oc,
|
|
||||||
Position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
|
||||||
PositionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name,
|
|
||||||
PositionExecutive = x.Profile.PositionExecutive,
|
|
||||||
PosNo = x.Profile.PosNo == null ? null : x.Profile.PosNo.Name,
|
|
||||||
PositionEmployeePosition = x.Profile.PositionEmployeePosition,
|
|
||||||
PositionEmployeeLevel = x.Profile.PositionEmployeeLevel,
|
|
||||||
PositionEmployeeGroup = x.Profile.PositionEmployeeGroup,
|
|
||||||
PosNoEmployee = x.Profile.PosNoEmployee,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return Success(profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -322,10 +343,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
profile.Remove = "delete";
|
_context.RetirementProfiles.Remove(profile);
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
|
||||||
profile.LastUpdatedAt = DateTime.Now;
|
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -350,30 +368,26 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
var retire = await _context.RetirementPeriods
|
var retire = await _context.RetirementPeriods
|
||||||
|
.Include(x => x.RetirementPeriodHistorys)
|
||||||
|
.Include(x => x.RetirementProfiles)
|
||||||
|
.ThenInclude(x => x.Profile)
|
||||||
.FirstOrDefaultAsync(x => x.Id == retireId);
|
.FirstOrDefaultAsync(x => x.Id == retireId);
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
||||||
var order = 1;
|
if (retire.RetirementProfiles.Where(x => x.Profile == profile).Count() > 0)
|
||||||
var retire_old = await _context.RetirementPeriods
|
|
||||||
.Include(x => x.RetirementProfiles)
|
|
||||||
.ThenInclude(x => x.Profile)
|
|
||||||
.Where(x => x.Year == retire.Year)
|
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
|
||||||
.ToListAsync();
|
|
||||||
if (retire_old.Where(x => x.RetirementProfiles.Where(y => y.Profile == profile).Count() > 0).Count() > 0)
|
|
||||||
return Error("บุคคลนี้ได้ทำการเลือกไว้อยู่แล้ว");
|
return Error("บุคคลนี้ได้ทำการเลือกไว้อยู่แล้ว");
|
||||||
|
foreach (var retire_profile in retire.RetirementProfiles)
|
||||||
|
{
|
||||||
|
retire_profile.Order++;
|
||||||
|
retire_profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
retire_profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
retire_profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
var last_order = await _context.RetirementProfiles
|
|
||||||
.Where(x => retire_old.Contains(x.RetirementPeriod))
|
|
||||||
.Where(x => x.RetirementPeriod.Type.Trim().ToUpper().Contains(retire.Type.Trim().ToUpper()))
|
|
||||||
.OrderByDescending(x => x.Order)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
if (last_order != null)
|
|
||||||
order = last_order.Order + 1;
|
|
||||||
var data = new RetirementProfile
|
var data = new RetirementProfile
|
||||||
{
|
{
|
||||||
Order = order,
|
Order = 1,
|
||||||
Remove = "pending",
|
Remove = "PENDING",
|
||||||
RetirementPeriod = retire,
|
RetirementPeriod = retire,
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
|
|
@ -383,15 +397,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
|
||||||
_context.RetirementProfiles.Add(data);
|
_context.RetirementProfiles.Add(data);
|
||||||
_context.SaveChanges();
|
await _context.SaveChangesAsync();
|
||||||
|
// if (retire.RetirementPeriodHistorys.Count() <= 1)
|
||||||
|
// {
|
||||||
|
// await GenOrderByYear(retire.Id);
|
||||||
|
// }
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ใส่เหตุผลไม่เกษียณ
|
/// แก้ไขข้อมูลบุคคล
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
||||||
/// <param name="reason">เหตุผล</param>
|
/// <param name="reason">เหตุผล</param>
|
||||||
|
|
@ -408,7 +425,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
profile.Remove = "change";
|
profile.Remove = "EDIT";
|
||||||
profile.Reason = req.Reason;
|
profile.Reason = req.Reason;
|
||||||
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
profile.LastUpdateUserId = UserId ?? "";
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
|
@ -419,7 +436,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// View เหตุผลไม่เกษียณ
|
/// View เหตุผลแก้ไขข้อมูลบุคคล
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
/// <param name="retireProfileId">Id ผู้ใช้งานในประกาศ</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -444,7 +461,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// View รายชื่อผู้เกษียณอายุราชการในประกาศ
|
/// จัดอันดับเกษียณ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="retireId">Id ประกาศ</param>
|
/// <param name="retireId">Id ประกาศ</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -460,7 +477,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
return Error(GlobalMessages.InvalidRetirementRequest, 404);
|
||||||
|
|
||||||
await GenOrderByYear(retire.Type.Trim().ToUpper(), retire.Year);
|
await GenOrderByYear(retire.Id);
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
// "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue