From da6fd7a39665d99a09f5d18b353b16f50921deb3 Mon Sep 17 00:00:00 2001 From: adisak Date: Thu, 2 Apr 2026 14:18:08 +0700 Subject: [PATCH] #2387 update --- src/controllers/PositionController.ts | 3 ++- src/controllers/ProfileGovernmentController.ts | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index e3494349..75d6c2a0 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1451,7 +1451,8 @@ export class PositionController extends Controller { }), ); - if (posMaster.orgRevision?.orgRevisionIsCurrent == true) { + // ถ้าไม่ใช่ตำแหน่งนั่งทับ (isSit = false) ถึงจะอัพเดทตำแหน่งในทะเบียนประวัติ + if (posMaster.orgRevision?.orgRevisionIsCurrent == true && !posMaster.isSit) { const _position = requestBody.positions.find((p) => p.positionIsSelected == true); if (_position) { const current_holderId: any = posMaster.current_holderId; diff --git a/src/controllers/ProfileGovernmentController.ts b/src/controllers/ProfileGovernmentController.ts index dcb138df..b3238672 100644 --- a/src/controllers/ProfileGovernmentController.ts +++ b/src/controllers/ProfileGovernmentController.ts @@ -287,9 +287,10 @@ export class ProfileGovernmentHistoryController extends Controller { } } const orgLeave = _OrgLeave.filter((x: any) => x !== undefined && x !== null).join("\n"); + //posMaster?.isSit แก้ไขชั่วคราว const data = { org: record?.isLeave == false ? org : orgLeave, //สังกัด - positionField: position == null ? null : position.positionField, //สายงาน + positionField: position == null || posMaster?.isSit ? null : position.positionField, //สายงาน position: record?.position, //ตำแหน่ง posLevel: record?.posLevel == null ? null : record?.posLevel.posLevelName, //ระดับ posMasterNo: @@ -302,11 +303,11 @@ export class ProfileGovernmentHistoryController extends Controller { : null, //เลขที่ตำแหน่ง posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท posExecutive: - position == null || position.posExecutive == null + position == null || position.posExecutive == null || posMaster?.isSit ? null : position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร - positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา - positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร + positionArea: position == null || posMaster?.isSit ? null : position.positionArea, //ด้าน/สาขา + positionExecutiveField: position == null || posMaster?.isSit ? null : position.positionExecutiveField, //ด้านทางการบริหาร dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), dateRetireLaw: record?.dateRetireLaw ?? null, // govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), @@ -461,9 +462,10 @@ export class ProfileGovernmentHistoryController extends Controller { } } const orgLeave = _OrgLeave.filter((x: any) => x !== undefined && x !== null).join("\n"); + //posMaster?.isSit แก้ไขชั่วคราว const data = { org: record?.isLeave == false ? org : orgLeave, //สังกัด - positionField: position == null ? null : position.positionField, //สายงาน + positionField: position == null || posMaster?.isSit ? null : position.positionField, //สายงาน position: record?.position, //ตำแหน่ง posLevel: record?.posLevel == null ? null : record?.posLevel.posLevelName, //ระดับ posMasterNo: @@ -476,11 +478,11 @@ export class ProfileGovernmentHistoryController extends Controller { : null, //เลขที่ตำแหน่ง posType: record?.posType == null ? null : record?.posType.posTypeName, //ประเภท posExecutive: - position == null || position.posExecutive == null + position == null || position.posExecutive == null || posMaster?.isSit ? null : position.posExecutive.posExecutiveName, //ตำแหน่งทางการบริหาร - positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา - positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร + positionArea: position == null || posMaster?.isSit ? null : position.positionArea, //ด้าน/สาขา + positionExecutiveField: position == null || posMaster?.isSit ? null : position.positionExecutiveField, //ด้านทางการบริหาร dateLeave: record?.birthDate == null ? null : calculateRetireDate(record?.birthDate), dateRetireLaw: record?.dateRetireLaw ?? null, // govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),