From dcbda3b94e7d66ddf98c9d920133a678ed32d079 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 25 Dec 2024 10:46:04 +0700 Subject: [PATCH] =?UTF-8?q?fix=20issue=20#880=20=E0=B8=84=E0=B8=B3?= =?UTF-8?q?=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87=E0=B9=80=E0=B8=A5=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=99=E0=B8=84=E0=B9=88=E0=B8=B2=E0=B8=88?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=88?= =?UTF-8?q?=E0=B8=B3=20>=20=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=81=E0=B8=AA?= =?UTF-8?q?=E0=B8=94=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=8A=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B9=84=E0=B8=94?= =?UTF-8?q?=E0=B9=89=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=AA=E0=B8=B3=E0=B9=80?= =?UTF-8?q?=E0=B8=99=E0=B8=B2=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88?= =?UTF-8?q?=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 31 ++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 3c91dd85..20f7b230 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1771,18 +1771,31 @@ export class CommandController extends Controller { .catch(() => {}); if (requestBody.persons != undefined && requestBody.persons.length > 0) { - const posMaster = await this.posMasterRepository.find({ - where: { - current_holderId: In(requestBody.persons.map((x) => x.profileId)), - orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, - }, - select: ["orgRootId"], - }); + let posMaster: any; + if (["C-PM-36", "C-PM-37"].includes(commandCode)) { + posMaster = await this.employeePosMasterRepository.find({ + where: { + current_holderId: In(requestBody.persons.map((x) => x.profileId)), + orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + }, + select: ["orgRootId"], + }); + } + else { + posMaster = await this.posMasterRepository.find({ + where: { + current_holderId: In(requestBody.persons.map((x) => x.profileId)), + orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + }, + select: ["orgRootId"], + }); + } + let _posMaster: any; if (["C-PM-38", "C-PM-40"].includes(commandCode)) { _posMaster = await this.posMasterRepository.find({ where: { - orgRootId: In(posMaster.map((x) => x.orgRootId)), + orgRootId: In(posMaster.map((x:any) => x.orgRootId)), orgChild1: IsNull(), orgChild2: IsNull(), orgChild3: IsNull(), @@ -1796,7 +1809,7 @@ export class CommandController extends Controller { } else { _posMaster = await this.posMasterRepository.find({ where: { - orgRootId: In(posMaster.map((x) => x.orgRootId)), + orgRootId: In(posMaster.map((x:any) => x.orgRootId)), orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, isDirector: true, current_holderId: Not(IsNull()),