Merge branch 'develop' into adiDev

This commit is contained in:
Adisak 2025-09-29 13:59:41 +07:00
commit a8cbf92616

View file

@ -3466,6 +3466,7 @@ export class CommandController extends Controller {
orgChild2New?: string | null;
orgChild3New?: string | null;
orgChild4New?: string | null;
resignId?: string | null;
}[];
},
) {
@ -3530,6 +3531,19 @@ export class CommandController extends Controller {
if (code && ["C-PM-08", "C-PM-17", "C-PM-18"].includes(code)) {
removePostMasterAct(profile.id);
}
//ออกคำสั่งยกเลิกลาออกต้องอัพเดทสถานะคำสั่งลาออกเป็น CANCEL
else if (item.resignId && code && ["C-PM-41"].includes(code)) {
const commandRecive = await this.commandReciveRepository.findOne({
select: ["commandId"],
where: { refId: item.resignId },
});
if (commandRecive && commandRecive.commandId) {
await this.commandRepository.update(
{ id: commandRecive?.commandId },
{ status: "CANCEL" }
);
}
}
let _commandYear = item.commandYear;
if (item.commandYear) {
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;
@ -3796,6 +3810,7 @@ export class CommandController extends Controller {
commandCode?: string | null;
commandName?: string | null;
remark: string | null;
resignId: string | null;
}[];
},
) {
@ -3851,6 +3866,20 @@ export class CommandController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const code = _command?.commandType?.code;
//ออกคำสั่งยกเลิกลาออกต้องอัพเดทสถานะคำสั่งลาออกเป็น CANCEL
if (item.resignId && code && ["C-PM-42"].includes(code)) {
const commandRecive = await this.commandReciveRepository.findOne({
select: ["commandId"],
where: { refId: item.resignId },
});
if (commandRecive && commandRecive.commandId) {
await this.commandRepository.update(
{ id: commandRecive?.commandId },
{ status: "CANCEL" }
);
}
}
let _commandYear = item.commandYear;
if (item.commandYear) {
_commandYear = item.commandYear > 2500 ? item.commandYear : item.commandYear + 543;