no message

This commit is contained in:
kittapath 2024-10-10 20:05:25 +07:00
parent b7ae2e35a4
commit fd0c421dd9

View file

@ -1093,7 +1093,7 @@ export class CommandController extends Controller {
: null;
if (issue == null) {
const orgRevisionActive = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsCurrent: false, orgRevisionIsDraft: true },
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
relations: ["posMasters", "posMasters.orgRoot"],
});
if (orgRevisionActive != null) {
@ -1104,8 +1104,8 @@ export class CommandController extends Controller {
});
if (profile != null) {
issue =
orgRevisionActive?.posMasters?.filter((x) => x.next_holderId == profile.id)[0]?.orgRoot
?.orgRootName || null;
orgRevisionActive?.posMasters?.filter((x) => x.current_holderId == profile.id)[0]
?.orgRoot?.orgRootName || null;
}
}
}
@ -1159,24 +1159,6 @@ export class CommandController extends Controller {
let _command: any = [];
const path = this.commandTypePath(command.commandType.code);
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
console.log(
command.commandRecives
.filter((x) => x.refId != null)
.map((x) => ({
refId: x.refId,
Sequence: x.order,
CitizenId: x.citizenId,
Prefix: x.prefix,
FirstName: x.firstName,
LastName: x.lastName,
Amount: x.amount,
PositionSalaryAmount: x.positionSalaryAmount,
MouthSalaryAmount: x.mouthSalaryAmount,
RemarkHorizontal: x.remarkHorizontal,
RemarkVertical: x.remarkVertical,
CommandYear: command.commandYear,
})),
);
await new CallAPI()
.PostData(request, path + "/attachment", {
refIds: command.commandRecives
@ -1201,10 +1183,47 @@ export class CommandController extends Controller {
})
.catch(() => {});
let issue =
command.isBangkok == "OFFICE"
? "สำนักปลัดกรุงเทพมหานคร"
: command.isBangkok == "BANGKOK"
? "กรุงเทพมหานคร"
: null;
if (issue == null) {
const orgRevisionActive = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
relations: ["posMasters", "posMasters.orgRoot"],
});
if (orgRevisionActive != null) {
const profile = await this.profileRepository.findOne({
where: {
keycloak: command.createdUserId.toString(),
},
});
if (profile != null) {
issue =
orgRevisionActive?.posMasters?.filter((x) => x.current_holderId == profile.id)[0]
?.orgRoot?.orgRootName || null;
}
}
}
if (issue == null) issue = "...................................";
return new HttpSuccess({
template: command.commandType.fileAttachment,
reportName: "xlsx-report",
data: { data: _command },
data: {
data: _command,
issuerOrganizationName: issue,
commandNo: command.commandNo == null ? "" : Extension.ToThaiNumber(command.commandNo),
commandYear:
command.commandYear == null
? ""
: Extension.ToThaiNumber(Extension.ToThaiYear(command.commandYear).toString()),
commandExcecuteDate:
command.commandExcecuteDate == null
? ""
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandExcecuteDate)),
},
});
}
@ -2602,8 +2621,7 @@ export class CommandController extends Controller {
"" + posMasterAct.posMasterChild?.current_holder?.firstName ??
"" + " " + posMasterAct.posMasterChild?.current_holder?.lastName ??
null,
organization: _organization,
position: posMasterAct.posMasterChild?.current_holder?.position ?? null,
oc: (posMasterAct.posMasterChild?.current_holder?.position ?? null) + "/" + _organization,
postype: posMasterAct.posMasterChild?.current_holder?.posType?.posTypeName ?? null,
poslevel: posMasterAct.posMasterChild?.current_holder?.posLevel?.posLevelName ?? null,
organizationNew: _organizationNew,