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