ขอโอนลบคน + เพิ่มประวัติตำแหน่ง
This commit is contained in:
parent
484d2994ce
commit
e1b4f9f929
1 changed files with 12 additions and 45 deletions
|
|
@ -4175,39 +4175,7 @@ export class CommandController extends Controller {
|
|||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
@Get("testPosMaster/{profileId}")
|
||||
public async newnwenew(
|
||||
@Request() req:RequestWithUser,
|
||||
@Path() profileId:string
|
||||
){
|
||||
const profile: any = await this.profileRepository.findOne({
|
||||
where: {
|
||||
id: profileId ,
|
||||
// current_holders: {
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
// }
|
||||
},
|
||||
relations: ["current_holders","roleKeycloaks"],
|
||||
});
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
|
||||
console.log("profile.current_holders.id>>>",orgRevisionRef.id);
|
||||
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
|
||||
console.log("profile.id>>>",profile.id);
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
return new HttpSuccess(profile)
|
||||
}
|
||||
@Post("excexute/salary")
|
||||
public async newSalaryAndUpdate(
|
||||
@Request() req: RequestWithUser,
|
||||
|
|
@ -4298,21 +4266,24 @@ export class CommandController extends Controller {
|
|||
body.data.map(async (item) => {
|
||||
const profile: any = await this.profileRepository.findOne({
|
||||
where: { id: item.profileId },
|
||||
relations: ["current_holders","roleKeycloaks"],
|
||||
relations: ["roleKeycloaks"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
}
|
||||
|
||||
const orgRevision = await this.orgRevisionRepo.findOne({
|
||||
where: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
const posMaster: any = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: item.profileId,
|
||||
orgRevision:{
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
}
|
||||
},
|
||||
relations:['orgRevision']
|
||||
});
|
||||
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x:any) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
|
||||
const orgRevisionRef = posMaster?posMaster.id: null;
|
||||
|
||||
//ลบตำแหน่งที่รักษาการแทน
|
||||
const code = _command?.commandType?.code;
|
||||
|
|
@ -4341,12 +4312,8 @@ export class CommandController extends Controller {
|
|||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
if (orgRevisionRef && item.isLeave == true){
|
||||
console.log("profile.current_holders.id>>>",orgRevisionRef.id);
|
||||
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
|
||||
}
|
||||
if (item.isLeave != undefined && item.isLeave == true) {
|
||||
console.log("profile.id>>>",profile.id);
|
||||
await CreatePosMasterHistoryOfficer(orgRevisionRef, req, "DELETE");
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
}
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue