เลือกตำแหน่งบรรจุกลับ
Some checks failed
release-dev / release-dev (push) Failing after 12s

This commit is contained in:
moss 2025-03-28 16:31:33 +07:00
parent c9ed721cc0
commit c16f364b8a
6 changed files with 20885 additions and 80 deletions

View file

@ -14,6 +14,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public string Status { get; set; } = "WAITTING";
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }
[Comment("วันที่รายงานตัว")]
public DateTime? ReportingDate { get; set; }
[Comment("เงินเดือน")]
public double? Amount { get; set; }
@ -113,6 +115,72 @@ namespace BMA.EHR.Domain.Models.Retirement
public string? posLevelNameOld { get; set; }
[Comment("ชื่อหน่วยงาน root")]
public string? root { get; set; }
[Comment("id หน่วยงาน root")]
public string? rootId { get; set; }
[Comment("id หน่วยงาน rootDna")]
public string? rootDnaId { get; set; }
[Comment("ชื่อย่อหน่วยงาน root")]
public string? rootShortName { get; set; }
[Comment("ชื่อหน่วยงาน child1")]
public string? child1 { get; set; }
[Comment("id หน่วยงาน child1")]
public string? child1Id { get; set; }
[Comment("id หน่วยงาน child1Dna")]
public string? child1DnaId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child1")]
public string? child1ShortName { get; set; }
[Comment("ชื่อหน่วยงาน child2")]
public string? child2 { get; set; }
[Comment("id หน่วยงาน child2")]
public string? child2Id { get; set; }
[Comment("id หน่วยงาน child2Dna")]
public string? child2DnaId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child2")]
public string? child2ShortName { get; set; }
[Comment("ชื่อหน่วยงาน child3")]
public string? child3 { get; set; }
[Comment("id หน่วยงาน child3")]
public string? child3Id { get; set; }
[Comment("id หน่วยงาน child3Dna")]
public string? child3DnaId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child3")]
public string? child3ShortName { get; set; }
[Comment("ชื่อหน่วยงาน child4")]
public string? child4 { get; set; }
[Comment("id หน่วยงาน child4")]
public string? child4Id { get; set; }
[Comment("id หน่วยงาน child4Dna")]
public string? child4DnaId { get; set; }
[Comment("ชื่อย่อหน่วยงาน child4")]
public string? child4ShortName { get; set; }
[Comment("ระดับโครงสร้าง")]
public int? node { get; set; }
[Comment("id โครงสร้าง")]
public Guid? nodeId { get; set; }
[Comment("id อัตรากำลัง")]
public string? posmasterId { get; set; }
[Comment("id revision")]
public string? orgRevisionId { get; set; }
[Comment("id ตำแหน่ง")]
public string? positionId { get; set; }
[Comment("สายงาน")]
public string? positionField { get; set; }
[Comment("เลขที่ตำแหน่ง")]
public int? posMasterNo { get; set; }
[Comment("ชื่อตำแหน่งในสายงาน")]
public string? position { get; set; }
[Comment("ตำแหน่งทางการบริหาร")]
public string? PositionExecutive { get; set; }
[Comment("id ประเภทตำแหน่ง")]
public string? posTypeId { get; set; }
[Comment("ชื่อประเภทตำแหน่ง")]
public string? posTypeName { get; set; }
[Comment("id ระดับตำแหน่ง")]
public string? posLevelId { get; set; }
[Comment("ชื่อระดับตำแหน่ง")]
public string? posLevelName { get; set; }
public virtual List<RetirementOtherDoc> RetirementOtherDocs { get; set; } = new List<RetirementOtherDoc>();
}
}

View file

@ -0,0 +1,424 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class update_table_retirementOther_add_position : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PositionExecutive",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ตำแหน่งทางการบริหาร")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "ReportingDate",
table: "RetirementOthers",
type: "datetime(6)",
nullable: true,
comment: "วันที่รายงานตัว");
migrationBuilder.AddColumn<string>(
name: "child1",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1DnaId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child1Dna")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1Id",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1ShortName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child2")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2DnaId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child2Dna")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2Id",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child2")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2ShortName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child2")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child3")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3DnaId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child3Dna")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3Id",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child3")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3ShortName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child3")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child4")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4DnaId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child4Dna")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4Id",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child4")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4ShortName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child4")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "node",
table: "RetirementOthers",
type: "int",
nullable: true,
comment: "ระดับโครงสร้าง");
migrationBuilder.AddColumn<Guid>(
name: "nodeId",
table: "RetirementOthers",
type: "char(36)",
nullable: true,
comment: "id โครงสร้าง",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "orgRevisionId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id revision")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posLevelId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id ระดับตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posLevelName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อระดับตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "posMasterNo",
table: "RetirementOthers",
type: "int",
nullable: true,
comment: "เลขที่ตำแหน่ง");
migrationBuilder.AddColumn<string>(
name: "posTypeId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id ประเภทตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posTypeName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อประเภทตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "position",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อตำแหน่งในสายงาน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "positionField",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "สายงาน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "positionId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id ตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posmasterId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id อัตรากำลัง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "root",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootDnaId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน rootDna")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootShortName",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PositionExecutive",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "ReportingDate",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child1",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child1DnaId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child1Id",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child1ShortName",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child2",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child2DnaId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child2Id",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child2ShortName",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child3",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child3DnaId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child3Id",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child3ShortName",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child4",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child4DnaId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child4Id",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "child4ShortName",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "node",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "nodeId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "orgRevisionId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posLevelId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posLevelName",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posMasterNo",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posTypeId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posTypeName",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "position",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "positionField",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "positionId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posmasterId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "root",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "rootDnaId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "rootId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "rootShortName",
table: "RetirementOthers");
}
}
}

View file

@ -15148,6 +15148,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("datetime(6)")
.HasComment("ดำรงตำแหน่งในระดับปัจจุบันเมื่อ");
b.Property<string>("PositionExecutive")
.HasColumnType("longtext")
.HasComment("ตำแหน่งทางการบริหาร");
b.Property<string>("PositionExecutiveOld")
.HasColumnType("longtext")
.HasComment("ตำแหน่งทางการบริหารเดิม");
@ -15176,15 +15180,31 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("datetime(6)")
.HasComment("วันที่บรรจุ");
b.Property<DateTime?>("ReportingDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่รายงานตัว");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะคำขอ");
b.Property<string>("child1")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child1");
b.Property<string>("child1DnaId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child1Dna");
b.Property<string>("child1DnaOldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child1Dna old");
b.Property<string>("child1Id")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child1");
b.Property<string>("child1Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child1 old");
@ -15193,14 +15213,30 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child1 old");
b.Property<string>("child1ShortName")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child1");
b.Property<string>("child1ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child1 old");
b.Property<string>("child2")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child2");
b.Property<string>("child2DnaId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child2Dna");
b.Property<string>("child2DnaOldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child2Dna old");
b.Property<string>("child2Id")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child2");
b.Property<string>("child2Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child2 old");
@ -15209,14 +15245,30 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child2 old");
b.Property<string>("child2ShortName")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child2");
b.Property<string>("child2ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child2 old");
b.Property<string>("child3")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child3");
b.Property<string>("child3DnaId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child3Dna");
b.Property<string>("child3DnaOldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child3Dna old");
b.Property<string>("child3Id")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child3");
b.Property<string>("child3Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child3 old");
@ -15225,14 +15277,30 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child3 old");
b.Property<string>("child3ShortName")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child3");
b.Property<string>("child3ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child3 old");
b.Property<string>("child4")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child4");
b.Property<string>("child4DnaId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child4Dna");
b.Property<string>("child4DnaOldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child4Dna old");
b.Property<string>("child4Id")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child4");
b.Property<string>("child4Old")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child4 old");
@ -15241,6 +15309,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id หน่วยงาน child4 old");
b.Property<string>("child4ShortName")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child4");
b.Property<string>("child4ShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน child4 old");
@ -15257,6 +15329,26 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("นามสกุล");
b.Property<int?>("node")
.HasColumnType("int")
.HasComment("ระดับโครงสร้าง");
b.Property<Guid?>("nodeId")
.HasColumnType("char(36)")
.HasComment("id โครงสร้าง");
b.Property<string>("orgRevisionId")
.HasColumnType("longtext")
.HasComment("id revision");
b.Property<string>("posLevelId")
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง");
b.Property<string>("posLevelName")
.HasColumnType("longtext")
.HasComment("ชื่อระดับตำแหน่ง");
b.Property<string>("posLevelNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อระดับตำแหน่ง old");
@ -15265,10 +15357,22 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง old");
b.Property<int?>("posMasterNo")
.HasColumnType("int")
.HasComment("เลขที่ตำแหน่ง");
b.Property<int?>("posMasterNoOld")
.HasColumnType("int")
.HasComment("เลขที่ตำแหน่ง old");
b.Property<string>("posTypeId")
.HasColumnType("longtext")
.HasComment("id ประเภทตำแหน่ง");
b.Property<string>("posTypeName")
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง");
b.Property<string>("posTypeNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง old");
@ -15277,6 +15381,22 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id ประเภทตำแหน่ง old");
b.Property<string>("position")
.HasColumnType("longtext")
.HasComment("ชื่อตำแหน่งในสายงาน");
b.Property<string>("positionField")
.HasColumnType("longtext")
.HasComment("สายงาน");
b.Property<string>("positionId")
.HasColumnType("longtext")
.HasComment("id ตำแหน่ง");
b.Property<string>("posmasterId")
.HasColumnType("longtext")
.HasComment("id อัตรากำลัง");
b.Property<string>("prefix")
.HasColumnType("longtext")
.HasComment("คำนำหน้า");
@ -15285,10 +15405,22 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("profile Id");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
b.Property<string>("rootDnaId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน rootDna");
b.Property<string>("rootDnaOldId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน rootDna old");
b.Property<string>("rootId")
.HasColumnType("longtext")
.HasComment("id หน่วยงาน root");
b.Property<string>("rootOld")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root old");
@ -15297,6 +15429,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id หน่วยงาน root old");
b.Property<string>("rootShortName")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน root");
b.Property<string>("rootShortNameOld")
.HasColumnType("longtext")
.HasComment("ชื่อย่อหน่วยงาน root old");

View file

@ -112,6 +112,36 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.prefix,
p.firstName,
p.lastName,
p.root,
p.rootId,
p.rootShortName,
p.child1,
p.child1Id,
p.child1ShortName,
p.child2,
p.child2Id,
p.child2ShortName,
p.child3,
p.child3Id,
p.child3ShortName,
p.child4,
p.child4Id,
p.child4ShortName,
p.orgRevisionId,
p.positionId,
p.posMasterNo,
p.position,
p.PositionExecutive,
p.positionField,
p.posTypeId,
p.posTypeName,
p.posLevelId,
p.posLevelName,
node = p.root == null ? (int?)null : (p.child1 == null ? 0 : (p.child2 == null ? 1 : (p.child3 == null ? 2 : (p.child4 == null ? 3 : 4)))),
nodeName = p.root == null ? null : (p.child1 == null ? p.root : (p.child2 == null ? p.child1 : (p.child3 == null ? p.child2 : (p.child4 == null ? p.child3 : p.child4)))),
nodeId = p.rootId == null ? null : (p.child1Id == null ? p.rootId : (p.child2Id == null ? p.child1Id : (p.child3Id == null ? p.child2Id : (p.child4Id == null ? p.child3Id : p.child4Id)))),
nodeShortName = p.rootShortName == null ? null : (p.child1ShortName == null ? p.rootShortName : (p.child2ShortName == null ? p.child1ShortName : (p.child3ShortName == null ? p.child2ShortName : (p.child4ShortName == null ? p.child3ShortName : p.child4ShortName)))),
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
@ -134,7 +164,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.Status,
p.Amount,
p.ReportingDate,
p.CreatedAt,
p.Reason,
p.MilitaryDate,
@ -144,6 +178,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.posmasterId,
p.PositionDate,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
})
@ -204,6 +239,36 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.prefix,
p.firstName,
p.lastName,
p.root,
p.rootId,
p.rootShortName,
p.child1,
p.child1Id,
p.child1ShortName,
p.child2,
p.child2Id,
p.child2ShortName,
p.child3,
p.child3Id,
p.child3ShortName,
p.child4,
p.child4Id,
p.child4ShortName,
node = p.root == null ? (int?)null : (p.child1 == null ? 0 : (p.child2 == null ? 1 : (p.child3 == null ? 2 : (p.child4 == null ? 3 : 4)))),
nodeName = p.root == null ? null : (p.child1 == null ? p.root : (p.child2 == null ? p.child1 : (p.child3 == null ? p.child2 : (p.child4 == null ? p.child3 : p.child4)))),
nodeId = p.rootId == null ? null : (p.child1Id == null ? p.rootId : (p.child2Id == null ? p.child1Id : (p.child3Id == null ? p.child2Id : (p.child4Id == null ? p.child3Id : p.child4Id)))),
nodeShortName = p.rootShortName == null ? null : (p.child1ShortName == null ? p.rootShortName : (p.child2ShortName == null ? p.child1ShortName : (p.child3ShortName == null ? p.child2ShortName : (p.child4ShortName == null ? p.child3ShortName : p.child4ShortName)))),
p.orgRevisionId,
p.positionId,
p.posMasterNo,
p.position,
p.PositionExecutive,
p.positionField,
p.posTypeId,
p.posTypeName,
p.posLevelId,
p.posLevelName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
@ -219,12 +284,20 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
nodeOld = p.rootOld == null ? (int?)null : (p.child1Old == null ? 0 : (p.child2Old == null ? 1 : (p.child3Old == null ? 2 : (p.child4Old == null ? 3 : 4)))),
nodeNameOld = p.rootOld == null ? null : (p.child1Old == null ? p.root : (p.child2Old == null ? p.child1Old : (p.child3Old == null ? p.child2Old : (p.child4Old == null ? p.child3Old : p.child4Old)))),
nodeOldId = p.rootOldId == null ? null : (p.child1OldId == null ? p.rootOldId : (p.child2OldId == null ? p.child1OldId : (p.child3OldId == null ? p.child2OldId : (p.child4OldId == null ? p.child3OldId : p.child4OldId)))),
nodeShortNameOld = p.rootShortNameOld == null ? null : (p.child1ShortNameOld == null ? p.rootShortNameOld : (p.child2ShortNameOld == null ? p.child1ShortNameOld : (p.child3ShortNameOld == null ? p.child2ShortNameOld : (p.child4ShortNameOld == null ? p.child3ShortNameOld : p.child4ShortNameOld)))),
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.Status,
p.Amount,
p.ReportingDate,
p.CreatedAt,
p.Reason,
p.MilitaryDate,
@ -238,6 +311,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.PositionExecutiveOld,
p.OrganizationOld,
p.PositionDate,
p.posmasterId,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
})
.FirstOrDefaultAsync();
@ -368,84 +442,97 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
// /// <summary>
// /// เลือกหน่วยงาน
// /// </summary>
// /// <param name="id">Id อื่นๆ</param>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpPut("position/{id:length(36)}")]
// public async Task<ActionResult<ResponseObject>> UpdatePositionRetirementOther([FromBody] PersonSelectPositionOtherRequest req, Guid id)
// {
// var uppdated = await _context.RetirementOthers
// .FirstOrDefaultAsync(x => x.Id == id);
// if (uppdated == null)
// return Error(GlobalMessages.RetirementOtherNotFound, 404);
// if (req.PosNoId != null)
// {
// var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
// if (save_posNo == null)
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
// uppdated.PositionNumber = save_posNo;
/// <summary>
/// เลือกหน่วยงาน
/// </summary>
/// <param name="id">Id อื่นๆ</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("position/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdatePositionRetirementOther([FromBody] PersonSelectPositionOtherRequest req, Guid id)
{
var uppdated = await _context.RetirementOthers
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.RetirementOtherNotFound, 404);
var apiUrl = $"{_configuration["API"]}/org/find/all";
// var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
// if (save_orgPosition == null)
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
// uppdated.OrganizationPosition = save_orgPosition;
// }
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
node = req.node,
nodeId = req.nodeId,
});
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
// if (req.PositionId != null)
// {
// var save = await _context.PositionPaths.FindAsync(req.PositionId);
// if (save == null)
// return Error(GlobalMessages.PositionPathNotFound, 404);
// uppdated.PositionPath = save;
// }
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
uppdated.root = org.result.root;
uppdated.rootId = org.result.rootId;
uppdated.rootDnaId = org.result.rootDnaId;
uppdated.rootShortName = org.result.rootShortName;
uppdated.child1 = req.node <= 0 ? null : org.result.child1;
uppdated.child1Id = req.node <= 0 ? null : org.result.child1Id;
uppdated.child1DnaId = req.node <= 0 ? null : org.result.child1DnaId;
uppdated.child1ShortName = req.node <= 0 ? null : org.result.child1ShortName;
uppdated.child2 = req.node <= 1 ? null : org.result.child2;
uppdated.child2Id = req.node <= 1 ? null : org.result.child2Id;
uppdated.child2DnaId = req.node <= 1 ? null : org.result.child2DnaId;
uppdated.child2ShortName = req.node <= 1 ? null : org.result.child2ShortName;
uppdated.child3 = req.node <= 2 ? null : org.result.child3;
uppdated.child3Id = req.node <= 2 ? null : org.result.child3Id;
uppdated.child3DnaId = req.node <= 2 ? null : org.result.child3DnaId;
uppdated.child3ShortName = req.node <= 2 ? null : org.result.child3ShortName;
uppdated.child4 = req.node <= 3 ? null : org.result.child4;
uppdated.child4Id = req.node <= 3 ? null : org.result.child4Id;
uppdated.child4DnaId = req.node <= 3 ? null : org.result.child4DnaId;
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
}
// if (req.PositionLevelId != null)
// {
// var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
// if (save == null)
// return Error(GlobalMessages.PositionLevelNotFound, 404);
// uppdated.PositionLevel = save;
// }
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = uppdated.profileId,
});
}
uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node;
uppdated.nodeId = req.nodeId;
uppdated.orgRevisionId = req.orgRevisionId;
uppdated.positionId = req.positionId;
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.positionName;
uppdated.PositionExecutive = req.posExecutiveName;
uppdated.positionField = req.positionField;
uppdated.posTypeId = req.posTypeId;
uppdated.posTypeName = req.posTypeName;
uppdated.posLevelId = req.posLevelId;
uppdated.posLevelName = req.posLevelName;
uppdated.Amount = req.Amount;
uppdated.ReportingDate = req.reportingDate;
uppdated.Status = "PENDING";
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
// if (req.PositionLineId != null)
// {
// var save = await _context.PositionLines.FindAsync(req.PositionLineId);
// if (save == null)
// return Error(GlobalMessages.PositionLineNotFound, 404);
// uppdated.PositionLine = save;
// }
// if (req.PositionPathSideId != null)
// {
// var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
// if (save == null)
// return Error(GlobalMessages.PositionPathSideNotFound, 404);
// uppdated.PositionPathSide = save;
// }
// if (req.PositionTypeId != null)
// {
// var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
// if (save == null)
// return Error(GlobalMessages.PositionTypeNotFound, 404);
// uppdated.PositionType = save;
// }
// uppdated.RecruitDate = req.RecruitDate;
// uppdated.Status = "PENDING";
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
// uppdated.LastUpdateUserId = UserId ?? "";
// uppdated.LastUpdatedAt = DateTime.Now;
// await _context.SaveChangesAsync();
// return Success();
// }
return Success();
}
/// <summary>
/// แก้ไขอื่นๆ

View file

@ -6,11 +6,29 @@ namespace BMA.EHR.Retirement.Service.Requests
public class PersonSelectPositionOtherRequest
{
public DateTime? RecruitDate { get; set; }
public Guid? PosNoId { get; set; }
public Guid? PositionId { get; set; }
public Guid? PositionLevelId { get; set; }
public Guid? PositionLineId { get; set; }
public Guid? PositionPathSideId { get; set; }
public Guid? PositionTypeId { get; set; }
// public Guid? PosNoId { get; set; }
// public Guid? PositionId { get; set; }
// public Guid? PositionLevelId { get; set; }
// public Guid? PositionLineId { get; set; }
// public Guid? PositionPathSideId { get; set; }
// public Guid? PositionTypeId { get; set; }
public double? Amount { get; set; }
public string? posmasterId { get; set; }
public Guid? personalId { get; set; }
public DateTime? reportingDate { get; set; }
public int? node { get; set; }
public Guid? nodeId { get; set; }
public string? orgRevisionId { get; set; }
public int? posMasterNo { get; set; }
public string? positionId { get; set; }
public string? positionName { get; set; }
public string? positionField { get; set; }
public string? posTypeId { get; set; }
public string? posTypeName { get; set; }
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public string? typeCommand { get; set; }
public string? posExecutiveName { get; set; }
}
}