This commit is contained in:
parent
f1c8ecf699
commit
5e52206987
2 changed files with 34 additions and 7 deletions
|
|
@ -1257,7 +1257,7 @@ export class PositionController extends Controller {
|
|||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_ORG");
|
||||
const posMaster = await this.posMasterRepository.findOne({
|
||||
relations: ["positions", "orgRevision"],
|
||||
relations: ["positions", "orgRevision", "orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
||||
where: { id: id },
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -1452,6 +1452,17 @@ export class PositionController extends Controller {
|
|||
}),
|
||||
);
|
||||
|
||||
// อัพเดท org และ posMasterNo ตลอดไม่ต้องดัก isSit
|
||||
if (posMaster.orgRevision?.orgRevisionIsCurrent == true && posMaster.current_holderId) {
|
||||
const _profile = await this.profileRepository.findOne({
|
||||
where: { id: posMaster.current_holderId },
|
||||
});
|
||||
if (_profile) {
|
||||
_profile.posMasterNo = getPosMasterNo(posMaster);
|
||||
_profile.org = getOrgFullName(posMaster);
|
||||
await this.profileRepository.save(_profile);
|
||||
}
|
||||
}
|
||||
// ถ้าไม่ใช่ตำแหน่งนั่งทับ (isSit = false) ถึงจะอัพเดทตำแหน่งในทะเบียนประวัติ
|
||||
if (posMaster.orgRevision?.orgRevisionIsCurrent == true && !posMaster.isSit) {
|
||||
const _position = requestBody.positions.find((p) => p.positionIsSelected == true);
|
||||
|
|
@ -1464,6 +1475,10 @@ export class PositionController extends Controller {
|
|||
_profile.position = _position.posDictName ?? _null;
|
||||
_profile.posTypeId = _position.posTypeId;
|
||||
_profile.posLevelId = _position.posLevelId;
|
||||
_profile.positionField = _position.posDictField ?? _null;
|
||||
_profile.posExecutive = _position.posExecutiveId ?? _null;
|
||||
_profile.positionArea = _position.posDictArea ?? _null;
|
||||
_profile.positionExecutiveField = _position.posDictExecutiveField ?? _null;
|
||||
await this.profileRepository.save(_profile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue