Merge branch 'develop' into develop-Bright
This commit is contained in:
commit
774a58bc22
2 changed files with 42 additions and 98 deletions
|
|
@ -41,7 +41,6 @@ import {
|
||||||
removeProfileInOrganize,
|
removeProfileInOrganize,
|
||||||
setLogDataDiff,
|
setLogDataDiff,
|
||||||
checkReturnCommandType,
|
checkReturnCommandType,
|
||||||
checkExceptCommandType,
|
|
||||||
checkCommandType,
|
checkCommandType,
|
||||||
removePostMasterAct,
|
removePostMasterAct,
|
||||||
logPositionIsSelectedChange,
|
logPositionIsSelectedChange,
|
||||||
|
|
@ -5629,21 +5628,11 @@ export class CommandController extends Controller {
|
||||||
_profile.lastUpdateFullName = req.user.name;
|
_profile.lastUpdateFullName = req.user.name;
|
||||||
_profile.lastUpdatedAt = new Date();
|
_profile.lastUpdatedAt = new Date();
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
|
||||||
if (exceptClear.status) {
|
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
|
||||||
} else {
|
|
||||||
if (orgRevisionRef) {
|
if (orgRevisionRef) {
|
||||||
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
|
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "OFFICER");
|
await removeProfileInOrganize(_profile.id, "OFFICER");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
retireTypeName = clearProfile.retireTypeName ?? "";
|
retireTypeName = clearProfile.retireTypeName ?? "";
|
||||||
|
|
@ -5821,15 +5810,6 @@ export class CommandController extends Controller {
|
||||||
_profile.lastUpdateFullName = req.user.name;
|
_profile.lastUpdateFullName = req.user.name;
|
||||||
_profile.lastUpdatedAt = new Date();
|
_profile.lastUpdatedAt = new Date();
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
|
||||||
if (exceptClear.status) {
|
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
|
||||||
} else {
|
|
||||||
// บันทึกประวัติก่อนลบตำแหน่ง
|
// บันทึกประวัติก่อนลบตำแหน่ง
|
||||||
const curRevision = await this.orgRevisionRepo.findOne({
|
const curRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||||
|
|
@ -5847,7 +5827,6 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
retireTypeName = clearProfile.retireTypeName ?? "";
|
retireTypeName = clearProfile.retireTypeName ?? "";
|
||||||
|
|
@ -6166,15 +6145,6 @@ export class CommandController extends Controller {
|
||||||
_profile.lastUpdateFullName = req.user.name;
|
_profile.lastUpdateFullName = req.user.name;
|
||||||
_profile.lastUpdatedAt = new Date();
|
_profile.lastUpdatedAt = new Date();
|
||||||
if (item.isLeave == true) {
|
if (item.isLeave == true) {
|
||||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
|
||||||
if (exceptClear.status) {
|
|
||||||
_profile.leaveReason = item.leaveReason ?? _null;
|
|
||||||
_profile.leaveCommandId = item.commandId ?? _null;
|
|
||||||
_profile.leaveCommandNo = `${item.commandNo}/${_commandYear}`;
|
|
||||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
|
||||||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
|
||||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
|
||||||
} else {
|
|
||||||
// บันทึกประวัติก่อนลบตำแหน่ง
|
// บันทึกประวัติก่อนลบตำแหน่ง
|
||||||
const curRevision = await this.orgRevisionRepo.findOne({
|
const curRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||||
|
|
@ -6192,7 +6162,6 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const clearProfile = await checkCommandType(String(item.commandId));
|
const clearProfile = await checkCommandType(String(item.commandId));
|
||||||
if (clearProfile.status) {
|
if (clearProfile.status) {
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ export async function removeProfileInOrganize(profileId: string, type: string) {
|
||||||
await AppDataSource.getRepository(EmployeePosMaster)
|
await AppDataSource.getRepository(EmployeePosMaster)
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.update(EmployeePosMaster)
|
.update(EmployeePosMaster)
|
||||||
.set({ current_holderId: null })
|
.set({ current_holderId: null, isSit: false })
|
||||||
.where("id = :id", { id: findProfileInEmpPosMaster?.id })
|
.where("id = :id", { id: findProfileInEmpPosMaster?.id })
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
|
@ -395,43 +395,6 @@ export async function checkReturnCommandType(commandId: string) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkExceptCommandType(commandId: string) {
|
|
||||||
const commandRepository = AppDataSource.getRepository(Command);
|
|
||||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
|
||||||
const _type = await commandRepository.findOne({
|
|
||||||
where: {
|
|
||||||
id: commandId,
|
|
||||||
},
|
|
||||||
relations: ["commandType"],
|
|
||||||
});
|
|
||||||
if (!["C-PM-25", "C-PM-26"].includes(String(_type?.commandType.code))) {
|
|
||||||
return { status: false, LeaveType: null, leaveRemark: null };
|
|
||||||
}
|
|
||||||
const _commandRecive = await commandReciveRepository.findOne({
|
|
||||||
where: { commandId: commandId },
|
|
||||||
});
|
|
||||||
|
|
||||||
let _leaveType: string = "";
|
|
||||||
switch (String(_type?.commandType.code)) {
|
|
||||||
case "C-PM-25": {
|
|
||||||
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งพักจากราชการ
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "C-PM-26": {
|
|
||||||
_leaveType = "DISCIPLINE_TEMP_SUSPEND"; //คำสั่งให้ออกจากราชการไว้ก่อน
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
_leaveType = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
status: true,
|
|
||||||
LeaveType: _leaveType,
|
|
||||||
leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function checkCommandType(commandId: string) {
|
export async function checkCommandType(commandId: string) {
|
||||||
const commandRepository = AppDataSource.getRepository(Command);
|
const commandRepository = AppDataSource.getRepository(Command);
|
||||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
const commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
||||||
|
|
@ -451,6 +414,8 @@ export async function checkCommandType(commandId: string) {
|
||||||
"C-PM-23",
|
"C-PM-23",
|
||||||
"C-PM-19",
|
"C-PM-19",
|
||||||
"C-PM-20",
|
"C-PM-20",
|
||||||
|
"C-PM-25",
|
||||||
|
"C-PM-26",
|
||||||
"C-PM-43",
|
"C-PM-43",
|
||||||
].includes(String(_type?.commandType.code))
|
].includes(String(_type?.commandType.code))
|
||||||
) {
|
) {
|
||||||
|
|
@ -500,6 +465,16 @@ export async function checkCommandType(commandId: string) {
|
||||||
_retireTypeName = "ลาออกจากราชการ";
|
_retireTypeName = "ลาออกจากราชการ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "C-PM-25": {
|
||||||
|
_leaveType = "DISCIPLINE_SUSPEND";
|
||||||
|
_retireTypeName = "พักจากราชการ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "C-PM-26": {
|
||||||
|
_leaveType = "DISCIPLINE_TEMP_SUSPEND";
|
||||||
|
_retireTypeName = "ให้ออกจากราชการไว้ก่อน";
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "C-PM-43": {
|
case "C-PM-43": {
|
||||||
_leaveType = "RETIRE_OUT_EMP";
|
_leaveType = "RETIRE_OUT_EMP";
|
||||||
_retireTypeName = "ให้ออกจากราชการ";
|
_retireTypeName = "ให้ออกจากราชการ";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue