fix issue #880 คำสั่งเลื่อนค่าจ้างลูกจ้างประจำ > ไม่แสดงรายชื่อผู้ได้รับสำเนาคำสั่ง

This commit is contained in:
Bright 2024-12-25 10:46:04 +07:00
parent 51c6d8f615
commit dcbda3b94e

View file

@ -1771,18 +1771,31 @@ export class CommandController extends Controller {
.catch(() => {});
if (requestBody.persons != undefined && requestBody.persons.length > 0) {
const posMaster = await this.posMasterRepository.find({
where: {
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
select: ["orgRootId"],
});
let posMaster: any;
if (["C-PM-36", "C-PM-37"].includes(commandCode)) {
posMaster = await this.employeePosMasterRepository.find({
where: {
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
select: ["orgRootId"],
});
}
else {
posMaster = await this.posMasterRepository.find({
where: {
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
select: ["orgRootId"],
});
}
let _posMaster: any;
if (["C-PM-38", "C-PM-40"].includes(commandCode)) {
_posMaster = await this.posMasterRepository.find({
where: {
orgRootId: In(posMaster.map((x) => x.orgRootId)),
orgRootId: In(posMaster.map((x:any) => x.orgRootId)),
orgChild1: IsNull(),
orgChild2: IsNull(),
orgChild3: IsNull(),
@ -1796,7 +1809,7 @@ export class CommandController extends Controller {
} else {
_posMaster = await this.posMasterRepository.find({
where: {
orgRootId: In(posMaster.map((x) => x.orgRootId)),
orgRootId: In(posMaster.map((x:any) => x.orgRootId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
isDirector: true,
current_holderId: Not(IsNull()),