This commit is contained in:
adisak 2025-09-02 10:40:16 +07:00
parent 4075f5e55f
commit e7533afb31

View file

@ -3358,7 +3358,11 @@ export class CommandController extends Controller {
posMaster.current_holderId = item.profileId; posMaster.current_holderId = item.profileId;
posMaster.lastUpdatedAt = new Date(); posMaster.lastUpdatedAt = new Date();
posMaster.next_holderId = null; posMaster.next_holderId = null;
if (posMasterOld != null) {
await this.employeePosMasterRepository.save(posMasterOld);
await CreatePosMasterHistoryEmployee(posMasterOld.id, req);
}
await this.employeePosMasterRepository.save(posMaster);
const positionNew = await this.employeePositionRepository.findOne({ const positionNew = await this.employeePositionRepository.findOne({
where: { where: {
id: item.positionId, id: item.positionId,
@ -3377,12 +3381,6 @@ export class CommandController extends Controller {
await this.profileEmployeeRepository.save(profile); await this.profileEmployeeRepository.save(profile);
await this.employeePositionRepository.save(positionNew); await this.employeePositionRepository.save(positionNew);
} }
if (posMasterOld != null) {
await this.employeePosMasterRepository.save(posMasterOld);
await CreatePosMasterHistoryEmployee(posMasterOld.id, req);
}
await this.employeePosMasterRepository.save(posMaster);
await CreatePosMasterHistoryEmployee(posMaster.id, req); await CreatePosMasterHistoryEmployee(posMaster.id, req);
}), }),
); );
@ -6571,7 +6569,6 @@ export class CommandController extends Controller {
await this.profileEmployeeRepository.save(profile); await this.profileEmployeeRepository.save(profile);
await this.employeePositionRepository.save(positionNew); await this.employeePositionRepository.save(positionNew);
await CreatePosMasterHistoryEmployee(posMaster.id, req); await CreatePosMasterHistoryEmployee(posMaster.id, req);
//ลบออกคนออกจากโครงสร้างลูกจ้างชั่วคราว //ลบออกคนออกจากโครงสร้างลูกจ้างชั่วคราว
const posMasterTemp = await this.employeeTempPosMasterRepository.findOne({ const posMasterTemp = await this.employeeTempPosMasterRepository.findOne({
where: { where: {