From ec14148d721e9d7e5d51cf40055cb6eb11fc1490 Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 10 Feb 2025 16:19:34 +0700 Subject: [PATCH 1/5] =?UTF-8?q?fix=20=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B8=8A=E0=B8=B1?= =?UTF-8?q?=E0=B9=89=E0=B8=99=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=A5=E0=B8=B9?= =?UTF-8?q?=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87=20(=E0=B8=82?= =?UTF-8?q?=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B8=8A=E0=B8=B1=E0=B9=89=E0=B8=99?= =?UTF-8?q?=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87?= =?UTF-8?q?=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=84=E0=B8=A3=E0=B8=9A)=20#1172?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 0fa1829a..b58136c6 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -6641,7 +6641,9 @@ export class ProfileController extends Controller { position: profile.position, leaveDate: profile.dateLeave, posMasterNo: posMaster == null ? null : posMaster.posMasterNo, - posLevelName: profile.posLevel == null ? null : profile.posLevel.posLevelName, + posLevelName: profile.posLevel == null + ? null + : `${profile.posType.posTypeShortName ?? ""} ${profile.posLevel.posLevelName ?? ""}`, posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank, posLevelId: profile.posLevel == null ? null : profile.posLevel.id, posTypeName: profile.posType == null ? null : profile.posType.posTypeName, From a7e12be51f20765e3d721f9e355b2c520d34249f Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 10 Feb 2025 17:32:19 +0700 Subject: [PATCH 2/5] =?UTF-8?q?fix=20issue=20#1175=20(=E0=B8=82=E0=B9=89?= =?UTF-8?q?=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=95=E0=B8=B1=E0=B8=A7?= =?UTF-8?q?=E0=B8=A2=E0=B9=88=E0=B8=AD=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=88=E0=B8=87=20=E0=B9=84=E0=B8=A1=E0=B9=88?= =?UTF-8?q?=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B6=E0=B8=81=E0=B8=A5?= =?UTF-8?q?=E0=B8=87=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2?= =?UTF-8?q?=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95?= =?UTF-8?q?=E0=B8=B4=E0=B8=AB=E0=B8=A5=E0=B8=B1=E0=B8=87=E0=B8=88=E0=B8=B2?= =?UTF-8?q?=E0=B8=81=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA?= =?UTF-8?q?=E0=B8=B1=E0=B9=88=E0=B8=87)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 34 ++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 438cbf37..ac850cb2 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -4707,7 +4707,37 @@ export class CommandController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } - + const _posMaster = await this.employeePosMasterRepository.findOne({ + where: { + orgRevision: { + orgRevisionIsCurrent: true, + orgRevisionIsDraft: false, + }, + current_holderId: profile.id, + }, + order: { createdAt: "DESC" }, + relations: { + orgRoot: true, + orgChild1: true, + orgChild2: true, + orgChild3: true, + orgChild4: true, + }, + }); + let orgShortName = ""; + if (_posMaster != null) { + if (_posMaster.orgChild1Id === null) { + orgShortName = _posMaster.orgRoot?.orgRootShortName; + } else if (_posMaster.orgChild2Id === null) { + orgShortName = _posMaster.orgChild1?.orgChild1ShortName; + } else if (_posMaster.orgChild3Id === null) { + orgShortName = _posMaster.orgChild2?.orgChild2ShortName; + } else if (_posMaster.orgChild4Id === null) { + orgShortName = _posMaster.orgChild3?.orgChild3ShortName; + } else { + orgShortName = _posMaster.orgChild4?.orgChild4ShortName; + } + } const dest_item = await this.salaryRepo.findOne({ where: { profileEmployeeId: item.refId }, order: { order: "DESC" }, @@ -4723,7 +4753,7 @@ export class CommandController extends Controller { commandId: item.commandId, positionSalaryAmount: item.positionSalaryAmount, mouthSalaryAmount: item.mouthSalaryAmount, - posNo: profile.posMasterNoTemp, + posNo: `${orgShortName ?? ""} ${profile.posMasterNoTemp ?? ""}`, position: profile.positionTemp, positionType: profile.posTypeNameTemp, positionLevel: profile.posLevelNameTemp, From 5edcb127f9bbaa49f9e0b40db293b1b14748a254 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 11 Feb 2025 13:14:33 +0700 Subject: [PATCH 3/5] fix --- src/controllers/CommandController.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index ac850cb2..5670d395 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -4707,15 +4707,17 @@ export class CommandController extends Controller { if (!profile) { throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); } + const orgRevision = await this.orgRevisionRepository.findOne({ + where: { + orgRevisionIsCurrent: true, + orgRevisionIsDraft: false + } + }); const _posMaster = await this.employeePosMasterRepository.findOne({ - where: { - orgRevision: { - orgRevisionIsCurrent: true, - orgRevisionIsDraft: false, - }, - current_holderId: profile.id, + where: { + orgRevisionId: orgRevision?.id, + current_holderId: profile.id }, - order: { createdAt: "DESC" }, relations: { orgRoot: true, orgChild1: true, From 7878d912b1abac442d5131c988df65f278d98b8a Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 11 Feb 2025 14:06:55 +0700 Subject: [PATCH 4/5] fix --- src/controllers/CommandController.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 5670d395..f4208e5d 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -4716,7 +4716,8 @@ export class CommandController extends Controller { const _posMaster = await this.employeePosMasterRepository.findOne({ where: { orgRevisionId: orgRevision?.id, - current_holderId: profile.id + id: profile.posmasterIdTemp + // current_holderId: profile.id }, relations: { orgRoot: true, From 86b1e55aee9a73e4e256dcdbd46a9bcf3f95ddf4 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 11 Feb 2025 19:53:28 +0700 Subject: [PATCH 5/5] =?UTF-8?q?fix=20issue=20#1184=20=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=A3=E0=B8=B1?= =?UTF-8?q?=E0=B8=9A=E0=B8=A3=E0=B8=B0=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B8=8A?= =?UTF-8?q?=E0=B8=B1=E0=B9=89=E0=B8=99=E0=B8=87=E0=B8=B2=E0=B8=99+?= =?UTF-8?q?=E0=B8=A2=E0=B9=89=E0=B8=B2=E0=B8=A2=20(=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A7=E0=B8=A2=E0=B9=88=E0=B8=AD=E0=B8=A3=E0=B8=B0=E0=B8=94?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=E0=B8=8A=E0=B8=B1=E0=B9=89=E0=B8=99=E0=B8=87?= =?UTF-8?q?=E0=B8=B2=E0=B8=99=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B8=84=E0=B8=A3=E0=B8=9A)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/PositionController.ts | 4 +++- src/controllers/ProfileController.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 913f00bc..1b1976ca 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -4383,7 +4383,9 @@ export class PositionController extends Controller { posTypeId: position.posTypeId, posTypeName: position.posType == null ? null : position.posType.posTypeName, posLevelId: position.posLevelId, - posLevelName: position.posLevel == null ? null : position.posLevel.posLevelName, + posLevelName: position.posType == null && position.posLevel == null + ? null + : `${position.posType.posTypeShortName} ${position.posLevel.posLevelName}`, // posExecutiveId: position.posExecutiveId, // posExecutiveName: // position.posExecutive == null ? null : position.posExecutive.posExecutiveName, diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index b58136c6..fca3c91b 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -6641,9 +6641,9 @@ export class ProfileController extends Controller { position: profile.position, leaveDate: profile.dateLeave, posMasterNo: posMaster == null ? null : posMaster.posMasterNo, - posLevelName: profile.posLevel == null + posLevelName: profile.posType == null && profile.posLevel == null ? null - : `${profile.posType.posTypeShortName ?? ""} ${profile.posLevel.posLevelName ?? ""}`, + : `${profile.posType.posTypeShortName} ${profile.posLevel.posLevelName}`, posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank, posLevelId: profile.posLevel == null ? null : profile.posLevel.id, posTypeName: profile.posType == null ? null : profile.posType.posTypeName,