แก้ไขตำแหน่งลูกจ้าง
This commit is contained in:
parent
f8ee0ac813
commit
9bae268e14
2 changed files with 84 additions and 0 deletions
|
|
@ -888,6 +888,31 @@ export class EmployeePositionController extends Controller {
|
||||||
await this.employeePositionRepository.save(position, { data: request });
|
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);
|
return new HttpSuccess(posMaster.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2242,6 +2267,23 @@ export class EmployeePositionController extends Controller {
|
||||||
if (!dataMaster) {
|
if (!dataMaster) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
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, {
|
await this.employeePosMasterRepository.update(id, {
|
||||||
isSit: false,
|
isSit: false,
|
||||||
next_holderId: null,
|
next_holderId: null,
|
||||||
|
|
|
||||||
|
|
@ -689,6 +689,31 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
await this.employeePositionRepository.save(position, { data: request });
|
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);
|
return new HttpSuccess(posMaster.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1966,6 +1991,23 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
if (!dataMaster) {
|
if (!dataMaster) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
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, {
|
await this.employeeTempPosMasterRepository.update(id, {
|
||||||
isSit: false,
|
isSit: false,
|
||||||
next_holderId: null,
|
next_holderId: null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue