เป็นลูกจ้างประจำ ลบออกจากโครงสร้าง
This commit is contained in:
parent
1c7180bcf2
commit
66a2d99826
2 changed files with 34 additions and 1 deletions
|
|
@ -86,6 +86,7 @@ import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHisto
|
|||
import { ProfileFamilyMother } from "../entities/ProfileFamilyMother";
|
||||
import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHistory";
|
||||
import { OrgRoot } from "../entities/OrgRoot";
|
||||
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
||||
@Route("api/v1/org/command")
|
||||
@Tags("Command")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -108,6 +109,7 @@ export class CommandController extends Controller {
|
|||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||
private positionRepository = AppDataSource.getRepository(Position);
|
||||
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
||||
private employeeTempPosMasterRepository = AppDataSource.getRepository(EmployeeTempPosMaster);
|
||||
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
|
||||
private disciplineRepository = AppDataSource.getRepository(ProfileDiscipline);
|
||||
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
|
||||
|
|
@ -5923,6 +5925,36 @@ export class CommandController extends Controller {
|
|||
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
|
||||
await this.employeePosMasterRepository.save(posMaster);
|
||||
|
||||
const clsTempPosmaster = await this.employeeTempPosMasterRepository.find({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
|
||||
if (clsTempPosmaster.length > 0) {
|
||||
const clearTempPosmaster = clsTempPosmaster.map((posMasterTemp) => ({
|
||||
...posMasterTemp,
|
||||
current_holderId: null,
|
||||
next_holderId: null,
|
||||
}));
|
||||
await this.employeeTempPosMasterRepository.save(clearTempPosmaster);
|
||||
|
||||
const checkTempPosition = await this.employeePositionRepository.find({
|
||||
where: {
|
||||
posMasterTempId: In(clearTempPosmaster.map((x) => x.id)),
|
||||
positionIsSelected: true,
|
||||
},
|
||||
});
|
||||
if (checkTempPosition.length > 0) {
|
||||
const clearTempPosition = checkTempPosition.map((positions) => ({
|
||||
...positions,
|
||||
positionIsSelected: false,
|
||||
}));
|
||||
await this.employeePositionRepository.save(clearTempPosition);
|
||||
}
|
||||
}
|
||||
|
||||
const positionNew = await this.employeePositionRepository.findOne({
|
||||
where: {
|
||||
id: profile.positionIdTemp,
|
||||
|
|
|
|||
|
|
@ -3272,12 +3272,13 @@ export class ImportDataController extends Controller {
|
|||
// // .take(1000)
|
||||
// .getManyAndCount();
|
||||
const profiles = await this.profileRepo.find({
|
||||
where: { profileSalary: { isEntry: Not(true) } },
|
||||
where: { profileSalary: { isEntry: false } },
|
||||
order: {
|
||||
citizenId: "ASC",
|
||||
},
|
||||
select: ["citizenId", "id"],
|
||||
});
|
||||
// return new HttpSuccess(profiles.length);
|
||||
// const filePath = path.join(__dirname, "salaryProfile1.csv");
|
||||
// CSV Header
|
||||
// let csvData = `"id","createdAt","createdUserId","lastUpdatedAt","lastUpdateUserId","createdFullName","lastUpdateFullName","profileId","profileEmployeeId","order","commandNo","commandYear","commandDateSign","commandDateAffect","commandCode","commandName","posNoAbb","posNo","positionName","positionType","positionLevel","positionCee","orgRoot","orgChild1","orgChild2","orgChild3","orgChild4","positionExecutive","amount","amountSpecial","positionSalaryAmount","mouthSalaryAmount","remark","dateGovernment","isGovernment","commandId","refId","isEntry"\n`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue