update Retire Clear Org
This commit is contained in:
parent
0c523a55a4
commit
dcff08db6f
1 changed files with 46 additions and 0 deletions
|
|
@ -6312,4 +6312,50 @@ export class ImportDataController extends Controller {
|
||||||
}
|
}
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post("updateRetireClearOrg")
|
||||||
|
async updateRetireClearOrg(@Request() request: { user: Record<string, any> }) {
|
||||||
|
const profiles = await this.profileRepo.find({
|
||||||
|
where: {
|
||||||
|
isLeave: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const item of profiles) {
|
||||||
|
const posmaster = await this.posMasterRepo.findOne({
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: false,
|
||||||
|
orgRevisionIsDraft: true,
|
||||||
|
},
|
||||||
|
next_holderId: item.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!posmaster) continue;
|
||||||
|
posmaster.next_holderId = null;
|
||||||
|
await this.posMasterRepo.save(posmaster);
|
||||||
|
}
|
||||||
|
|
||||||
|
const profileEmps = await this.profileEmpRepo.find({
|
||||||
|
where: {
|
||||||
|
isLeave: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const item of profileEmps) {
|
||||||
|
const posmaster = await this.posMasterEmpRepo.findOne({
|
||||||
|
where: {
|
||||||
|
orgRevision: {
|
||||||
|
orgRevisionIsCurrent: false,
|
||||||
|
orgRevisionIsDraft: true,
|
||||||
|
},
|
||||||
|
next_holderId: item.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!posmaster) continue;
|
||||||
|
posmaster.next_holderId = null;
|
||||||
|
await this.posMasterEmpRepo.save(posmaster);
|
||||||
|
}
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue