#246 เสริมคำสั่ง C-PM-25,C-PM-26
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m10s

This commit is contained in:
Adisak 2026-05-29 10:12:46 +07:00
parent 521a748de1
commit 755ae992dd
2 changed files with 42 additions and 98 deletions

View file

@ -41,7 +41,6 @@ import {
removeProfileInOrganize,
setLogDataDiff,
checkReturnCommandType,
checkExceptCommandType,
checkCommandType,
removePostMasterAct,
logPositionIsSelectedChange,
@ -5629,20 +5628,10 @@ export class CommandController extends Controller {
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
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) {
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
}
await removeProfileInOrganize(_profile.id, "OFFICER");
if (orgRevisionRef) {
await CreatePosMasterHistoryOfficer(orgRevisionRef.id, req, "DELETE");
}
await removeProfileInOrganize(_profile.id, "OFFICER");
}
const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile.status) {
@ -5821,32 +5810,22 @@ export class CommandController extends Controller {
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
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({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
// บันทึกประวัติก่อนลบตำแหน่ง
const curRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
});
if (curRevision) {
const curPosMaster = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: _profile.id,
orgRevisionId: curRevision.id,
},
});
if (curRevision) {
const curPosMaster = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: _profile.id,
orgRevisionId: curRevision.id,
},
});
if (curPosMaster) {
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
}
if (curPosMaster) {
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
}
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
}
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
}
const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile.status) {
@ -6166,32 +6145,22 @@ export class CommandController extends Controller {
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
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({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
// บันทึกประวัติก่อนลบตำแหน่ง
const curRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
});
if (curRevision) {
const curPosMaster = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: _profile.id,
orgRevisionId: curRevision.id,
},
});
if (curRevision) {
const curPosMaster = await this.employeePosMasterRepository.findOne({
where: {
current_holderId: _profile.id,
orgRevisionId: curRevision.id,
},
});
if (curPosMaster) {
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
}
if (curPosMaster) {
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
}
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
}
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
}
const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile.status) {