Merge branch 'nice' into dev

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-09-16 14:00:56 +07:00
commit 835fd54e15
14 changed files with 415 additions and 304 deletions

View file

@ -3164,8 +3164,8 @@ export class CommandController extends Controller {
posMaster.current_holderId = item.profileId; posMaster.current_holderId = item.profileId;
posMaster.lastUpdatedAt = new Date(); posMaster.lastUpdatedAt = new Date();
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
if (posMasterOld != null) { if (posMasterOld != null) {
await this.posMasterRepository.save(posMasterOld); await this.posMasterRepository.save(posMasterOld);
await CreatePosMasterHistoryOfficer(posMasterOld.id, req); await CreatePosMasterHistoryOfficer(posMasterOld.id, req);
@ -3555,7 +3555,7 @@ export class CommandController extends Controller {
} }
}) })
if (curPosMaster && clearProfile.LeaveType != "RETIRE_OUT_EMP") { if (curPosMaster && clearProfile.LeaveType != "RETIRE_OUT_EMP") {
await CreatePosMasterHistoryOfficer(curPosMaster.id, req); await CreatePosMasterHistoryOfficer(curPosMaster.id, req, "DELETE");
} }
} }
@ -3608,8 +3608,8 @@ export class CommandController extends Controller {
} }
posMaster.current_holderId = profile.id; posMaster.current_holderId = profile.id;
posMaster.lastUpdatedAt = new Date(); posMaster.lastUpdatedAt = new Date();
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
await this.posMasterRepository.save(posMaster); await this.posMasterRepository.save(posMaster);
const positionNew = await this.positionRepository.findOne({ const positionNew = await this.positionRepository.findOne({
where: { where: {
@ -6067,8 +6067,8 @@ export class CommandController extends Controller {
posMaster.current_holderId = profile.id; posMaster.current_holderId = profile.id;
posMaster.lastUpdatedAt = new Date(); posMaster.lastUpdatedAt = new Date();
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
if (posMasterOld != null) { if (posMasterOld != null) {
await this.posMasterRepository.save(posMasterOld); await this.posMasterRepository.save(posMasterOld);
await CreatePosMasterHistoryOfficer(posMasterOld.id, req); await CreatePosMasterHistoryOfficer(posMasterOld.id, req);

View file

@ -3203,19 +3203,19 @@ export class OrganizationController extends Controller {
try { try {
// CheckQueueInProgress // CheckQueueInProgress
// console.log("🚀 ตรวจสอบว่ามีงานอยู่ในคิว"); // console.log("🚀 ตรวจสอบว่ามีงานอยู่ในคิว");
const [isBusyDraft, isBusyPublish] = await Promise.all([ const [isBusyDraft, isBusyPublish] = await Promise.all([
checkQueueInProgress(`${process.env.AMQ_QUEUE_ORG_DRAFT}`), checkQueueInProgress(`${process.env.AMQ_QUEUE_ORG_DRAFT}`),
checkQueueInProgress(`${process.env.AMQ_QUEUE_ORG}`), checkQueueInProgress(`${process.env.AMQ_QUEUE_ORG}`),
]); ]);
// console.log("✅ ตรวจสอบแล้ว Draft Busy:", isBusyDraft); // console.log("✅ ตรวจสอบแล้ว Draft Busy:", isBusyDraft);
// console.log("✅ ตรวจสอบแล้ว Publish Busy:", isBusyPublish); // console.log("✅ ตรวจสอบแล้ว Publish Busy:", isBusyPublish);
if (isBusyDraft || isBusyPublish) { if (isBusyDraft || isBusyPublish) {
// console.log("🚫 พบว่ามีงานอยู่ในคิว — error") // console.log("🚫 พบว่ามีงานอยู่ในคิว — error")
throw new HttpError( throw new HttpError(
HttpStatusCode.CONFLICT, HttpStatusCode.CONFLICT,
"ไม่สามารถดำเนินการได้ หากกำลังเผยแพร่หรือสร้างแบบร่างโครงสร้างหน่วยงาน", "ไม่สามารถดำเนินการได้ หากกำลังเผยแพร่หรือสร้างแบบร่างโครงสร้างหน่วยงาน",
); );
} }
const today = new Date(); const today = new Date();
today.setHours(0, 0, 0, 0); // Set time to the beginning of the day today.setHours(0, 0, 0, 0); // Set time to the beginning of the day
@ -7723,17 +7723,18 @@ export class OrganizationController extends Controller {
where: { where: {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
orgRoot: { isCommission: true }, orgRoot: { isCommission: true },
orgChild1Id: IsNull(),
isDirector: true, isDirector: true,
current_holderId: Not(IsNull()), current_holderId: Not(IsNull()),
posMasterActs: { statusReport: "DONE" }, // posMasterActs: { statusReport: "DONE" },
posMasterActChilds: { statusReport: "DONE" }, // posMasterActChilds: { statusReport: "DONE" },
}, },
order: { posMasterOrder: "ASC", posMasterActChilds: { posMasterOrder: "ASC" } }, order: { posMasterOrder: "ASC", posMasterActChilds: { posMasterOrder: "ASC" } },
relations: [ relations: [
"current_holder", "current_holder",
"posMasterActChilds", // "posMasterActChilds",
"posMasterActChilds.posMasterChild", // "posMasterActChilds.posMasterChild",
"posMasterActChilds.posMasterChild.current_holder", // "posMasterActChilds.posMasterChild.current_holder",
], ],
}); });
if (posMaster.length <= 0) { if (posMaster.length <= 0) {
@ -7743,6 +7744,23 @@ export class OrganizationController extends Controller {
}); });
} }
if (posMaster[0].current_holder == null) { if (posMaster[0].current_holder == null) {
const posMaster = await this.posMasterRepository.find({
where: {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
orgRoot: { isCommission: true },
orgChild1Id: IsNull(),
isDirector: true,
posMasterActs: { statusReport: "DONE" },
posMasterActChilds: { statusReport: "DONE" },
},
order: { posMasterOrder: "ASC", posMasterActChilds: { posMasterOrder: "ASC" } },
relations: [
"current_holder",
"posMasterActChilds",
"posMasterActChilds.posMasterChild",
"posMasterActChilds.posMasterChild.current_holder",
],
});
if ( if (
posMaster[0].posMasterActChilds.length <= 0 || posMaster[0].posMasterActChilds.length <= 0 ||
posMaster[0].posMasterActChilds[0].posMasterChild == null || posMaster[0].posMasterActChilds[0].posMasterChild == null ||

View file

@ -961,37 +961,42 @@ export class PositionController extends Controller {
if (!posMaster) { if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
let orgRoot: any = null; let orgRoot: any = null;
let SName: any = null; let SName: any = null;
let revisionId:any = null;
if (requestBody.orgRootId != null) if (requestBody.orgRootId != null)
orgRoot = await this.orgRootRepository.findOne({ orgRoot = await this.orgRootRepository.findOne({
where: { id: requestBody.orgRootId }, where: { id: requestBody.orgRootId },
}); });
revisionId = orgRoot?.orgRevisionId;
if (!orgRoot) { if (!orgRoot) {
let orgChild1: any = null; let orgChild1: any = null;
if (requestBody.orgChild1Id != null) if (requestBody.orgChild1Id != null)
orgChild1 = await this.child1Repository.findOne({ orgChild1 = await this.child1Repository.findOne({
where: { id: requestBody.orgChild1Id }, where: { id: requestBody.orgChild1Id },
}); });
revisionId = orgChild1?.orgRevisionId;
if (!orgChild1) { if (!orgChild1) {
let orgChild2: any = null; let orgChild2: any = null;
if (requestBody.orgChild2Id != null) if (requestBody.orgChild2Id != null)
orgChild2 = await this.child2Repository.findOne({ orgChild2 = await this.child2Repository.findOne({
where: { id: requestBody.orgChild2Id }, where: { id: requestBody.orgChild2Id },
}); });
revisionId = orgChild2?.orgRevisionId;
if (!orgChild2) { if (!orgChild2) {
let orgChild3: any = null; let orgChild3: any = null;
if (requestBody.orgChild3Id != null) if (requestBody.orgChild3Id != null)
orgChild3 = await this.child3Repository.findOne({ orgChild3 = await this.child3Repository.findOne({
where: { id: requestBody.orgChild3Id }, where: { id: requestBody.orgChild3Id },
}); });
revisionId = orgChild3?.orgRevisionId;
if (!orgChild3) { if (!orgChild3) {
let orgChild4: any = null; let orgChild4: any = null;
if (requestBody.orgChild4Id != null) if (requestBody.orgChild4Id != null)
orgChild4 = await this.child4Repository.findOne({ orgChild4 = await this.child4Repository.findOne({
where: { id: requestBody.orgChild4Id }, where: { id: requestBody.orgChild4Id },
}); });
revisionId = orgChild4?.orgRevisionId;
if (!orgChild4) { if (!orgChild4) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
} else { } else {
@ -1089,7 +1094,6 @@ export class PositionController extends Controller {
posMaster.orgRevisionId = orgRoot.orgRevisionId; posMaster.orgRevisionId = orgRoot.orgRevisionId;
SName = orgRoot.orgRootShortName; SName = orgRoot.orgRootShortName;
} }
const chk_SName0 = await this.posMasterRepository.findOne({ const chk_SName0 = await this.posMasterRepository.findOne({
where: { where: {
orgRevisionId: posMaster.orgRevisionId, orgRevisionId: posMaster.orgRevisionId,
@ -1105,7 +1109,6 @@ export class PositionController extends Controller {
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
); );
} }
const chk_SName1 = await this.posMasterRepository.findOne({ const chk_SName1 = await this.posMasterRepository.findOne({
where: { where: {
orgRevisionId: posMaster.orgRevisionId, orgRevisionId: posMaster.orgRevisionId,
@ -1121,7 +1124,6 @@ export class PositionController extends Controller {
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
); );
} }
const chk_SName2 = await this.posMasterRepository.findOne({ const chk_SName2 = await this.posMasterRepository.findOne({
where: { where: {
orgRevisionId: posMaster.orgRevisionId, orgRevisionId: posMaster.orgRevisionId,
@ -1137,7 +1139,6 @@ export class PositionController extends Controller {
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
); );
} }
const chk_SName3 = await this.posMasterRepository.findOne({ const chk_SName3 = await this.posMasterRepository.findOne({
where: { where: {
orgRevisionId: posMaster.orgRevisionId, orgRevisionId: posMaster.orgRevisionId,
@ -1153,7 +1154,6 @@ export class PositionController extends Controller {
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้", "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
); );
} }
const chk_SName4 = await this.posMasterRepository.findOne({ const chk_SName4 = await this.posMasterRepository.findOne({
where: { where: {
orgRevisionId: posMaster.orgRevisionId, orgRevisionId: posMaster.orgRevisionId,
@ -1169,9 +1169,12 @@ export class PositionController extends Controller {
); );
} }
const before = null; const before = null;
const chkRevision = await this.orgRevisionRepository.findOne({ let chkRevision:any = null;
where: { id: orgRoot.orgRevisionId }, if(revisionId){
}); chkRevision = await this.orgRevisionRepository.findOne({
where: { id: revisionId },
});
}
posMaster.createdUserId = request.user.sub; posMaster.createdUserId = request.user.sub;
posMaster.createdFullName = request.user.name; posMaster.createdFullName = request.user.name;
posMaster.lastUpdateUserId = request.user.sub; posMaster.lastUpdateUserId = request.user.sub;
@ -1423,6 +1426,8 @@ export class PositionController extends Controller {
x.positionName = x.posDictName; x.positionName = x.posDictName;
x.positionField = x.posDictField; x.positionField = x.posDictField;
x.posExecutiveId = x.posExecutiveId || null; x.posExecutiveId = x.posExecutiveId || null;
x.positionExecutiveField = x.posDictExecutiveField;
x.positionArea = x.posDictArea;
x.createdUserId = request.user.sub; x.createdUserId = request.user.sub;
x.createdFullName = request.user.name; x.createdFullName = request.user.name;
x.lastUpdateUserId = request.user.sub; x.lastUpdateUserId = request.user.sub;
@ -3639,8 +3644,8 @@ export class PositionController extends Controller {
// dataMaster.next_holderId = requestBody.profileId; // dataMaster.next_holderId = requestBody.profileId;
dataMaster.lastUpdatedAt = new Date(); dataMaster.lastUpdatedAt = new Date();
//add on //add on
dataMaster.conditionReason = _null; // dataMaster.conditionReason = _null;
dataMaster.isCondition = false; // dataMaster.isCondition = false;
//เช็คถ้า revision ปัจจุบันให้ปั๊มที่ profile //เช็คถ้า revision ปัจจุบันให้ปั๊มที่ profile
const chkRevision = await this.orgRevisionRepository.findOne({ const chkRevision = await this.orgRevisionRepository.findOne({
where: { id: dataMaster.orgRevisionId }, where: { id: dataMaster.orgRevisionId },
@ -3693,7 +3698,7 @@ export class PositionController extends Controller {
} }
if (dataMaster.orgRevision.orgRevisionIsCurrent) { if (dataMaster.orgRevision.orgRevisionIsCurrent) {
await CreatePosMasterHistoryOfficer(dataMaster.id, request); await CreatePosMasterHistoryOfficer(dataMaster.id, request, "DELETE");
} }
let _profileId: string = ""; let _profileId: string = "";
@ -3712,9 +3717,8 @@ export class PositionController extends Controller {
positionIsSelected: false, positionIsSelected: false,
}); });
}); });
if (dataMaster.orgRevision.orgRevisionIsCurrent) {
await CreatePosMasterHistoryOfficer(dataMaster.id, request);
}
// //เช็คถ้า revision ปัจจุบันให้ปั๊มที่ profile // //เช็คถ้า revision ปัจจุบันให้ปั๊มที่ profile
// const chkRevision = await this.orgRevisionRepository.findOne({ // const chkRevision = await this.orgRevisionRepository.findOne({
// where: { id: dataMaster.orgRevisionId }, // where: { id: dataMaster.orgRevisionId },
@ -4935,8 +4939,8 @@ export class PositionController extends Controller {
posMaster.current_holderId = body.profileId; posMaster.current_holderId = body.profileId;
posMaster.lastUpdatedAt = new Date(); posMaster.lastUpdatedAt = new Date();
const _null: any = null; const _null: any = null;
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
if (posMasterOld != null) { if (posMasterOld != null) {
await this.posMasterRepository.save(posMasterOld); await this.posMasterRepository.save(posMasterOld);
await CreatePosMasterHistoryOfficer(posMasterOld.id, request); await CreatePosMasterHistoryOfficer(posMasterOld.id, request);

View file

@ -86,6 +86,7 @@ import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
import { ProfileAssistance } from "../entities/ProfileAssistance"; import { ProfileAssistance } from "../entities/ProfileAssistance";
import { CommandRecive } from "../entities/CommandRecive"; import { CommandRecive } from "../entities/CommandRecive";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { getTopDegrees } from "../services/PositionService";
@Route("api/v1/org/profile") @Route("api/v1/org/profile")
@Tags("Profile") @Tags("Profile")
@Security("bearerAuth") @Security("bearerAuth")
@ -6292,7 +6293,9 @@ export class ProfileController extends Controller {
// : undefined, // : undefined,
// }) // })
.where("current_holders.orgRevisionId = :orgRevisionId", { .where("current_holders.orgRevisionId = :orgRevisionId", {
orgRevisionId: (await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true } }))?.id orgRevisionId: (
await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true } })
)?.id,
}) })
.andWhere( .andWhere(
_data.root != undefined && _data.root != null _data.root != undefined && _data.root != null
@ -8148,7 +8151,7 @@ export class ProfileController extends Controller {
salary: profile ? profile.amount : null, salary: profile ? profile.amount : null,
education: education:
profile && profile.profileEducations.length > 0 profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? await getTopDegrees(profile.profileEducations)
: "-", : "-",
statusCheckEdit: profile.statusCheckEdit, statusCheckEdit: profile.statusCheckEdit,
isEdit: permissionProflile?.isEdit ?? false, isEdit: permissionProflile?.isEdit ?? false,
@ -8345,7 +8348,7 @@ export class ProfileController extends Controller {
mouthSalaryAmount: profile ? profile.mouthSalaryAmount : null, mouthSalaryAmount: profile ? profile.mouthSalaryAmount : null,
education: education:
profile && profile.profileEducations.length > 0 profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? await getTopDegrees(profile.profileEducations)
: "", : "",
dateAppoint: profile.dateAppoint, dateAppoint: profile.dateAppoint,
avatarUrl: avatarUrl:
@ -8497,7 +8500,7 @@ export class ProfileController extends Controller {
salary: profile.amount, salary: profile.amount,
education: education:
profile && profile.profileEducations.length > 0 profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? await getTopDegrees(profile.profileEducations)
: "-", : "-",
}; };

View file

@ -39,13 +39,15 @@ export class ProfileEditController extends Controller {
@Query("pageSize") pageSize: number = 10, @Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword: string = "", @Query("keyword") keyword: string = "",
@Query("status") status: string = "", @Query("status") status: string = "",
@Query("sortBy") sortBy?: string,
@Query("descending") descending?: boolean,
) { ) {
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub }); const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
if (!profile) { if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว"); throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
} }
let [getProfileEdit, total] = await AppDataSource.getRepository(ProfileEdit) let query = await AppDataSource.getRepository(ProfileEdit)
.createQueryBuilder("ProfileEdit") .createQueryBuilder("ProfileEdit")
.leftJoinAndSelect("ProfileEdit.profile", "profile") .leftJoinAndSelect("ProfileEdit.profile", "profile")
.where((qb) => { .where((qb) => {
@ -74,9 +76,18 @@ export class ProfileEditController extends Controller {
}), }),
) )
.orderBy("ProfileEdit.createdAt", "DESC") .orderBy("ProfileEdit.createdAt", "DESC")
.skip((page - 1) * pageSize)
.take(pageSize) if (sortBy) {
.getManyAndCount(); query = query.orderBy(
`ProfileEdit.${sortBy}`,
descending ? "DESC" : "ASC"
);
}
const [getProfileEdit, total] = await query
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
const _data = getProfileEdit.map((item) => ({ const _data = getProfileEdit.map((item) => ({
id: item.id, id: item.id,

View file

@ -78,6 +78,7 @@ import { ProfileAssistance } from "../entities/ProfileAssistance";
import { ProfileChangeName } from "../entities/ProfileChangeName"; import { ProfileChangeName } from "../entities/ProfileChangeName";
import { ProfileChildren } from "../entities/ProfileChildren"; import { ProfileChildren } from "../entities/ProfileChildren";
import { ProfileDuty } from "../entities/ProfileDuty"; import { ProfileDuty } from "../entities/ProfileDuty";
import { getTopDegrees } from "../services/PositionService";
@Route("api/v1/org/profile-employee") @Route("api/v1/org/profile-employee")
@Tags("ProfileEmployee") @Tags("ProfileEmployee")
@Security("bearerAuth") @Security("bearerAuth")
@ -1107,14 +1108,14 @@ export class ProfileEmployeeController extends Controller {
: null, : null,
disciplineDetail: item.detail ?? null, disciplineDetail: item.detail ?? null,
refNo: Extension.ToThaiNumber(item.refCommandNo) ?? null, refNo: Extension.ToThaiNumber(item.refCommandNo) ?? null,
level: item.level ?? "" level: item.level ?? "",
})) }))
: [ : [
{ {
disciplineYear: "-", disciplineYear: "-",
disciplineDetail: "-", disciplineDetail: "-",
refNo: "-", refNo: "-",
level: "-" level: "-",
}, },
]; ];
@ -1164,7 +1165,9 @@ export class ProfileEmployeeController extends Controller {
salary: salary:
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null, item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
special: special:
item.amountSpecial != null ? Extension.ToThaiNumber(item.amountSpecial.toLocaleString()) : null, item.amountSpecial != null
? Extension.ToThaiNumber(item.amountSpecial.toLocaleString())
: null,
rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null, rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null, refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
positionLevel: item.positionLevel positionLevel: item.positionLevel
@ -1314,7 +1317,7 @@ export class ProfileEmployeeController extends Controller {
"profileLeave.dateLeaveEnd AS dateLeaveEnd", "profileLeave.dateLeaveEnd AS dateLeaveEnd",
"profileLeave.leaveDays AS leaveDays", "profileLeave.leaveDays AS leaveDays",
"profileLeave.reason AS reason", "profileLeave.reason AS reason",
"leaveType.name as name" "leaveType.name as name",
]) ])
.where("profileLeave.profileEmployeeId = :profileId", { profileId: id }) .where("profileLeave.profileEmployeeId = :profileId", { profileId: id })
.andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] }) .andWhere("leaveType.code IN (:...codes)", { codes: ["LV-008", "LV-009", "LV-010"] })
@ -1324,10 +1327,12 @@ export class ProfileEmployeeController extends Controller {
const leaves2 = const leaves2 =
leave2_raw.length > 0 leave2_raw.length > 0
? leave2_raw.map((item) => ({ ? leave2_raw.map((item) => ({
date: item.dateLeaveStart && item.dateLeaveEnd date:
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) + " - " item.dateLeaveStart && item.dateLeaveEnd
+ Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd)) ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveStart)) +
: "-", " - " +
Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateLeaveEnd))
: "-",
type: item.name || "-", type: item.name || "-",
leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "-", leaveDays: item.leaveDays ? Extension.ToThaiNumber(item.leaveDays.toString()) : "-",
reason: item.reason || "-", reason: item.reason || "-",
@ -1389,24 +1394,25 @@ export class ProfileEmployeeController extends Controller {
]; ];
const profileHistory = await this.profileHistoryRepo.find({ const profileHistory = await this.profileHistoryRepo.find({
where: { profileEmployeeId: id }, where: { profileEmployeeId: id },
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
}); });
const history = profileHistory.length > 0 const history =
? profileHistory.map(item => ({ profileHistory.length > 0
birthDateOld: item.birthDateOld ? profileHistory.map((item) => ({
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.birthDateOld)) birthDateOld: item.birthDateOld
: "", ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.birthDateOld))
birthDate: item.birthDate : "",
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.birthDate)) birthDate: item.birthDate
: "", ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.birthDate))
})) : "",
: [ }))
{ : [
birthDateOld: "-", {
birthDate: "-", birthDateOld: "-",
} birthDate: "-",
] },
];
const position_raw = await this.salaryRepo.find({ const position_raw = await this.salaryRepo.find({
where: { where: {
@ -1555,15 +1561,16 @@ export class ProfileEmployeeController extends Controller {
: "", : "",
pointSum: item.pointSum ? Extension.ToThaiNumber(item.pointSum.toString()) : "", pointSum: item.pointSum ? Extension.ToThaiNumber(item.pointSum.toString()) : "",
pointSumTh: item.pointSum ? Extension.textPoint(item.pointSum) : "", pointSumTh: item.pointSum ? Extension.textPoint(item.pointSum) : "",
level: item.pointSum < 60.00 level:
? "ต้องปรับปรุง (คะแนนต่ำกว่าร้อยละ ๖๐.)" item.pointSum < 60.0
: item.pointSum <= 69.99 && item.pointSum >= 60.00 ? "ต้องปรับปรุง (คะแนนต่ำกว่าร้อยละ ๖๐.)"
? "พอใช้ (คะแนนร้อยละ ๖๐. - ๖๙.๙๙)" : item.pointSum <= 69.99 && item.pointSum >= 60.0
: item.pointSum <= 79.99 && item.pointSum >= 70.00 ? "พอใช้ (คะแนนร้อยละ ๖๐. - ๖๙.๙๙)"
? "ดี (คะแนนร้อยละ ๗๐. - ๗๙.๙๙)" : item.pointSum <= 79.99 && item.pointSum >= 70.0
: item.pointSum <= 89.99 && item.pointSum >= 80.00 ? "ดี (คะแนนร้อยละ ๗๐. - ๗๙.๙๙)"
? "ดีมาก (คะแนนร้อยละ ๘๐. - ๘๙.๙๙)" : item.pointSum <= 89.99 && item.pointSum >= 80.0
: "ดีเด่น (คะแนนร้อยละ ๙๐. ขึ้นไป)" ? "ดีมาก (คะแนนร้อยละ ๘๐. - ๘๙.๙๙)"
: "ดีเด่น (คะแนนร้อยละ ๙๐. ขึ้นไป)",
})) }))
: [ : [
{ {
@ -4016,22 +4023,24 @@ export class ProfileEmployeeController extends Controller {
}, },
) { ) {
// ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ // ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
let _system:string ="SYS_REGISTRY_EMP"; let _system: string = "SYS_REGISTRY_EMP";
if(body.system) if (body.system) _system = body.system;
_system = body.system;
let _data = await new permission().PermissionOrgList(request, _system); let _data = await new permission().PermissionOrgList(request, _system);
const findRevision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true } }); const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
if (!findRevision) { if (!findRevision) {
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision"); throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
} }
let queryLike = "1=1" let queryLike = "1=1";
switch (body.fieldName) { switch (body.fieldName) {
case "citizenId": case "citizenId":
queryLike = "profile.citizenId LIKE :keyword"; queryLike = "profile.citizenId LIKE :keyword";
break; break;
case "fullName": case "fullName":
queryLike = "CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword"; queryLike =
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
break; break;
case "position": case "position":
@ -4039,7 +4048,7 @@ export class ProfileEmployeeController extends Controller {
break; break;
case "posNo": case "posNo":
queryLike = ` queryLike = `
CASE CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, " ", current_holders.posMasterNo)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", current_holders.posMasterNo)
@ -4063,7 +4072,7 @@ export class ProfileEmployeeController extends Controller {
break; break;
default: default:
queryLike = "1=1" queryLike = "1=1";
break; break;
} }
@ -5608,9 +5617,10 @@ export class ProfileEmployeeController extends Controller {
posNo: orgRevisionRef?.posMasterNo, posNo: orgRevisionRef?.posMasterNo,
positionExecutive: "", positionExecutive: "",
positionType: profile.posType?.posTypeName, positionType: profile.posType?.posTypeName,
positionLevel: profile.posType && profile.posLevel positionLevel:
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}` profile.posType && profile.posLevel
: "", ? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
: "",
amountSpecial: profile.amountSpecial, amountSpecial: profile.amountSpecial,
orgRoot: orgRootRef?.orgRootName, orgRoot: orgRootRef?.orgRootName,
orgChild1: orgChild1Ref?.orgChild1Name, orgChild1: orgChild1Ref?.orgChild1Name,
@ -6366,7 +6376,7 @@ export class ProfileEmployeeController extends Controller {
salary: profile.amount, salary: profile.amount,
education: education:
profile && profile.profileEducations.length > 0 profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? await getTopDegrees(profile.profileEducations)
: "-", : "-",
statusCheckEdit: profile.statusCheckEdit, statusCheckEdit: profile.statusCheckEdit,
isEdit: permissionProflile?.isEdit ?? false, isEdit: permissionProflile?.isEdit ?? false,

View file

@ -68,6 +68,7 @@ import permission from "../interfaces/permission";
import axios from "axios"; import axios from "axios";
import { deleteUser } from "../keycloak"; import { deleteUser } from "../keycloak";
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory"; import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
import { getTopDegrees } from "../services/PositionService";
@Route("api/v1/org/profile-temp") @Route("api/v1/org/profile-temp")
@Tags("ProfileEmployee") @Tags("ProfileEmployee")
@Security("bearerAuth") @Security("bearerAuth")
@ -688,7 +689,9 @@ export class ProfileEmployeeTempController extends Controller {
Salary: Salary:
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null, item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
Special: Special:
item.amountSpecial != null ? Extension.ToThaiNumber(item.amountSpecial.toLocaleString()) : null, item.amountSpecial != null
? Extension.ToThaiNumber(item.amountSpecial.toLocaleString())
: null,
Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null, Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null, RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
PositionLevel: PositionLevel:
@ -1142,8 +1145,8 @@ export class ProfileEmployeeTempController extends Controller {
{ {
statusTemp: "PENDING", statusTemp: "PENDING",
type: "TEMP", type: "TEMP",
keycloak: request.user.sub keycloak: request.user.sub,
} },
) )
.getManyAndCount(); .getManyAndCount();
const data = await Promise.all( const data = await Promise.all(
@ -1510,15 +1513,12 @@ export class ProfileEmployeeTempController extends Controller {
} else if (searchField == "position") { } else if (searchField == "position") {
queryLike = "profileEmployee.position LIKE :keyword"; queryLike = "profileEmployee.position LIKE :keyword";
} }
let _conditionAll = let _conditionAll = `current_holderTemps.orgRootId is null AND current_holderTemps.orgChild1Id is null AND
`current_holderTemps.orgRootId is null AND current_holderTemps.orgChild1Id is null AND
current_holderTemps.orgChild2Id is null AND current_holderTemps.orgChild3Id is null AND current_holderTemps.orgChild2Id is null AND current_holderTemps.orgChild3Id is null AND
current_holderTemps.orgChild4Id is null AND profileEmployee.createdUserId = :keycloak AND current_holderTemps.orgChild4Id is null AND profileEmployee.createdUserId = :keycloak AND
profileEmployee.employeeClass = :type` profileEmployee.employeeClass = :type`;
let _conditionFullname= let _conditionFullname = `CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword`;
`CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword` let _conditionCitizenId = `profileEmployee.citizenId LIKE :keyword`;
let _conditionCitizenId =
`profileEmployee.citizenId LIKE :keyword`
const findRevision = await this.orgRevisionRepo.findOne({ const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });
@ -1611,42 +1611,29 @@ export class ProfileEmployeeTempController extends Controller {
keyword2: `${posLevel}`, keyword2: `${posLevel}`,
}, },
) )
.andWhere( .andWhere("profileEmployee.employeeClass = :type", {
"profileEmployee.employeeClass = :type", { type: type ? type.trim().toLocaleUpperCase() : "TEMP",
type: type ? type.trim().toLocaleUpperCase() : "TEMP" })
}
)
.orWhere( .orWhere(
new Brackets((qb) => { new Brackets((qb) => {
if (!searchKeyword) { if (!searchKeyword) {
qb.andWhere( qb.andWhere(_conditionAll, {
_conditionAll, keycloak: request.user.sub,
{ type: type ? type.trim().toLocaleUpperCase() : "TEMP",
keycloak: request.user.sub, });
type: type ? type.trim().toLocaleUpperCase() : "TEMP" } else {
}
)
}
else {
if (searchField != "citizenId") { if (searchField != "citizenId") {
qb.andWhere( qb.andWhere(`${_conditionAll} AND ${_conditionFullname}`, {
`${_conditionAll} AND ${_conditionFullname}`,
{
keyword: `%${searchKeyword}%`, keyword: `%${searchKeyword}%`,
keycloak: request.user.sub, keycloak: request.user.sub,
type: type ? type.trim().toLocaleUpperCase() : "TEMP" type: type ? type.trim().toLocaleUpperCase() : "TEMP",
}, });
) } else {
} qb.andWhere(`${_conditionAll} AND ${_conditionCitizenId}`, {
else { keyword: `%${searchKeyword}%`,
qb.andWhere( keycloak: request.user.sub,
`${_conditionAll} AND ${_conditionCitizenId}`, type: type ? type.trim().toLocaleUpperCase() : "TEMP",
{ });
keyword: `%${searchKeyword}%`,
keycloak: request.user.sub,
type: type ? type.trim().toLocaleUpperCase() : "TEMP"
},
)
} }
} }
}), }),
@ -1660,18 +1647,20 @@ export class ProfileEmployeeTempController extends Controller {
_data.current_holderTemps.length == 0 _data.current_holderTemps.length == 0
? null ? null
: _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null &&
_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 != _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
null ?.orgChild4 != null
? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${_data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${_data.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null &&
_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild3 != null ?.orgChild3 != null
? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) !=
null &&
_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild2 != null ?.orgChild2 != null
? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) !=
null &&
_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) _data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild1 != null ?.orgChild1 != null
? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${_data.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
@ -1844,46 +1833,46 @@ export class ProfileEmployeeTempController extends Controller {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
}, },
) )
.orWhere( .orWhere(
requestBody.keyword != null && requestBody.keyword != "" requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.firstName LIKE :keyword" ? "profileEmployee.firstName LIKE :keyword"
: "1=1", : "1=1",
{ {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
}, },
) )
.orWhere( .orWhere(
requestBody.keyword != null && requestBody.keyword != "" requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.lastName LIKE :keyword" ? "profileEmployee.lastName LIKE :keyword"
: "1=1", : "1=1",
{ {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
}, },
) )
.orWhere( .orWhere(
requestBody.keyword != null && requestBody.keyword != "" requestBody.keyword != null && requestBody.keyword != ""
? "CONCAT(profileEmployee.prefix,profileEmployee.firstName,' ',profileEmployee.lastName) LIKE :keyword" ? "CONCAT(profileEmployee.prefix,profileEmployee.firstName,' ',profileEmployee.lastName) LIKE :keyword"
: "1=1", : "1=1",
{ {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
}, },
) )
.orWhere( .orWhere(
requestBody.keyword != null && requestBody.keyword != "" requestBody.keyword != null && requestBody.keyword != ""
? "CONCAT(profileEmployee.firstName,' ',profileEmployee.lastName) LIKE :keyword" ? "CONCAT(profileEmployee.firstName,' ',profileEmployee.lastName) LIKE :keyword"
: "1=1", : "1=1",
{ {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
}, },
) )
.orWhere( .orWhere(
requestBody.keyword != null && requestBody.keyword != "" requestBody.keyword != null && requestBody.keyword != ""
? "profileEmployee.citizenId LIKE :keyword" ? "profileEmployee.citizenId LIKE :keyword"
: "1=1", : "1=1",
{ {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
}, },
); );
// .orWhere( // .orWhere(
// requestBody.keyword != null && requestBody.keyword != "" // requestBody.keyword != null && requestBody.keyword != ""
// ? "profileEmployee.position LIKE :keyword" // ? "profileEmployee.position LIKE :keyword"
@ -2198,15 +2187,16 @@ export class ProfileEmployeeTempController extends Controller {
}, },
) { ) {
// ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ // ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
let _system:string ="SYS_REGISTRY_TEMP"; let _system: string = "SYS_REGISTRY_TEMP";
if(body.system) if (body.system) _system = body.system;
_system = body.system;
let _data = await new permission().PermissionOrgList(request, _system); let _data = await new permission().PermissionOrgList(request, _system);
const findRevision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true } }); const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
if (!findRevision) { if (!findRevision) {
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision"); throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
} }
let queryLike = "1=1" let queryLike = "1=1";
switch (body.fieldName) { switch (body.fieldName) {
case "citizenId": case "citizenId":
queryLike = "profile.citizenId LIKE :keyword"; queryLike = "profile.citizenId LIKE :keyword";
@ -2221,11 +2211,12 @@ export class ProfileEmployeeTempController extends Controller {
break; break;
case "fullName": case "fullName":
queryLike = "CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword"; queryLike =
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
break; break;
default: default:
queryLike = "1=1" queryLike = "1=1";
break; break;
} }
@ -2298,18 +2289,20 @@ export class ProfileEmployeeTempController extends Controller {
item.current_holderTemps.length == 0 item.current_holderTemps.length == 0
? null ? null
: item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4 != item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
null ?.orgChild4 != null
? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 != item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
null ?.orgChild3 != null
? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) !=
null &&
item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild2 != null ?.orgChild2 != null
? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && : item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) !=
null &&
item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild1 != null ?.orgChild1 != null
? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
@ -2323,7 +2316,8 @@ export class ProfileEmployeeTempController extends Controller {
const root = const root =
item.current_holderTemps.length == 0 || item.current_holderTemps.length == 0 ||
(item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null && (item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id) != null &&
item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot == null) item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot ==
null)
? null ? null
: item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot; : item.current_holderTemps.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
@ -3458,9 +3452,10 @@ export class ProfileEmployeeTempController extends Controller {
posNo: orgRevisionRef?.posMasterNo, posNo: orgRevisionRef?.posMasterNo,
positionExecutive: "", positionExecutive: "",
positionType: profile.posType?.posTypeName, positionType: profile.posType?.posTypeName,
positionLevel: profile.posType && profile.posLevel positionLevel:
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}` profile.posType && profile.posLevel
: "", ? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
: "",
amountSpecial: profile.amountSpecial, amountSpecial: profile.amountSpecial,
orgRoot: orgRootRef?.orgRootName, orgRoot: orgRootRef?.orgRootName,
orgChild1: orgChild1Ref?.orgChild1Name, orgChild1: orgChild1Ref?.orgChild1Name,
@ -4169,7 +4164,7 @@ export class ProfileEmployeeTempController extends Controller {
salary: profile.amount, salary: profile.amount,
education: education:
profile && profile.profileEducations.length > 0 profile && profile.profileEducations.length > 0
? `${profile.profileEducations[0].degree ?? ""} ${profile.profileEducations[0].field ?? ""}` ? await getTopDegrees(profile.profileEducations)
: "-", : "-",
}; };

View file

@ -690,7 +690,7 @@ export class ReportController extends Controller {
"posMasters.positions.posExecutive", "posMasters.positions.posExecutive",
], ],
}); });
const orgName = orgRootData[0].orgRootName??""; const orgName = orgRootData[0].orgRootName ?? "";
const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null; const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null;
const orgChild1Data = await this.child1Repository.find({ const orgChild1Data = await this.child1Repository.find({
where: { where: {
@ -1289,7 +1289,11 @@ export class ReportController extends Controller {
} }
} }
return new HttpSuccess({ template: "report1", reportName: "report1", data: { org: orgName,data } }); return new HttpSuccess({
template: "report1",
reportName: "report1",
data: { org: orgName, data },
});
} }
/** /**
@ -1341,7 +1345,7 @@ export class ReportController extends Controller {
"posMasters.positions.posExecutive", "posMasters.positions.posExecutive",
], ],
}); });
const orgName = orgRootData[0].orgRootName??""; const orgName = orgRootData[0].orgRootName ?? "";
const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null; const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null;
const orgChild1Data = await this.child1Repository.find({ const orgChild1Data = await this.child1Repository.find({
where: { where: {
@ -3462,7 +3466,11 @@ export class ReportController extends Controller {
// sendWebSocket(metaData); // sendWebSocket(metaData);
// })(); // })();
return new HttpSuccess({ template: "report2", reportName: "report2", data: { org: orgName ,data } }); return new HttpSuccess({
template: "report2",
reportName: "report2",
data: { org: orgName, data },
});
} }
/** /**
@ -3733,20 +3741,18 @@ export class ReportController extends Controller {
posMaster.current_holder.profileEducations.length > 0 posMaster.current_holder.profileEducations.length > 0
) { ) {
let _education: any = posMaster.current_holder.profileEducations let _education: any = posMaster.current_holder.profileEducations
.filter(x => x.isEducation == true || x.isUse == true) .filter((x) => x.isEducation == true || x.isUse == true)
.sort( .sort((a, b) => {
(a, b) => { // (b.finishDate == null ? 0 : b.finishDate.getTime()) -
// (b.finishDate == null ? 0 : b.finishDate.getTime()) - // (a.finishDate == null ? 0 : a.finishDate.getTime()),
// (a.finishDate == null ? 0 : a.finishDate.getTime()), if (a.isEducation !== b.isEducation) {
if (a.isEducation !== b.isEducation) { return a.isEducation ? -1 : 1;
return a.isEducation ? -1 : 1
}
return b.level - a.level
} }
); return b.level - a.level;
});
if (_education.length > 0) { if (_education.length > 0) {
// education = _education[0]; // education = _education[0];
education = _education.map((e:any) => e.degree).join(", ") education = _education.map((e: any) => e.degree).join(", ");
} }
} }
let salary: any = ""; let salary: any = "";
@ -4115,17 +4121,15 @@ export class ReportController extends Controller {
posMaster.current_holder.profileEducations.length > 0 posMaster.current_holder.profileEducations.length > 0
) { ) {
let _education: any = posMaster.current_holder.profileEducations let _education: any = posMaster.current_holder.profileEducations
.filter(x => x.isEducation == true || x.isUse == true) .filter((x) => x.isEducation == true || x.isUse == true)
.sort( .sort((a, b) => {
(a, b) => { if (a.isEducation !== b.isEducation) {
if (a.isEducation !== b.isEducation) { return a.isEducation ? -1 : 1;
return a.isEducation ? -1 : 1
}
return b.level - a.level
} }
); return b.level - a.level;
});
if (_education.length > 0) { if (_education.length > 0) {
education = _education.map((e:any) => e.degree).join(", ") education = _education.map((e: any) => e.degree).join(", ");
} }
} }
let salary: any = ""; let salary: any = "";
@ -4502,17 +4506,15 @@ export class ReportController extends Controller {
posMaster.current_holder.profileEducations.length > 0 posMaster.current_holder.profileEducations.length > 0
) { ) {
let _education: any = posMaster.current_holder.profileEducations let _education: any = posMaster.current_holder.profileEducations
.filter(x => x.isEducation == true || x.isUse == true) .filter((x) => x.isEducation == true || x.isUse == true)
.sort( .sort((a, b) => {
(a, b) => { if (a.isEducation !== b.isEducation) {
if (a.isEducation !== b.isEducation) { return a.isEducation ? -1 : 1;
return a.isEducation ? -1 : 1
}
return b.level - a.level
} }
); return b.level - a.level;
});
if (_education.length > 0) { if (_education.length > 0) {
education = _education.map((e:any) => e.degree).join(", ") education = _education.map((e: any) => e.degree).join(", ");
} }
} }
let salary: any = ""; let salary: any = "";
@ -4905,17 +4907,15 @@ export class ReportController extends Controller {
posMaster.current_holder.profileEducations.length > 0 posMaster.current_holder.profileEducations.length > 0
) { ) {
let _education: any = posMaster.current_holder.profileEducations let _education: any = posMaster.current_holder.profileEducations
.filter(x => x.isEducation == true || x.isUse == true) .filter((x) => x.isEducation == true || x.isUse == true)
.sort( .sort((a, b) => {
(a, b) => { if (a.isEducation !== b.isEducation) {
if (a.isEducation !== b.isEducation) { return a.isEducation ? -1 : 1;
return a.isEducation ? -1 : 1
}
return b.level - a.level
} }
); return b.level - a.level;
});
if (_education.length > 0) { if (_education.length > 0) {
education = _education.map((e:any) => e.degree).join(", ") education = _education.map((e: any) => e.degree).join(", ");
} }
} }
let salary: any = ""; let salary: any = "";
@ -5312,17 +5312,15 @@ export class ReportController extends Controller {
posMaster.current_holder.profileEducations.length > 0 posMaster.current_holder.profileEducations.length > 0
) { ) {
let _education: any = posMaster.current_holder.profileEducations let _education: any = posMaster.current_holder.profileEducations
.filter(x => x.isEducation == true || x.isUse == true) .filter((x) => x.isEducation == true || x.isUse == true)
.sort( .sort((a, b) => {
(a, b) => { if (a.isEducation !== b.isEducation) {
if (a.isEducation !== b.isEducation) { return a.isEducation ? -1 : 1;
return a.isEducation ? -1 : 1
}
return b.level - a.level
} }
); return b.level - a.level;
});
if (_education.length > 0) { if (_education.length > 0) {
education = _education.map((e:any) => e.degree).join(", ") education = _education.map((e: any) => e.degree).join(", ");
} }
} }
let salary: any = ""; let salary: any = "";
@ -5700,7 +5698,7 @@ export class ReportController extends Controller {
"posMasters.positions.posExecutive", "posMasters.positions.posExecutive",
], ],
}); });
const orgName = orgRootData[0].orgRootName??""; const orgName = orgRootData[0].orgRootName ?? "";
const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null; const orgRootIds = orgRootData.map((orgRoot) => orgRoot.id) || null;
const orgChild1Data = await this.child1Repository.find({ const orgChild1Data = await this.child1Repository.find({
where: { where: {
@ -6891,7 +6889,11 @@ export class ReportController extends Controller {
} }
} }
} }
return new HttpSuccess({ template: "report3", reportName: "report3", data: { org: orgName,data } }); return new HttpSuccess({
template: "report3",
reportName: "report3",
data: { org: orgName, data },
});
} }
@Get("report4/{rootId}") @Get("report4/{rootId}")

View file

@ -809,6 +809,8 @@ export class WorkflowController extends Controller {
pageSize: number; pageSize: number;
keycloakId?: string | null; keycloakId?: string | null;
type?: string | null; type?: string | null;
sortBy?: string | null,
descending?: boolean,
}, },
) { ) {
const userKeycloak = body.keycloakId ?? request.user.sub; const userKeycloak = body.keycloakId ?? request.user.sub;
@ -946,7 +948,7 @@ export class WorkflowController extends Controller {
? AppDataSource.getRepository(viewDirectorActing) ? AppDataSource.getRepository(viewDirectorActing)
: AppDataSource.getRepository(viewDirector); : AppDataSource.getRepository(viewDirector);
const queryBuilder = repository.createQueryBuilder("entity"); let queryBuilder = repository.createQueryBuilder("entity");
// 5. แยก WHERE conditions ให้เร็วขึ้น // 5. แยก WHERE conditions ให้เร็วขึ้น
queryBuilder.where( queryBuilder.where(
@ -985,6 +987,13 @@ export class WorkflowController extends Controller {
); );
} }
if (body.sortBy) {
queryBuilder = queryBuilder.orderBy(
`entity.${body.sortBy}`,
body.descending ? "DESC" : "ASC"
);
}
// 7. Execute พร้อมกัน - ใช้ Promise.all // 7. Execute พร้อมกัน - ใช้ Promise.all
const [data, total] = await Promise.all([ const [data, total] = await Promise.all([
queryBuilder queryBuilder

View file

@ -256,10 +256,10 @@ export class Registry extends EntityBase {
birthdate: Date; birthdate: Date;
@Column({ @Column({
type: "text",
nullable: true, nullable: true,
comment: "วุฒิการศึกษา", comment: "วุฒิการศึกษา",
length: 255, default: null
default: null,
}) })
degrees: string; degrees: string;
@ -350,18 +350,18 @@ export class Registry extends EntityBase {
Educations: string; Educations: string;
@Column({ @Column({
type: "text",
nullable: true, nullable: true,
comment: "ระดับศึกษา", comment: "ระดับศึกษา",
length: 255, default: null
default: null,
}) })
educationLevels: string; educationLevels: string;
@Column({ @Column({
type: "text",
nullable: true, nullable: true,
comment: "สาขาวิชา/ทาง", comment: "สาขาวิชา/ทาง",
length: 255, default: null
default: null,
}) })
fields: string; fields: string;
} }

View file

@ -248,9 +248,9 @@ export class RegistryEmployee extends EntityBase {
birthdate: Date; birthdate: Date;
@Column({ @Column({
type: "text",
nullable: true, nullable: true,
comment: "วุฒิการศึกษา", comment: "วุฒิการศึกษา",
length: 255,
default: null, default: null,
}) })
degrees: string; degrees: string;
@ -313,18 +313,18 @@ export class RegistryEmployee extends EntityBase {
Educations: string; Educations: string;
@Column({ @Column({
type: "text",
nullable: true, nullable: true,
comment: "ระดับศึกษา", comment: "ระดับศึกษา",
length: 255, default: null
default: null,
}) })
educationLevels: string; educationLevels: string;
@Column({ @Column({
type: "text",
nullable: true, nullable: true,
comment: "สาขาวิชา/ทาง", comment: "สาขาวิชา/ทาง",
length: 255, default: null
default: null,
}) })
fields: string; fields: string;

View file

@ -0,0 +1,36 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateDataTypeFieldsRegistryAndRegistryEmpployee1757484721787 implements MigrationInterface {
name = 'UpdateDataTypeFieldsRegistryAndRegistryEmpployee1757484721787'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`degrees\``);
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`degrees\` text NULL COMMENT 'วุฒิการศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`educationLevels\``);
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`educationLevels\` text NULL COMMENT 'ระดับศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`fields\``);
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`fields\` text NULL COMMENT 'สาขาวิชา/ทาง'`);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`degrees\``);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`degrees\` text NULL COMMENT 'วุฒิการศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`educationLevels\``);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`educationLevels\` text NULL COMMENT 'ระดับศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`fields\``);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`fields\` text NULL COMMENT 'สาขาวิชา/ทาง'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`fields\``);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`fields\` varchar(255) NULL COMMENT 'สาขาวิชา/ทาง'`);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`educationLevels\``);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`educationLevels\` varchar(255) NULL COMMENT 'ระดับศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` DROP COLUMN \`degrees\``);
await queryRunner.query(`ALTER TABLE \`registryEmployee\` ADD \`degrees\` varchar(255) NULL COMMENT 'วุฒิการศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`fields\``);
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`fields\` varchar(255) NULL COMMENT 'สาขาวิชา/ทาง'`);
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`educationLevels\``);
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`educationLevels\` varchar(255) NULL COMMENT 'ระดับศึกษา'`);
await queryRunner.query(`ALTER TABLE \`registry\` DROP COLUMN \`degrees\``);
await queryRunner.query(`ALTER TABLE \`registry\` ADD \`degrees\` varchar(255) NULL COMMENT 'วุฒิการศึกษา'`);
}
}

View file

@ -5,11 +5,13 @@ import { PosMaster } from "../entities/PosMaster";
import { PosMasterEmployeeHistory } from "../entities/PosMasterEmployeeHistory"; import { PosMasterEmployeeHistory } from "../entities/PosMasterEmployeeHistory";
import { PosMasterEmployeeTempHistory } from "../entities/PosMasterEmployeeTempHistory"; import { PosMasterEmployeeTempHistory } from "../entities/PosMasterEmployeeTempHistory";
import { PosMasterHistory } from "../entities/PosMasterHistory"; import { PosMasterHistory } from "../entities/PosMasterHistory";
import { ProfileEducation } from "../entities/ProfileEducation";
import { RequestWithUser } from "../middlewares/user"; import { RequestWithUser } from "../middlewares/user";
export async function CreatePosMasterHistoryOfficer( export async function CreatePosMasterHistoryOfficer(
posMasterId: string, posMasterId: string,
request: RequestWithUser | null, request: RequestWithUser | null,
type?: string | null,
): Promise<boolean> { ): Promise<boolean> {
try { try {
await AppDataSource.transaction(async (manager) => { await AppDataSource.transaction(async (manager) => {
@ -40,16 +42,18 @@ export async function CreatePosMasterHistoryOfficer(
pm.positions.length > 0 pm.positions.length > 0
? pm.positions.find((p) => p.positionIsSelected === true) ?? null ? pm.positions.find((p) => p.positionIsSelected === true) ?? null
: null; : null;
h.ancestorDNA = pm.ancestorDNA? pm.ancestorDNA : _null; h.ancestorDNA = pm.ancestorDNA ? pm.ancestorDNA : _null;
h.prefix = pm.current_holder?.prefix || _null; if(!type || type != "DELETE"){
h.firstName = pm.current_holder?.firstName || _null; h.prefix = pm.current_holder?.prefix || _null;
h.lastName = pm.current_holder?.lastName || _null; h.firstName = pm.current_holder?.firstName || _null;
h.lastName = pm.current_holder?.lastName || _null;
h.position = selectedPosition?.positionName ?? _null;
h.posType = selectedPosition?.posType?.posTypeName ?? _null;
h.posLevel = selectedPosition?.posLevel?.posLevelName ?? _null;
}
h.posMasterNoPrefix = pm.posMasterNoPrefix ?? _null; h.posMasterNoPrefix = pm.posMasterNoPrefix ?? _null;
h.posMasterNo = pm.posMasterNo ?? _null; h.posMasterNo = pm.posMasterNo ?? _null;
h.posMasterNoSuffix = pm.posMasterNoSuffix ?? _null; h.posMasterNoSuffix = pm.posMasterNoSuffix ?? _null;
h.position = selectedPosition?.positionName ?? _null;
h.posType = selectedPosition?.posType?.posTypeName ?? _null;
h.posLevel = selectedPosition?.posLevel?.posLevelName ?? _null;
h.posExecutive = selectedPosition?.posExecutive?.posExecutiveName ?? _null; h.posExecutive = selectedPosition?.posExecutive?.posExecutiveName ?? _null;
h.shortName = h.shortName =
[ [
@ -214,3 +218,22 @@ export async function CreatePosMasterHistoryEmployeeTemp(
return false; return false;
} }
} }
export async function getTopDegrees(educations: ProfileEducation[]): Promise<string> {
// filter เฉพาะ isUse==true หรือ isEducation==true
const filtered = educations.filter((e) => e.isUse === true || e.isEducation === true);
// sort: isEducation==true ก่อน, ถ้าเท่ากัน sort ด้วย level น้อยสุด
const sorted = filtered.sort((a, b) => {
const aEdu = !!a.isEducation ? 0 : 1;
const bEdu = !!b.isEducation ? 0 : 1;
if (aEdu !== bEdu) return aEdu - bEdu;
const aLevel = typeof a.level === "number" ? a.level : Number.MAX_SAFE_INTEGER;
const bLevel = typeof b.level === "number" ? b.level : Number.MAX_SAFE_INTEGER;
return aLevel - bLevel;
});
return sorted
.map((e) => [e.degree, e.field].filter(Boolean).join(" "))
.filter(Boolean)
.join("\n");
}

View file

@ -571,11 +571,11 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
} }
} }
item.current_holderId = item.next_holderId; item.current_holderId = item.next_holderId;
item.conditionReason = _null; // item.conditionReason = _null;
if (item.current_holderId) { // if (item.current_holderId) {
item.conditionReason = _null; // item.conditionReason = _null;
item.isCondition = false; // item.isCondition = false;
} // }
item.next_holderId = null; item.next_holderId = null;
item.lastUpdateUserId = lastUpdateUserId; item.lastUpdateUserId = lastUpdateUserId;
item.lastUpdateFullName = lastUpdateFullName; item.lastUpdateFullName = lastUpdateFullName;
@ -1760,10 +1760,10 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
) )
) { ) {
posMaster.next_holderId = item.current_holderId; posMaster.next_holderId = item.current_holderId;
if (posMaster.next_holderId) { // if (posMaster.next_holderId) {
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
} // }
} else { } else {
posMaster.next_holderId = null; posMaster.next_holderId = null;
posMaster.isSit = false; posMaster.isSit = false;
@ -1856,10 +1856,10 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
) )
) { ) {
posMaster.next_holderId = item.current_holderId; posMaster.next_holderId = item.current_holderId;
if (posMaster.next_holderId) { // if (posMaster.next_holderId) {
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
} // }
} else { } else {
posMaster.next_holderId = null; posMaster.next_holderId = null;
posMaster.isSit = false; posMaster.isSit = false;
@ -1954,10 +1954,10 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
) )
) { ) {
posMaster.next_holderId = item.current_holderId; posMaster.next_holderId = item.current_holderId;
if (posMaster.next_holderId) { // if (posMaster.next_holderId) {
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
} // }
} else { } else {
posMaster.next_holderId = null; posMaster.next_holderId = null;
posMaster.isSit = false; posMaster.isSit = false;
@ -2054,10 +2054,10 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
) )
) { ) {
posMaster.next_holderId = item.current_holderId; posMaster.next_holderId = item.current_holderId;
if (posMaster.next_holderId) { // if (posMaster.next_holderId) {
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
} // }
} else { } else {
posMaster.next_holderId = null; posMaster.next_holderId = null;
posMaster.isSit = false; posMaster.isSit = false;
@ -2157,10 +2157,10 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
) )
) { ) {
posMaster.next_holderId = item.current_holderId; posMaster.next_holderId = item.current_holderId;
if (posMaster.next_holderId) { // if (posMaster.next_holderId) {
posMaster.conditionReason = _null; // posMaster.conditionReason = _null;
posMaster.isCondition = false; // posMaster.isCondition = false;
} // }
} else { } else {
posMaster.next_holderId = null; posMaster.next_holderId = null;
posMaster.isSit = false; posMaster.isSit = false;