This commit is contained in:
AdisakKanthawilang 2024-04-24 17:45:00 +07:00
parent 709cd6b3e8
commit 1f88eb4085

View file

@ -701,6 +701,15 @@ export class PositionController extends Controller {
);
}
let fullPosMasterNo = String((requestBody.posMasterNoPrefix).trim() + (requestBody.posMasterNo) + (requestBody.posMasterNoSuffix).trim());
if (fullPosMasterNo === String(requestBody.posMasterNo)) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถใส่ข้อมูลซ้ำกันได้",
);
}
posMaster.createdUserId = request.user.sub;
posMaster.createdFullName = request.user.name;
posMaster.lastUpdateUserId = request.user.sub;
@ -769,6 +778,7 @@ export class PositionController extends Controller {
if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
}
posMaster.posMasterNo = requestBody.posMasterNo;
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
@ -918,7 +928,14 @@ export class PositionController extends Controller {
);
}
}
let fullPosMasterNo = String((requestBody.posMasterNoPrefix).trim() + (requestBody.posMasterNo) + (requestBody.posMasterNoSuffix).trim());
if (fullPosMasterNo === String(requestBody.posMasterNo)) {
throw new HttpError(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"ไม่สามารถเพิ่มข้อมูลชื่อตำแหน่งซ้ำกันได้",
);
}
// const chk_SName0 = await this.posMasterRepository.findOne({
// where: {
// orgRevisionId: posMaster.orgRevisionId,
@ -1167,7 +1184,7 @@ export class PositionController extends Controller {
orgChild3Id: body.id,
};
if (!body.isAll) {
checkChildConditions = {
checkChildConditions = {
orgChild4Id: IsNull(),
};
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;