import ตำแหน่ง

This commit is contained in:
kittapath 2025-03-13 14:53:55 +07:00
parent 7b955739ba
commit f1f7412db0
3 changed files with 160 additions and 132 deletions

View file

@ -540,12 +540,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgRoot"],
});
if (chk_SName0 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName0 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName1 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -556,12 +556,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild1"],
});
if (chk_SName1 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName1 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName2 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -572,12 +572,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild2"],
});
if (chk_SName2 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName2 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName3 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -588,12 +588,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild3"],
});
if (chk_SName3 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName3 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName4 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -603,12 +603,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild4"],
});
if (chk_SName4 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName4 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const before = null;
posMaster.createdUserId = request.user.sub;
posMaster.createdFullName = request.user.name;
@ -749,12 +749,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgRoot"],
});
if (chk_SName0 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName0 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName1 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -766,12 +766,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild1"],
});
if (chk_SName1 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName1 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName2 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -783,12 +783,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild2"],
});
if (chk_SName2 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName2 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName3 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -800,12 +800,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild3"],
});
if (chk_SName3 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// if (chk_SName3 != null) {
// throw new HttpError(
// HttpStatusCode.INTERNAL_SERVER_ERROR,
// "ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
// );
// }
const chk_SName4 = await this.employeeTempPosMasterRepository.findOne({
where: {
@ -816,12 +816,12 @@ export class EmployeeTempPositionController extends Controller {
},
relations: ["orgChild4"],
});
if (chk_SName4 != null) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่เลขที่ตำแหน่งซ้ำกันได้",
);
}
// 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;