อัตรากำลังลูกจ้างชั่วคราวเลือกคนครองแล้ว ให้ไปบันทึกที่ข้อมูลลูกจ้างชั่วคราว ตำแหน่งและสังกัด
This commit is contained in:
parent
e81ed7f778
commit
b871bbedad
1 changed files with 22 additions and 2 deletions
|
|
@ -1941,12 +1941,30 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
) {
|
) {
|
||||||
await new permission().PermissionCreate(request, "SYS_ORG_TEMP");
|
await new permission().PermissionCreate(request, "SYS_ORG_TEMP");
|
||||||
const dataMaster = await this.employeeTempPosMasterRepository.findOne({
|
const dataMaster = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: { id: requestBody.posMaster },
|
where: {
|
||||||
relations: ["positions"],
|
id: requestBody.posMaster,
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
relations: ["positions", "orgRevision", "orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
||||||
});
|
});
|
||||||
if (!dataMaster) {
|
if (!dataMaster) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
||||||
}
|
}
|
||||||
|
let _root = dataMaster.orgRoot?.orgRootName;
|
||||||
|
let _child1 = dataMaster.orgChild1?.orgChild1Name;
|
||||||
|
let _child2 = dataMaster.orgChild2?.orgChild2Name;
|
||||||
|
let _child3 = dataMaster.orgChild3?.orgChild3Name;
|
||||||
|
let _child4 = dataMaster.orgChild4?.orgChild4Name;
|
||||||
|
const Org =
|
||||||
|
(_child4 == null ? "" : _child4 + "\n") +
|
||||||
|
(_child3 == null ? "" : _child3 + "\n") +
|
||||||
|
(_child2 == null ? "" : _child2 + "\n") +
|
||||||
|
(_child1 == null ? "" : _child1 + "\n") +
|
||||||
|
(_root == null ? "" : _root);
|
||||||
|
|
||||||
dataMaster.positions.forEach(async (position) => {
|
dataMaster.positions.forEach(async (position) => {
|
||||||
if (position.id === requestBody.position) {
|
if (position.id === requestBody.position) {
|
||||||
position.positionIsSelected = true;
|
position.positionIsSelected = true;
|
||||||
|
|
@ -1958,6 +1976,8 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
profile.posLevelId = position?.posLevelId ?? _null;
|
profile.posLevelId = position?.posLevelId ?? _null;
|
||||||
profile.posTypeId = position?.posTypeId ?? _null;
|
profile.posTypeId = position?.posTypeId ?? _null;
|
||||||
profile.position = position?.positionName ?? _null;
|
profile.position = position?.positionName ?? _null;
|
||||||
|
profile.employeeOc = Org ?? _null;
|
||||||
|
profile.positionEmployeePositionId = position?.positionName ?? _null;
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue