space posno

This commit is contained in:
mamoss 2025-04-05 19:21:50 +07:00
parent b1b9700e40
commit d9fb4110e3
18 changed files with 1283 additions and 875 deletions

View file

@ -972,11 +972,11 @@ export class EmployeePositionController extends Controller {
let checkChildConditions: any = {};
let keywordAsInt: any;
let searchShortName = "";
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName3 = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName4 = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName3 = `CONCAT(orgChild3.orgChild3ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName4 = `CONCAT(orgChild4.orgChild4ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
if (body.type === 0) {
typeCondition = {
@ -986,7 +986,7 @@ export class EmployeePositionController extends Controller {
checkChildConditions = {
orgChild1Id: IsNull(),
};
searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
searchShortName = `CONCAT(orgRoot.orgRootShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
} else if (body.type === 1) {
@ -997,7 +997,7 @@ export class EmployeePositionController extends Controller {
checkChildConditions = {
orgChild2Id: IsNull(),
};
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
searchShortName = `CONCAT(orgChild1.orgChild1ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
} else if (body.type === 2) {
@ -1008,7 +1008,7 @@ export class EmployeePositionController extends Controller {
checkChildConditions = {
orgChild3Id: IsNull(),
};
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
searchShortName = `CONCAT(orgChild2.orgChild2ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
} else if (body.type === 3) {
@ -1019,14 +1019,14 @@ export class EmployeePositionController extends Controller {
checkChildConditions = {
orgChild4Id: IsNull(),
};
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
searchShortName = `CONCAT(orgChild3.orgChild3ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
} else if (body.type === 4) {
typeCondition = {
orgChild4Id: body.id,
};
searchShortName = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
searchShortName = `CONCAT(orgChild4.orgChild4ShortName," ",posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
}
let findPosition: any;
let masterId = new Array();
@ -1149,7 +1149,12 @@ export class EmployeePositionController extends Controller {
.andWhere(revisionCondition);
}),
)
.orderBy("posMaster.posMasterOrder", "ASC")
.orderBy("orgRoot.orgRootOrder", "ASC")
.addOrderBy("orgChild1.orgChild1Order", "ASC")
.addOrderBy("orgChild2.orgChild2Order", "ASC")
.addOrderBy("orgChild3.orgChild3Order", "ASC")
.addOrderBy("orgChild4.orgChild4Order", "ASC")
.addOrderBy("posMaster.posMasterOrder", "ASC")
.skip((body.page - 1) * body.pageSize)
.take(body.pageSize)
.getManyAndCount();
@ -1596,7 +1601,7 @@ export class EmployeePositionController extends Controller {
if (_posMaster != null)
throw new HttpError(
HttpStatusCode.NOT_FOUND,
`เลขที่ตำแหน่ง ${org.orgRootShortName}${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
`เลขที่ตำแหน่ง ${org.orgRootShortName} ${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
);
if (
posMaster.orgRootId == org.id &&
@ -1625,7 +1630,7 @@ export class EmployeePositionController extends Controller {
if (_posMaster != null)
throw new HttpError(
HttpStatusCode.NOT_FOUND,
`เลขที่ตำแหน่ง ${org.orgChild1ShortName}${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
`เลขที่ตำแหน่ง ${org.orgChild1ShortName} ${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
);
if (
posMaster.orgChild1Id == org.id &&
@ -1653,7 +1658,7 @@ export class EmployeePositionController extends Controller {
if (_posMaster != null)
throw new HttpError(
HttpStatusCode.NOT_FOUND,
`เลขที่ตำแหน่ง ${org.orgChild2ShortName}${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
`เลขที่ตำแหน่ง ${org.orgChild2ShortName} ${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
);
if (
posMaster.orgChild2Id == org.id &&
@ -1680,7 +1685,7 @@ export class EmployeePositionController extends Controller {
if (_posMaster != null)
throw new HttpError(
HttpStatusCode.NOT_FOUND,
`เลขที่ตำแหน่ง ${org.orgChild3ShortName}${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
`เลขที่ตำแหน่ง ${org.orgChild3ShortName} ${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
);
if (posMaster.orgChild3Id == org.id && posMaster.orgChild4Id == null) change = false;
posMaster.orgRootId = org.orgRootId;
@ -1702,7 +1707,7 @@ export class EmployeePositionController extends Controller {
if (_posMaster != null)
throw new HttpError(
HttpStatusCode.NOT_FOUND,
`เลขที่ตำแหน่ง ${org.orgChild4ShortName}${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
`เลขที่ตำแหน่ง ${org.orgChild4ShortName} ${posMaster.posMasterNo} มีอยู่ในระบบอยู่แล้ว`,
);
if (posMaster.orgChild4Id == org.id) change = false;
posMaster.orgRootId = org.orgRootId;