From d823e3ac5eb822d7364236a2434258cc10c223f9 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 17 Apr 2025 17:46:36 +0700 Subject: [PATCH 1/6] =?UTF-8?q?fix=20=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A?= =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B8=9E=E0=B9=89=E0=B8=99=E0=B8=88?= =?UTF-8?q?=E0=B8=B2=E0=B8=81=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=20=E0=B8=82=E0=B8=A3=E0=B8=81.=20>>=E0=B8=94=E0=B8=B2?= =?UTF-8?q?=E0=B8=A7=E0=B8=99=E0=B9=8C=E0=B9=82=E0=B8=AB=E0=B8=A5=E0=B8=94?= =?UTF-8?q?=E0=B9=80=E0=B8=AD=E0=B8=81=E0=B8=AA=E0=B8=B2=E0=B8=A3=20?= =?UTF-8?q?=E0=B8=81=E0=B8=9E.7/=E0=B8=81=E0=B8=81.1=20=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=9A=E0=B8=9A=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=20Error?= =?UTF-8?q?=20#1400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 3b8adf81..b1264e94 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -1615,7 +1615,7 @@ export class ProfileController extends Controller { ).toLocaleString(), ) : ""; - const fullCurrentAddress = profiles + const fullCurrentAddress = profiles && profiles.currentAddress ? Extension.ToThaiNumber( profiles.currentAddress + " ตำบล/แขวง " + @@ -1627,7 +1627,7 @@ export class ProfileController extends Controller { profiles.currentZipCode, ) : ""; - const fullRegistrationAddress = profiles + const fullRegistrationAddress = profiles && profiles.registrationAddress ? Extension.ToThaiNumber( profiles.registrationAddress + " ตำบล/แขวง " + From 134f1f43ee1063c09618cb6cbe634869961e14c1 Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Thu, 17 Apr 2025 23:10:20 +0700 Subject: [PATCH 2/6] search root dna --- .../OrganizationDotnetController.ts | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index a0cf74a7..adabac98 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -639,6 +639,36 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsDraft == false && x.orgRevision?.orgRevisionIsCurrent == true, )?.orgChild4Id ?? null, + rootDnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgRoot?.ancestorDNA ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1?.ancestorDNA ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2?.ancestorDNA ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3?.ancestorDNA ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4?.ancestorDNA ?? null, commander: fullname, commanderPositionName, commanderId, @@ -965,6 +995,36 @@ export class OrganizationDotnetController extends Controller { x.orgRevision?.orgRevisionIsDraft == false && x.orgRevision?.orgRevisionIsCurrent == true, )?.orgChild4Id ?? null, + rootDnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgRoot?.ancestorDNA ?? null, + child1DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild1?.ancestorDNA ?? null, + child2DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild2?.ancestorDNA ?? null, + child3DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild3?.ancestorDNA ?? null, + child4DnaId: + profile?.current_holders?.find( + (x) => + x.orgRevision?.orgRevisionIsDraft == false && + x.orgRevision?.orgRevisionIsCurrent == true, + )?.orgChild4?.ancestorDNA ?? null, commander: fullname, commanderPositionName, commanderId, @@ -2875,6 +2935,7 @@ export class OrganizationDotnetController extends Controller { rootId: root == null ? null : root.id, root: root == null ? null : root.orgRootName, rootShortName: root == null ? null : root.orgRootShortName, + rootDnaId: root == null ? null : root.ancestorDNA, }; return new HttpSuccess(_profile); } From 9bae268e142683b70ff7304e8dfa0c306f1f842e Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Fri, 18 Apr 2025 00:05:56 +0700 Subject: [PATCH 3/6] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84?= =?UTF-8?q?=E0=B8=82=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/EmployeePositionController.ts | 42 +++++++++++++++++++ .../EmployeeTempPositionController.ts | 42 +++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index d3d70b0c..4b6ef89f 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -888,6 +888,31 @@ export class EmployeePositionController extends Controller { await this.employeePositionRepository.save(position, { data: request }); }), ); + + if (posMaster.current_holderId != null) { + const profile = await this.profileRepository.findOne({ + where: { + id: posMaster.current_holderId, + }, + }); + if (profile != null) { + const positionNew = await this.employeePositionRepository.findOne({ + where: { + // positionIsSelected: true, + posMasterId: posMaster.id, + }, + }); + if (positionNew != null) { + profile.posLevelId = positionNew.posLevelId; + profile.posTypeId = positionNew.posTypeId; + profile.position = positionNew.positionName; + profile.employeeOc = posMaster?.orgRoot?.orgRootName ?? null; + profile.positionEmployeePositionId = positionNew.positionName; + + await this.profileRepository.save(profile); + } + } + } return new HttpSuccess(posMaster.id); } @@ -2242,6 +2267,23 @@ export class EmployeePositionController extends Controller { if (!dataMaster) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้"); } + if (dataMaster.current_holderId != null) { + const profile = await this.profileRepository.findOne({ + where: { + id: dataMaster.current_holderId, + }, + }); + const _null: any = null; + if (profile != null) { + profile.posLevelId = _null; + profile.posTypeId = _null; + profile.position = _null; + profile.employeeOc = _null; + profile.positionEmployeePositionId = _null; + await this.profileRepository.save(profile); + } + } + await this.employeePosMasterRepository.update(id, { isSit: false, next_holderId: null, diff --git a/src/controllers/EmployeeTempPositionController.ts b/src/controllers/EmployeeTempPositionController.ts index 46939932..b551fa95 100644 --- a/src/controllers/EmployeeTempPositionController.ts +++ b/src/controllers/EmployeeTempPositionController.ts @@ -689,6 +689,31 @@ export class EmployeeTempPositionController extends Controller { await this.employeePositionRepository.save(position, { data: request }); }), ); + + if (posMaster.current_holderId != null) { + const profile = await this.profileRepository.findOne({ + where: { + id: posMaster.current_holderId, + }, + }); + if (profile != null) { + const positionNew = await this.employeePositionRepository.findOne({ + where: { + // positionIsSelected: true, + posMasterId: posMaster.id, + }, + }); + if (positionNew != null) { + profile.posLevelId = positionNew.posLevelId; + profile.posTypeId = positionNew.posTypeId; + profile.position = positionNew.positionName; + profile.employeeOc = posMaster?.orgRoot?.orgRootName ?? null; + profile.positionEmployeePositionId = positionNew.positionName; + + await this.profileRepository.save(profile); + } + } + } return new HttpSuccess(posMaster.id); } @@ -1966,6 +1991,23 @@ export class EmployeeTempPositionController extends Controller { if (!dataMaster) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้"); } + if (dataMaster.current_holderId != null) { + const profile = await this.profileRepository.findOne({ + where: { + id: dataMaster.current_holderId, + }, + }); + const _null: any = null; + if (profile != null) { + profile.posLevelId = _null; + profile.posTypeId = _null; + profile.position = _null; + profile.employeeOc = _null; + profile.positionEmployeePositionId = _null; + await this.profileRepository.save(profile); + } + } + await this.employeeTempPosMasterRepository.update(id, { isSit: false, next_holderId: null, From 3fcabd82c91d1aa2447a412f79a41ddea1d3db83 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 18 Apr 2025 16:09:31 +0700 Subject: [PATCH 4/6] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20noti?= =?UTF-8?q?=20(add-workflow)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/WorkflowController.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controllers/WorkflowController.ts b/src/controllers/WorkflowController.ts index 6c477858..722da33b 100644 --- a/src/controllers/WorkflowController.ts +++ b/src/controllers/WorkflowController.ts @@ -50,6 +50,7 @@ export class WorkflowController extends Controller { sysName: string; posLevelName: string; posTypeName: string; + fullName?: string|null }, ) { let profileType = "OFFICER"; @@ -199,8 +200,10 @@ export class WorkflowController extends Controller { })); await new CallAPI() .PostData(req, "/placement/noti/profiles", { - subject: `รายการถูกส่ง`, - body: `รายการถูกส่ง`, + // subject: `รายการถูกส่ง`, + // body: `รายการถูกส่ง`, + subject: `แจ้ง${workflow.name}ของ ${body.fullName}`, + body: `แจ้ง${workflow.name}ของ ${body.fullName}`, receiverUserIds: profileNow, payload: "", //แนบไฟล์ isSendMail: true, From 495d818eb3d61f664ff8ac92085cde95ef1183f9 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 18 Apr 2025 16:15:53 +0700 Subject: [PATCH 5/6] no message --- src/controllers/DevelopmentRequestController.ts | 1 + src/controllers/ProfileEditController.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/controllers/DevelopmentRequestController.ts b/src/controllers/DevelopmentRequestController.ts index 28fbef4d..b02b6bf0 100644 --- a/src/controllers/DevelopmentRequestController.ts +++ b/src/controllers/DevelopmentRequestController.ts @@ -263,6 +263,7 @@ export class DevelopmentRequestController extends Controller { sysName: "REGISTRY_IDP", posLevelName: profile.posLevel.posLevelName, posTypeName: profile.posType.posTypeName, + fullName: `${profile.prefix}${profile.firstName} ${profile.lastName}` }) .catch((error) => { console.error("Error calling API:", error); diff --git a/src/controllers/ProfileEditController.ts b/src/controllers/ProfileEditController.ts index b8cec66d..605e141f 100644 --- a/src/controllers/ProfileEditController.ts +++ b/src/controllers/ProfileEditController.ts @@ -230,6 +230,7 @@ export class ProfileEditController extends Controller { sysName: "REGISTRY_PROFILE", posLevelName: profile.posLevel.posLevelName, posTypeName: profile.posType.posTypeName, + fullName: `${profile.prefix}${profile.firstName} ${profile.lastName}` }) .catch((error) => { console.error("Error calling API:", error); From 731a8e47aa6b1cf3c6be85c4a69bed74fde2256b Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 21 Apr 2025 11:48:40 +0700 Subject: [PATCH 6/6] =?UTF-8?q?fix=20=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A?= =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B8=9E=E0=B9=89=E0=B8=99=E0=B8=88?= =?UTF-8?q?=E0=B8=B2=E0=B8=81=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=20=E0=B8=82=E0=B8=A3=E0=B8=81.=20>>=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A7=E0=B8=AD=E0=B8=B1=E0=B8=81=E0=B8=A9=E0=B8=A3=E0=B8=A2?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B9=80=E0=B8=A5=E0=B8=82=E0=B8=97=E0=B8=B5?= =?UTF-8?q?=E0=B9=88=E0=B8=97=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=81=E0=B8=AA=E0=B8=94?= =?UTF-8?q?=E0=B8=87=20=E0=B8=81=E0=B8=A3=E0=B8=93=E0=B8=B5=E0=B9=82?= =?UTF-8?q?=E0=B8=94=E0=B8=99=E0=B8=A5=E0=B8=87=E0=B9=82=E0=B8=97=E0=B8=A9?= =?UTF-8?q?=E0=B8=97=E0=B8=B2=E0=B8=87=E0=B8=A7=E0=B8=B4=E0=B8=99=E0=B8=B1?= =?UTF-8?q?=E0=B8=A2=20#1399?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 10 ++++------ src/controllers/ProfileEmployeeController.ts | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index b1264e94..815b7a0f 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -5859,12 +5859,10 @@ export class ProfileController extends Controller { _data.profileSalary[0].positionExecutive == null ? null : _data.profileSalary[0].positionExecutive, - posNo: - _data.profileSalary[0].posNoAbb == "" - ? "" - : _data.profileSalary[0].posNoAbb + _data.profileSalary[0].posNo == "" - ? "" - : _data.profileSalary[0].posNo, + posNo: + _data.profileSalary[0].posNoAbb && _data.profileSalary[0].posNo + ? _data.profileSalary[0].posNoAbb + _data.profileSalary[0].posNo + : _data.profileSalary[0].posNo || "", rootId: null, root: _data.profileSalary[0].orgRoot == null ? null : _data.profileSalary[0].orgRoot, orgRootShortName: diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 5b845a59..53ac9f1b 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -2031,12 +2031,10 @@ export class ProfileEmployeeController extends Controller { positionId: _data.positionIdTemp, posmasterId: _data.posmasterIdTemp, position: _data.position, - posNo: - _data.profileSalary[0].posNoAbb == "" - ? "" - : _data.profileSalary[0].posNoAbb + _data.profileSalary[0].posNo == "" - ? "" - : _data.profileSalary[0].posNo, + posNo: + _data.profileSalary[0].posNoAbb && _data.profileSalary[0].posNo + ? _data.profileSalary[0].posNoAbb + _data.profileSalary[0].posNo + : _data.profileSalary[0].posNo || "", employeeClass: _data.employeeClass == null ? null : _data.employeeClass, govAge: Extension.CalculateGovAge(_data.dateAppoint, 0, 0), age: Extension.CalculateAgeStrV2(_data.birthDate, 0, 0),