fix bug #2183
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m22s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m22s
This commit is contained in:
parent
6a07841763
commit
5ef5f7d4ed
2 changed files with 16 additions and 12 deletions
|
|
@ -4040,10 +4040,12 @@ export class CommandController extends Controller {
|
|||
where: { refId: item.resignId },
|
||||
relations: { command: true },
|
||||
});
|
||||
const executeDate = commandResign ? new Date(commandResign.command.commandExcecuteDate).setHours(0,0,0,0) : today;
|
||||
if (_command.status != "REPORTED"
|
||||
&& (_command.status != "WAITING" || today < executeDate)) {
|
||||
await reOrderCommandRecivesAndDelete(commandResign!.refId);
|
||||
const executeDate = commandResign
|
||||
? new Date(commandResign.command.commandExcecuteDate).setHours(0,0,0,0)
|
||||
: today;
|
||||
if (commandResign && _command.status !== "REPORTED" &&
|
||||
(_command.status !== "WAITING" || today < executeDate)) {
|
||||
await reOrderCommandRecivesAndDelete(commandResign!.id);
|
||||
}
|
||||
}
|
||||
let _commandYear = item.commandYear;
|
||||
|
|
@ -4377,6 +4379,7 @@ export class CommandController extends Controller {
|
|||
let _posNumCodeSitAbb: string = "";
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: body.data.find((x) => x.commandId)?.commandId ?? "" },
|
||||
relations: { commandType: true },
|
||||
});
|
||||
if (_command) {
|
||||
if (_command?.isBangkok?.toLocaleUpperCase() == "OFFICE") {
|
||||
|
|
@ -4438,9 +4441,11 @@ export class CommandController extends Controller {
|
|||
where: { refId: item.resignId },
|
||||
relations: { command: true },
|
||||
});
|
||||
const executeDate = commandResign ? new Date(commandResign.command.commandExcecuteDate).setHours(0,0,0,0) : today;
|
||||
if (_command.status != "REPORTED"
|
||||
&& (_command.status !== "WAITING" || today < executeDate)) {
|
||||
const executeDate = commandResign
|
||||
? new Date(commandResign.command.commandExcecuteDate).setHours(0,0,0,0)
|
||||
: today;
|
||||
if (commandResign && _command.status !== "REPORTED" &&
|
||||
(_command.status !== "WAITING" || today < executeDate)) {
|
||||
await reOrderCommandRecivesAndDelete(commandResign!.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,19 @@ import { Command } from "../entities/Command";
|
|||
|
||||
/**
|
||||
* เรียงลำดับผู้ได้รับคำสั่งใหม่หลังจากลบรายการ และอัพเดทสถานะคำสั่งถ้าไม่มีผู้ได้รับคำสั่งเหลือ
|
||||
* @param refId refId ของผู้ได้รับคำสั่ง
|
||||
* @param reciveId commandRecive.Id ของผู้ได้รับคำสั่ง
|
||||
* @param code ประเภทคำสั่ง
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export async function reOrderCommandRecivesAndDelete(
|
||||
refId: string
|
||||
reciveId: string
|
||||
): Promise<void> {
|
||||
const commandReciveRepo = AppDataSource.getRepository(CommandRecive);
|
||||
const commandRepo = AppDataSource.getRepository(Command);
|
||||
|
||||
// ค้นหาข้อมูลผู้ได้รับคำสั่งตาม refId
|
||||
// ค้นหาข้อมูลผู้ได้รับคำสั่งตาม reciveId
|
||||
const commandRecive = await commandReciveRepo.findOne({
|
||||
where: { refId: refId },
|
||||
relations: { command: true},
|
||||
where: { id: reciveId }
|
||||
});
|
||||
|
||||
if (commandRecive == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue