Merge branch 'develop'

This commit is contained in:
kittapath 2024-12-25 20:59:27 +07:00
commit b58be5ee2b
6 changed files with 48 additions and 24 deletions

View file

@ -1771,18 +1771,31 @@ export class CommandController extends Controller {
.catch(() => {});
if (requestBody.persons != undefined && requestBody.persons.length > 0) {
const posMaster = await this.posMasterRepository.find({
where: {
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
select: ["orgRootId"],
});
let posMaster: any;
if (["C-PM-36", "C-PM-37"].includes(commandCode)) {
posMaster = await this.employeePosMasterRepository.find({
where: {
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
select: ["orgRootId"],
});
}
else {
posMaster = await this.posMasterRepository.find({
where: {
current_holderId: In(requestBody.persons.map((x) => x.profileId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
},
select: ["orgRootId"],
});
}
let _posMaster: any;
if (["C-PM-38", "C-PM-40"].includes(commandCode)) {
_posMaster = await this.posMasterRepository.find({
where: {
orgRootId: In(posMaster.map((x) => x.orgRootId)),
orgRootId: In(posMaster.map((x:any) => x.orgRootId)),
orgChild1: IsNull(),
orgChild2: IsNull(),
orgChild3: IsNull(),
@ -1796,7 +1809,7 @@ export class CommandController extends Controller {
} else {
_posMaster = await this.posMasterRepository.find({
where: {
orgRootId: In(posMaster.map((x) => x.orgRootId)),
orgRootId: In(posMaster.map((x:any) => x.orgRootId)),
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
isDirector: true,
current_holderId: Not(IsNull()),

View file

@ -141,10 +141,11 @@ export class EmployeePosTypeController extends Controller {
async deleteType(@Path() id: string, @Request() request: RequestWithUser) {
let result: any;
try {
result = await this.employeePosTypeRepository.findOne({
where: { id: id },
});
await this.employeePosTypeRepository.remove(result, { data: request });
// result = await this.employeePosTypeRepository.findOne({
// where: { id: id },
// });
// await this.employeePosTypeRepository.remove(result, { data: request });
result = await this.employeePosTypeRepository.delete({ id: id });
} catch {
throw new HttpError(
HttpStatusCode.NOT_FOUND,

View file

@ -2113,12 +2113,12 @@ export class OrganizationDotnetController extends Controller {
id: profile.id,
avatar: profile.avatar,
avatarName: profile.avatarName,
rank: profile.rank,
prefix: profile.prefix,
firstName: profile.firstName,
lastName: profile.lastName,
citizenId: profile.citizenId,
position: profile.position,
rank: profile.rank ?? "",
prefix: profile.prefix ?? "",
firstName: profile.firstName ?? "",
lastName: profile.lastName ?? "",
citizenId: profile.citizenId ?? "",
position: profile.position ?? "",
posLevelId: profile.posLevelId,
posTypeId: profile.posTypeId,
email: profile.email,
@ -2137,10 +2137,10 @@ export class OrganizationDotnetController extends Controller {
reasonSameDate: profile.reasonSameDate,
telephoneNumber: profile.telephoneNumber,
nationality: profile.nationality,
gender: profile.gender,
relationship: profile.relationship,
religion: profile.religion,
bloodGroup: profile.bloodGroup,
gender: profile.gender ?? "",
relationship: profile.relationship ?? "",
religion: profile.religion ?? "",
bloodGroup: profile.bloodGroup ?? "",
registrationAddress: profile.registrationAddress,
registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId,
@ -2174,7 +2174,7 @@ export class OrganizationDotnetController extends Controller {
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRootId ?? null,
posNo: shortName,
posNo: shortName ?? "",
};
});

View file

@ -947,6 +947,7 @@ export class OrganizationUnauthorizeController extends Controller {
if (val >= 70 && val <= 79) return "ดี";
if (val >= 80 && val <= 89) return "ดีมาก";
if (val >= 90 && val <= 100) return "ดีเด่น";
if (val > 101 ) return "ดีเด่น";
else return "-";
}

View file

@ -4810,6 +4810,9 @@ export class ProfileController extends Controller {
nodeId: null,
type: profile.employeeClass,
salary: profile.amount,
posNo : root?.orgRootShortName && posMaster?.posMasterNo
? `${root?.orgRootShortName}${posMaster?.posMasterNo}`
: ""
};
if (_profile.child4Id != null) {
_profile.node = 4;
@ -4951,6 +4954,9 @@ export class ProfileController extends Controller {
nodeId: null,
salary: profile ? profile.amount : null,
amountSpecial: profile ? profile.amountSpecial : null,
posNo : root?.orgRootShortName && posMaster?.posMasterNo
? `${root?.orgRootShortName}${posMaster?.posMasterNo}`
: ""
};
if (_profile.child4Id != null) {

View file

@ -2153,6 +2153,9 @@ export class ProfileEmployeeController extends Controller {
nodeId: null,
salary: profile ? profile.amount : null,
amountSpecial: profile ? profile.amountSpecial : null,
posNo : root?.orgRootShortName && posMaster?.posMasterNo
? `${root?.orgRootShortName}${posMaster?.posMasterNo}`
: ""
};
return new HttpSuccess(_profile);
}