แก้ บรรจุกับโครงสร้างใหม่
This commit is contained in:
parent
eea8e1ff81
commit
06af1fc632
8 changed files with 34469 additions and 53 deletions
|
|
@ -247,6 +247,20 @@ namespace BMA.EHR.Domain.Models.Placement
|
|||
[Comment("หมายเหตุแนวนอน")]
|
||||
public string? RemarkHorizontal { get; set; }
|
||||
|
||||
|
||||
[Comment("ระดับโครงสร้าง")]
|
||||
public int? node { get; set; }
|
||||
|
||||
[Comment("id โครงสร้าง")]
|
||||
public Guid? nodeId { get; set; }
|
||||
|
||||
[Comment("id อัตรากำลัง")]
|
||||
public Guid? posmasterId { get; set; }
|
||||
|
||||
[Comment("id ตำแหน่ง")]
|
||||
public Guid? positionId { get; set; }
|
||||
|
||||
|
||||
[Comment("Id รูปโปรไฟล์")]
|
||||
public virtual Document? ProfileImg { get; set; }
|
||||
public virtual List<PlacementProfileDoc> PlacementProfileDocs { get; set; } = new List<PlacementProfileDoc>();
|
||||
|
|
|
|||
17122
BMA.EHR.Infrastructure/Migrations/20240220034009_update table placement add node.Designer.cs
generated
Normal file
17122
BMA.EHR.Infrastructure/Migrations/20240220034009_update table placement add node.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableplacementaddnode : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "node",
|
||||
table: "PlacementProfiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ระดับโครงสร้าง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "nodeId",
|
||||
table: "PlacementProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
comment: "id โครงสร้าง",
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "positionId",
|
||||
table: "PlacementProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
comment: "id ตำแหน่ง",
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "posmasterId",
|
||||
table: "PlacementProfiles",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
comment: "id อัตรากำลัง",
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "node",
|
||||
table: "PlacementProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "nodeId",
|
||||
table: "PlacementProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "positionId",
|
||||
table: "PlacementProfiles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "posmasterId",
|
||||
table: "PlacementProfiles");
|
||||
}
|
||||
}
|
||||
}
|
||||
17122
BMA.EHR.Infrastructure/Migrations/20240220034653_update table placement add node1.Designer.cs
generated
Normal file
17122
BMA.EHR.Infrastructure/Migrations/20240220034653_update table placement add node1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,42 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableplacementaddnode1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "node",
|
||||
table: "PlacementProfiles",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
comment: "ระดับโครงสร้าง",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true,
|
||||
oldComment: "ระดับโครงสร้าง")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "node",
|
||||
table: "PlacementProfiles",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ระดับโครงสร้าง",
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true,
|
||||
oldComment: "ระดับโครงสร้าง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12096,6 +12096,22 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("varchar(200)")
|
||||
.HasComment("โทรศัพท์");
|
||||
|
||||
b.Property<int?>("node")
|
||||
.HasColumnType("int")
|
||||
.HasComment("ระดับโครงสร้าง");
|
||||
|
||||
b.Property<Guid?>("nodeId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("id โครงสร้าง");
|
||||
|
||||
b.Property<Guid?>("positionId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("id ตำแหน่ง");
|
||||
|
||||
b.Property<Guid?>("posmasterId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("id อัตรากำลัง");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BloodGroupId");
|
||||
|
|
|
|||
|
|
@ -125,10 +125,15 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
ExamNumber = x.ExamNumber,
|
||||
Deferment = x.IsRelief,
|
||||
|
||||
node = x.node,
|
||||
nodeId = x.nodeId,
|
||||
posmasterId = x.posmasterId,
|
||||
positionId = x.positionId,
|
||||
|
||||
ContainDate = x.RecruitDate,
|
||||
OrganizationPositionId = x.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationPosition.Id,
|
||||
PosNoId = x.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionNumber.Id,
|
||||
PositionId = x.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionPath.Id,
|
||||
// PositionId = x.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionPath.Id,
|
||||
PositionLevelId = x.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionLevel.Id,
|
||||
PositionLineId = x.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionLine.Id,
|
||||
PositionPathSideId = x.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionPathSide.Id,
|
||||
|
|
@ -164,7 +169,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.ContainDate,
|
||||
p.OrganizationPositionId,
|
||||
p.PosNoId,
|
||||
p.PositionId,
|
||||
// p.PositionId,
|
||||
p.PositionLevelId,
|
||||
p.PositionLineId,
|
||||
p.PositionPathSideId,
|
||||
|
|
@ -173,6 +178,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.MouthSalaryAmount,
|
||||
p.PositionSalaryAmount,
|
||||
Avatar = p.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(p.Avatar),
|
||||
p.node,
|
||||
p.nodeId,
|
||||
p.posmasterId,
|
||||
p.positionId,
|
||||
};
|
||||
result.Add(_data);
|
||||
}
|
||||
|
|
@ -210,10 +219,15 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
ExamNumber = x.ExamNumber,
|
||||
Deferment = x.IsRelief,
|
||||
|
||||
node = x.node,
|
||||
nodeId = x.nodeId,
|
||||
posmasterId = x.posmasterId,
|
||||
positionId = x.positionId,
|
||||
|
||||
ContainDate = x.RecruitDate,
|
||||
OrganizationPositionId = x.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationPosition.Id,
|
||||
PosNoId = x.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionNumber.Id,
|
||||
PositionId = x.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionPath.Id,
|
||||
// PositionId = x.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionPath.Id,
|
||||
PositionLevelId = x.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionLevel.Id,
|
||||
PositionLineId = x.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionLine.Id,
|
||||
PositionPathSideId = x.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionPathSide.Id,
|
||||
|
|
@ -248,7 +262,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.ContainDate,
|
||||
p.OrganizationPositionId,
|
||||
p.PosNoId,
|
||||
p.PositionId,
|
||||
// p.PositionId,
|
||||
p.PositionLevelId,
|
||||
p.PositionLineId,
|
||||
p.PositionPathSideId,
|
||||
|
|
@ -256,6 +270,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.SalaryAmount,
|
||||
p.MouthSalaryAmount,
|
||||
p.PositionSalaryAmount,
|
||||
p.node,
|
||||
p.nodeId,
|
||||
p.posmasterId,
|
||||
p.positionId,
|
||||
};
|
||||
result.Add(_data);
|
||||
}
|
||||
|
|
@ -646,64 +664,68 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
if (person.Draft == true)
|
||||
return Error("ไม่สามารถแก้ไขข้อมูลนี้ได้เนื่องจากเผยแพร่ไปแล้ว");
|
||||
|
||||
if (req.PosNoId != null)
|
||||
{
|
||||
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
||||
if (save_posNo == null)
|
||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
person.PositionNumber = save_posNo;
|
||||
// if (req.PosNoId != null)
|
||||
// {
|
||||
// var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
||||
// if (save_posNo == null)
|
||||
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
// person.PositionNumber = save_posNo;
|
||||
|
||||
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
||||
if (save_orgPosition == null)
|
||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
person.OrganizationPosition = save_orgPosition;
|
||||
}
|
||||
// var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
||||
// if (save_orgPosition == null)
|
||||
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||
// person.OrganizationPosition = save_orgPosition;
|
||||
// }
|
||||
|
||||
if (req.PositionId != null)
|
||||
{
|
||||
var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionPathNotFound, 404);
|
||||
person.PositionPath = save;
|
||||
}
|
||||
// if (req.PositionId != null)
|
||||
// {
|
||||
// var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
||||
// if (save == null)
|
||||
// return Error(GlobalMessages.PositionPathNotFound, 404);
|
||||
// person.PositionPath = save;
|
||||
// }
|
||||
|
||||
if (req.PositionLevelId != null)
|
||||
{
|
||||
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionLevelNotFound, 404);
|
||||
person.PositionLevel = save;
|
||||
}
|
||||
// if (req.PositionLevelId != null)
|
||||
// {
|
||||
// var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
||||
// if (save == null)
|
||||
// return Error(GlobalMessages.PositionLevelNotFound, 404);
|
||||
// person.PositionLevel = save;
|
||||
// }
|
||||
|
||||
if (req.PositionLineId != null)
|
||||
{
|
||||
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionLineNotFound, 404);
|
||||
person.PositionLine = save;
|
||||
}
|
||||
// if (req.PositionLineId != null)
|
||||
// {
|
||||
// var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
||||
// if (save == null)
|
||||
// return Error(GlobalMessages.PositionLineNotFound, 404);
|
||||
// person.PositionLine = save;
|
||||
// }
|
||||
|
||||
if (req.PositionPathSideId != null)
|
||||
{
|
||||
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
||||
person.PositionPathSide = save;
|
||||
}
|
||||
// if (req.PositionPathSideId != null)
|
||||
// {
|
||||
// var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
||||
// if (save == null)
|
||||
// return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
||||
// person.PositionPathSide = save;
|
||||
// }
|
||||
|
||||
if (req.PositionTypeId != null)
|
||||
{
|
||||
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
||||
if (save == null)
|
||||
return Error(GlobalMessages.PositionTypeNotFound, 404);
|
||||
person.PositionType = save;
|
||||
}
|
||||
// if (req.PositionTypeId != null)
|
||||
// {
|
||||
// var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
||||
// if (save == null)
|
||||
// return Error(GlobalMessages.PositionTypeNotFound, 404);
|
||||
// person.PositionType = save;
|
||||
// }
|
||||
person.Draft = false;
|
||||
person.node = req.node;
|
||||
person.nodeId = req.nodeId;
|
||||
person.posmasterId = req.posmasterId;
|
||||
person.positionId = req.positionId;
|
||||
person.Amount = req.SalaryAmount;
|
||||
person.MouthSalaryAmount = req.MouthSalaryAmount;
|
||||
person.PositionSalaryAmount = req.PositionSalaryAmount;
|
||||
person.RecruitDate = req.ContainDate;
|
||||
person.ReportingDate = req.ContainDate;
|
||||
person.RecruitDate = req.ReportingDate;
|
||||
person.ReportingDate = req.ReportingDate;
|
||||
person.PlacementStatus = "PREPARE-CONTAIN";
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -1137,6 +1159,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
profile.PositionSalaryAmount = null;
|
||||
profile.RecruitDate = null;
|
||||
profile.ReportingDate = null;
|
||||
|
||||
profile.node = null;
|
||||
profile.nodeId = null;
|
||||
profile.posmasterId = null;
|
||||
profile.positionId = null;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ namespace BMA.EHR.Placement.Service.Requests
|
|||
{
|
||||
public Guid? PersonalId { get; set; }
|
||||
public DateTime? ContainDate { get; set; }
|
||||
public DateTime? ReportingDate { get; set; }
|
||||
public Guid? PosNoId { get; set; }
|
||||
public Guid? PositionId { get; set; }
|
||||
// public Guid? PositionId { get; set; }
|
||||
public Guid? PositionLevelId { get; set; }
|
||||
public Guid? PositionLineId { get; set; }
|
||||
public Guid? PositionPathSideId { get; set; }
|
||||
|
|
@ -16,5 +17,10 @@ namespace BMA.EHR.Placement.Service.Requests
|
|||
public double? SalaryAmount { get; set; }
|
||||
public double? MouthSalaryAmount { get; set; }
|
||||
public double? PositionSalaryAmount { get; set; }
|
||||
|
||||
public int? node { get; set; }
|
||||
public Guid? nodeId { get; set; }
|
||||
public Guid? posmasterId { get; set; }
|
||||
public Guid? positionId { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue