อัตรากำลังลูกจ้างชั่วคราว ตำแหน่ง
This commit is contained in:
parent
44f1fc9e54
commit
dbf0952b6b
2 changed files with 159 additions and 157 deletions
|
|
@ -531,84 +531,84 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
SName = orgRoot.orgRootShortName;
|
SName = orgRoot.orgRootShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const chk_SName0 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName0 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgRoot: { orgRootShortName: SName },
|
// orgRoot: { orgRootShortName: SName },
|
||||||
orgChild1Id: IsNull(),
|
// orgChild1Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
// },
|
||||||
relations: ["orgRoot"],
|
// relations: ["orgRoot"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName0 != null) {
|
// // if (chk_SName0 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName1 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName1 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild1: { orgChild1ShortName: SName },
|
// orgChild1: { orgChild1ShortName: SName },
|
||||||
orgChild2Id: IsNull(),
|
// orgChild2Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
// },
|
||||||
relations: ["orgChild1"],
|
// relations: ["orgChild1"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName1 != null) {
|
// // if (chk_SName1 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName2 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName2 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild2: { orgChild2ShortName: SName },
|
// orgChild2: { orgChild2ShortName: SName },
|
||||||
orgChild3Id: IsNull(),
|
// orgChild3Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
// },
|
||||||
relations: ["orgChild2"],
|
// relations: ["orgChild2"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName2 != null) {
|
// // if (chk_SName2 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName3 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName3 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild3: { orgChild3ShortName: SName },
|
// orgChild3: { orgChild3ShortName: SName },
|
||||||
orgChild4Id: IsNull(),
|
// orgChild4Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
// },
|
||||||
relations: ["orgChild3"],
|
// relations: ["orgChild3"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName3 != null) {
|
// // if (chk_SName3 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName4 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName4 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild4: { orgChild4ShortName: SName },
|
// orgChild4: { orgChild4ShortName: SName },
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
},
|
// },
|
||||||
relations: ["orgChild4"],
|
// relations: ["orgChild4"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName4 != null) {
|
// // if (chk_SName4 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
const before = null;
|
const before = null;
|
||||||
posMaster.createdUserId = request.user.sub;
|
posMaster.createdUserId = request.user.sub;
|
||||||
posMaster.createdFullName = request.user.name;
|
posMaster.createdFullName = request.user.name;
|
||||||
|
|
@ -652,7 +652,9 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
) {
|
) {
|
||||||
await new permission().PermissionUpdate(request, "SYS_ORG_TEMP");
|
await new permission().PermissionUpdate(request, "SYS_ORG_TEMP");
|
||||||
const posMaster = await this.employeeTempPosMasterRepository.findOne({ where: { id: id } });
|
const posMaster: any = await this.employeeTempPosMasterRepository.findOne({
|
||||||
|
where: { id: id },
|
||||||
|
});
|
||||||
if (!posMaster) {
|
if (!posMaster) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
|
||||||
}
|
}
|
||||||
|
|
@ -739,89 +741,89 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
SName = orgRoot.orgRootShortName;
|
SName = orgRoot.orgRootShortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const chk_SName0 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName0 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgRoot: { orgRootShortName: SName },
|
// orgRoot: { orgRootShortName: SName },
|
||||||
orgChild1Id: IsNull(),
|
// orgChild1Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id),
|
// id: Not(posMaster.id),
|
||||||
},
|
// },
|
||||||
relations: ["orgRoot"],
|
// relations: ["orgRoot"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName0 != null) {
|
// // if (chk_SName0 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName1 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName1 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild1: { orgChild1ShortName: SName },
|
// orgChild1: { orgChild1ShortName: SName },
|
||||||
orgChild2Id: IsNull(),
|
// orgChild2Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id),
|
// id: Not(posMaster.id),
|
||||||
},
|
// },
|
||||||
relations: ["orgChild1"],
|
// relations: ["orgChild1"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName1 != null) {
|
// // if (chk_SName1 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName2 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName2 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild2: { orgChild2ShortName: SName },
|
// orgChild2: { orgChild2ShortName: SName },
|
||||||
orgChild3Id: IsNull(),
|
// orgChild3Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id),
|
// id: Not(posMaster.id),
|
||||||
},
|
// },
|
||||||
relations: ["orgChild2"],
|
// relations: ["orgChild2"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName2 != null) {
|
// // if (chk_SName2 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName3 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName3 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild3: { orgChild3ShortName: SName },
|
// orgChild3: { orgChild3ShortName: SName },
|
||||||
orgChild4Id: IsNull(),
|
// orgChild4Id: IsNull(),
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id),
|
// id: Not(posMaster.id),
|
||||||
},
|
// },
|
||||||
relations: ["orgChild3"],
|
// relations: ["orgChild3"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName3 != null) {
|
// // if (chk_SName3 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
const chk_SName4 = await this.employeeTempPosMasterRepository.findOne({
|
// const chk_SName4 = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
orgRevisionId: posMaster.orgRevisionId,
|
// orgRevisionId: posMaster.orgRevisionId,
|
||||||
orgChild4: { orgChild4ShortName: SName },
|
// orgChild4: { orgChild4ShortName: SName },
|
||||||
posMasterNo: requestBody.posMasterNo,
|
// posMasterNo: requestBody.posMasterNo,
|
||||||
id: Not(posMaster.id),
|
// id: Not(posMaster.id),
|
||||||
},
|
// },
|
||||||
relations: ["orgChild4"],
|
// relations: ["orgChild4"],
|
||||||
});
|
// });
|
||||||
// if (chk_SName4 != null) {
|
// // if (chk_SName4 != null) {
|
||||||
// throw new HttpError(
|
// // throw new HttpError(
|
||||||
// HttpStatusCode.INTERNAL_SERVER_ERROR,
|
// // HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
// // "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
|
||||||
// );
|
// // );
|
||||||
// }
|
// // }
|
||||||
const before = structuredClone(posMaster);
|
const before = structuredClone(posMaster);
|
||||||
posMaster.createdUserId = request.user.sub; //สงสัยว่าทำให้ bug แก้ไขไม่ได้
|
posMaster.createdUserId = request.user.sub; //สงสัยว่าทำให้ bug แก้ไขไม่ได้
|
||||||
posMaster.createdFullName = request.user.name;
|
posMaster.createdFullName = request.user.name;
|
||||||
|
|
|
||||||
|
|
@ -235,13 +235,13 @@ export class EmployeeTempPosMaster extends EntityBase {
|
||||||
|
|
||||||
export class CreateEmployeeTempPosMaster {
|
export class CreateEmployeeTempPosMaster {
|
||||||
@Column()
|
@Column()
|
||||||
posMasterNoPrefix: string;
|
posMasterNoPrefix?: string | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posMasterNo: number;
|
posMasterNo?: number | null;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posMasterNoSuffix: string;
|
posMasterNoSuffix?: string | null;
|
||||||
|
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
positions: CreateEmployeePosDict[];
|
positions: CreateEmployeePosDict[];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue