Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2025-04-21 15:00:25 +07:00
commit aaf2ad880d
8 changed files with 162 additions and 16 deletions

View file

@ -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);

View file

@ -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,

View file

@ -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,

View file

@ -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);
}

View file

@ -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 +
" ตำบล/แขวง " +
@ -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:

View file

@ -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);

View file

@ -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),

View file

@ -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,