no message
This commit is contained in:
parent
ca82158a20
commit
148fa2c81c
6 changed files with 65 additions and 30 deletions
|
|
@ -99,7 +99,10 @@ export class PositionController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestBody.posExecutiveId != "") requestBody.posExecutiveId = null;
|
if (requestBody.posExecutiveId == "") {
|
||||||
|
requestBody.posExecutiveId = null;
|
||||||
|
posDict.posExecutiveId = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (requestBody.posExecutiveId != null) {
|
if (requestBody.posExecutiveId != null) {
|
||||||
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
|
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,10 @@ export class ReportController extends Controller {
|
||||||
relations: [
|
relations: [
|
||||||
"posMasters",
|
"posMasters",
|
||||||
"posMasters.next_holder",
|
"posMasters.next_holder",
|
||||||
|
"posMasters.next_holder.posLevel",
|
||||||
|
"posMasters.next_holder.posType",
|
||||||
|
"posMasters.next_holder.current_holders",
|
||||||
|
"posMasters.next_holder.current_holders.positions",
|
||||||
"posMasters.positions",
|
"posMasters.positions",
|
||||||
"posMasters.positions.posLevel",
|
"posMasters.positions.posLevel",
|
||||||
"posMasters.positions.posType",
|
"posMasters.positions.posType",
|
||||||
|
|
@ -181,18 +185,18 @@ export class ReportController extends Controller {
|
||||||
if (_orgRevisionActive.length > 0) orgRevisionActive = _orgRevisionActive[0];
|
if (_orgRevisionActive.length > 0) orgRevisionActive = _orgRevisionActive[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const posMasterOlds = await this.posMasterRepository.find({
|
// const posMasterOlds = await this.posMasterRepository.find({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: orgRevisionActive.id,
|
// orgRevisionId: orgRevisionActive.id,
|
||||||
},
|
// },
|
||||||
relations: ["next_holder", "current_holder"],
|
// relations: ["next_holder", "current_holder"],
|
||||||
});
|
// });
|
||||||
const positionOlds = await this.positionRepository.find({
|
// const positionOlds = await this.positionRepository.find({
|
||||||
where: {
|
// where: {
|
||||||
posMasterId: In(posMasterOlds.map((posMaster: any) => posMaster.id)),
|
// posMasterId: In(posMasterOlds.map((posMaster: any) => posMaster.id)),
|
||||||
},
|
// },
|
||||||
relations: ["posLevel", "posType", "posExecutive"],
|
// relations: ["posLevel", "posType", "posExecutive"],
|
||||||
});
|
// });
|
||||||
|
|
||||||
let data = new Array();
|
let data = new Array();
|
||||||
for (let orgRoot of orgRootData) {
|
for (let orgRoot of orgRootData) {
|
||||||
|
|
@ -237,6 +241,11 @@ export class ReportController extends Controller {
|
||||||
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
|
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
|
||||||
];
|
];
|
||||||
const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
|
const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
|
||||||
|
const positionMasterOld = posMaster.next_holder.current_holders.find(
|
||||||
|
(x) => x == orgRevisionActive,
|
||||||
|
);
|
||||||
|
console.log(orgRevisionActive);
|
||||||
|
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||||
return {
|
return {
|
||||||
posMasterNoPrefix: posMaster.posMasterNoPrefix,
|
posMasterNoPrefix: posMaster.posMasterNoPrefix,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
|
|
@ -245,13 +254,37 @@ export class ReportController extends Controller {
|
||||||
posMaster.next_holder == null
|
posMaster.next_holder == null
|
||||||
? "- ว่าง -"
|
? "- ว่าง -"
|
||||||
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
||||||
profilePosMasterNo: posMaster.next_holder == null ? null : "xxx",
|
|
||||||
|
// profilePosMasterNo:
|
||||||
|
// posMaster.next_holder == null
|
||||||
|
// ? posMaster.posMasterNo
|
||||||
|
// : positionMasterOld == null
|
||||||
|
// ? null
|
||||||
|
// : positionMasterOld.posMasterNo,
|
||||||
profilePositionName:
|
profilePositionName:
|
||||||
posMaster.next_holder == null ? positionName.join(" หรือ ") : "xxx",
|
posMaster.next_holder == null
|
||||||
profilePosType: posMaster.next_holder == null ? posType.join(" หรือ ") : "xxx",
|
? positionName.join(" หรือ ")
|
||||||
profilePosLevel: posMaster.next_holder == null ? posLevel.join(" หรือ ") : "xxx",
|
: posMaster.next_holder.position,
|
||||||
profilePositionField:
|
profilePosType:
|
||||||
posMaster.next_holder == null ? positionField.join(" หรือ ") : "xxx",
|
posMaster.next_holder == null
|
||||||
|
? posType.join(" หรือ ")
|
||||||
|
: posMaster.next_holder.posType == null
|
||||||
|
? null
|
||||||
|
: posMaster.next_holder.posType.posTypeName,
|
||||||
|
profilePosLevel:
|
||||||
|
posMaster.next_holder == null
|
||||||
|
? posLevel.join(" หรือ ")
|
||||||
|
: posMaster.next_holder.posLevel == null
|
||||||
|
? null
|
||||||
|
: posMaster.next_holder.posLevel.posLevelName,
|
||||||
|
// profilePositionField:
|
||||||
|
// posMaster.next_holder == null
|
||||||
|
// ? positionField.join(" หรือ ")
|
||||||
|
// : positionMasterOld == null
|
||||||
|
// ? null
|
||||||
|
// : positionMasterOld.positions.find((x) => (x.positionIsSelected = true))
|
||||||
|
// ?.positionField,
|
||||||
|
|
||||||
// profilePosMasterNo: (posMasterOld == null ? null : posMasterOld.posMasterNo),
|
// profilePosMasterNo: (posMasterOld == null ? null : posMasterOld.posMasterNo),
|
||||||
// profilePositionName: (positionOld == null ? null : positionOld.positionName),
|
// profilePositionName: (positionOld == null ? null : positionOld.positionName),
|
||||||
// profilePosType: (positionOld == null ? null : positionOld.posType.posTypeName),
|
// profilePosType: (positionOld == null ? null : positionOld.posType.posTypeName),
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ export class PosDict extends EntityBase {
|
||||||
comment: "ตำแหน่งทางการบริหาร",
|
comment: "ตำแหน่งทางการบริหาร",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
posExecutiveId: string;
|
posExecutiveId: string | null;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -85,7 +85,7 @@ export class CreatePosDict {
|
||||||
posLevelId: string;
|
posLevelId: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posExecutiveId?: string | null;
|
posExecutiveId: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posDictExecutiveField: string;
|
posDictExecutiveField: string;
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ export class PosLevel extends EntityBase {
|
||||||
@OneToMany(() => PosDict, (posDict) => posDict.posLevel)
|
@OneToMany(() => PosDict, (posDict) => posDict.posLevel)
|
||||||
posDicts: PosDict[];
|
posDicts: PosDict[];
|
||||||
|
|
||||||
@OneToMany(() => Profile, (profile) => profile.posLevelsId)
|
@OneToMany(() => Profile, (profile) => profile.posLevel)
|
||||||
posLevelId: Profile;
|
posLevels: Profile[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePosLevel {
|
export class CreatePosLevel {
|
||||||
|
|
@ -73,4 +73,3 @@ export class CreatePosLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdatePosLevel = Partial<CreatePosLevel> & { posLevelAuthority?: PosLevelAuthority };
|
export type UpdatePosLevel = Partial<CreatePosLevel> & { posLevelAuthority?: PosLevelAuthority };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ export class PosType extends EntityBase {
|
||||||
@OneToMany(() => PosDict, (posDict) => posDict.posType)
|
@OneToMany(() => PosDict, (posDict) => posDict.posType)
|
||||||
posDicts: PosDict[];
|
posDicts: PosDict[];
|
||||||
|
|
||||||
@OneToMany(() => Profile, (profile) => profile.posTypesId)
|
@OneToMany(() => Profile, (profile) => profile.posType)
|
||||||
posTypeId: Profile;
|
posTypes: Profile[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreatePosType {
|
export class CreatePosType {
|
||||||
|
|
|
||||||
|
|
@ -86,13 +86,13 @@ export class Profile extends EntityBase {
|
||||||
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
|
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
|
||||||
next_holders: PosMaster[];
|
next_holders: PosMaster[];
|
||||||
|
|
||||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevelId)
|
@ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevels)
|
||||||
@JoinColumn({ name: "posLevelId" })
|
@JoinColumn({ name: "posLevelId" })
|
||||||
posLevelsId: PosLevel;
|
posLevel: PosLevel;
|
||||||
|
|
||||||
@ManyToOne(() => PosType, (posType) => posType.posTypeId)
|
@ManyToOne(() => PosType, (posType) => posType.posTypes)
|
||||||
@JoinColumn({ name: "posTypeId" })
|
@JoinColumn({ name: "posTypeId" })
|
||||||
posTypesId: PosType;
|
posType: PosType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateProfile {
|
export class CreateProfile {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue