Merge branch 'develop' into feat/web-service-external
All checks were successful
Build & Deploy on Dev / build (push) Successful in 58s

* develop:
  แก้ format ฟิว posMasterNo (1)
This commit is contained in:
Warunee Tamkoo 2026-05-21 14:03:56 +07:00
commit 00d043b1fa
3 changed files with 37 additions and 36 deletions

View file

@ -2154,11 +2154,11 @@ export class PositionController extends Controller {
let checkChildConditions: any = {}; let checkChildConditions: any = {};
let keywordAsInt: any; let keywordAsInt: any;
let searchShortName = "1=1"; let searchShortName = "1=1";
let searchShortName0 = `CONCAT(orgRoot.orgRootShortName," ",posMaster.posMasterNo)`; let searchShortName0 = `CONCAT_WS(" ",orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName1 = `CONCAT(orgChild1.orgChild1ShortName," ",posMaster.posMasterNo)`; let searchShortName1 = `CONCAT_WS(" ",orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName2 = `CONCAT(orgChild2.orgChild2ShortName," ",posMaster.posMasterNo)`; let searchShortName2 = `CONCAT_WS(" ",orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName3 = `CONCAT(orgChild3.orgChild3ShortName," ",posMaster.posMasterNo)`; let searchShortName3 = `CONCAT_WS(" ",orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName4 = `CONCAT(orgChild4.orgChild4ShortName," ",posMaster.posMasterNo)`; let searchShortName4 = `CONCAT_WS(" ",orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let _data = await new permission().PermissionOrgList(request, "SYS_ORG"); let _data = await new permission().PermissionOrgList(request, "SYS_ORG");
if (body.type === 0) { if (body.type === 0) {
typeCondition = { typeCondition = {
@ -2168,7 +2168,7 @@ export class PositionController extends Controller {
checkChildConditions = { checkChildConditions = {
orgChild1Id: IsNull(), orgChild1Id: IsNull(),
}; };
searchShortName = `CONCAT(orgRoot.orgRootShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`; searchShortName = `CONCAT_WS(" ",orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} }
} else if (body.type === 1) { } else if (body.type === 1) {
typeCondition = { typeCondition = {
@ -2178,7 +2178,7 @@ export class PositionController extends Controller {
checkChildConditions = { checkChildConditions = {
orgChild2Id: IsNull(), orgChild2Id: IsNull(),
}; };
searchShortName = `CONCAT(orgChild1.orgChild1ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`; searchShortName = `CONCAT_WS(" ",orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} }
} else if (body.type === 2) { } else if (body.type === 2) {
typeCondition = { typeCondition = {
@ -2188,7 +2188,7 @@ export class PositionController extends Controller {
checkChildConditions = { checkChildConditions = {
orgChild3Id: IsNull(), orgChild3Id: IsNull(),
}; };
searchShortName = `CONCAT(orgChild2.orgChild2ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`; searchShortName = `CONCAT_WS(" ",orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} }
} else if (body.type === 3) { } else if (body.type === 3) {
typeCondition = { typeCondition = {
@ -2198,13 +2198,13 @@ export class PositionController extends Controller {
checkChildConditions = { checkChildConditions = {
orgChild4Id: IsNull(), orgChild4Id: IsNull(),
}; };
searchShortName = `CONCAT(orgChild3.orgChild3ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`; searchShortName = `CONCAT_WS(" ",orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} }
} else if (body.type === 4) { } else if (body.type === 4) {
typeCondition = { typeCondition = {
orgChild4Id: body.id, orgChild4Id: body.id,
}; };
searchShortName = `CONCAT(orgChild4.orgChild4ShortName," ",posMaster.posMasterNo) like '%${body.keyword}%'`; searchShortName = `CONCAT_WS(" ",orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} }
let findPosition: any; let findPosition: any;
let masterId = new Array(); let masterId = new Array();

View file

@ -6026,11 +6026,11 @@ export class ProfileController extends Controller {
} else if (searchField == "posNo") { } else if (searchField == "posNo") {
queryLike = ` queryLike = `
CASE CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
ELSE CONCAT(orgRoot.orgRootShortName, " ", current_holders.posMasterNo) ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
END LIKE :keyword END LIKE :keyword
`; `;
} }
@ -6616,11 +6616,11 @@ export class ProfileController extends Controller {
} else if (searchField == "posNo") { } else if (searchField == "posNo") {
queryLike = ` queryLike = `
CASE CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
ELSE CONCAT(orgRoot.orgRootShortName, " ", current_holders.posMasterNo) ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
END LIKE :keyword END LIKE :keyword
`; `;
} }
@ -6803,18 +6803,19 @@ export class ProfileController extends Controller {
.filter(Boolean) .filter(Boolean)
.join("\n"); .join("\n");
const numPart = holder ? [holder.posMasterNoPrefix, holder.posMasterNo, holder.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
const shortName = !holder const shortName = !holder
? null ? null
: holder.orgChild4 != null : holder.orgChild4 != null
? `${holder.orgChild4.orgChild4ShortName} ${holder.posMasterNo}` ? `${holder.orgChild4.orgChild4ShortName} ${numPart}`
: holder.orgChild3 != null : holder.orgChild3 != null
? `${holder.orgChild3.orgChild3ShortName} ${holder.posMasterNo}` ? `${holder.orgChild3.orgChild3ShortName} ${numPart}`
: holder.orgChild2 != null : holder.orgChild2 != null
? `${holder.orgChild2.orgChild2ShortName} ${holder.posMasterNo}` ? `${holder.orgChild2.orgChild2ShortName} ${numPart}`
: holder.orgChild1 != null : holder.orgChild1 != null
? `${holder.orgChild1.orgChild1ShortName} ${holder.posMasterNo}` ? `${holder.orgChild1.orgChild1ShortName} ${numPart}`
: holder.orgRoot != null : holder.orgRoot != null
? `${holder.orgRoot.orgRootShortName} ${holder.posMasterNo}` ? `${holder.orgRoot.orgRootShortName} ${numPart}`
: null; : null;
return { return {
@ -7009,11 +7010,11 @@ export class ProfileController extends Controller {
} else if (searchField == "posNo") { } else if (searchField == "posNo") {
queryLike = ` queryLike = `
CASE CASE
WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT(orgChild4.orgChild4ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild4Id IS NOT NULL THEN CONCAT_WS(" ", orgChild4.orgChild4ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild3Id IS NOT NULL THEN CONCAT_WS(" ", orgChild3.orgChild3ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT(orgChild2.orgChild2ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild2Id IS NOT NULL THEN CONCAT_WS(" ", orgChild2.orgChild2ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT(orgChild1.orgChild1ShortName, " ", current_holders.posMasterNo) WHEN current_holders.orgChild1Id IS NOT NULL THEN CONCAT_WS(" ", orgChild1.orgChild1ShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
ELSE CONCAT(orgRoot.orgRootShortName, " ", current_holders.posMasterNo) ELSE CONCAT_WS(" ", orgRoot.orgRootShortName, current_holders.posMasterNoPrefix, current_holders.posMasterNo, current_holders.posMasterNoSuffix)
END LIKE :keyword END LIKE :keyword
`; `;
} }
@ -7190,7 +7191,7 @@ export class ProfileController extends Controller {
.filter(Boolean) .filter(Boolean)
.join("\n"); .join("\n");
const numPart = holder ? `${holder.posMasterNoPrefix ?? ''}${holder.posMasterNo ?? ''}${holder.posMasterNoSuffix ?? ''}` : ''; const numPart = holder ? [holder.posMasterNoPrefix, holder.posMasterNo, holder.posMasterNoSuffix].filter((p) => p !== null && p !== undefined && p !== '').join(' ') : '';
const shortName = !holder const shortName = !holder
? null ? null

View file

@ -101,7 +101,7 @@ export function getOrgFullName(posMaster: PosMaster): string {
} }
/** /**
* "กทม. กบ.1234ช" * "กทม. กบ. 1234 ช"
*/ */
export function getPosMasterNo(posMaster: PosMaster): string { export function getPosMasterNo(posMaster: PosMaster): string {
const orgShortName = getOrgShortName(posMaster); const orgShortName = getOrgShortName(posMaster);
@ -110,5 +110,5 @@ export function getPosMasterNo(posMaster: PosMaster): string {
posMaster.posMasterNo, posMaster.posMasterNo,
posMaster.posMasterNoSuffix, posMaster.posMasterNoSuffix,
].filter((part) => part !== null && part !== undefined); ].filter((part) => part !== null && part !== undefined);
return `${orgShortName} ${parts.join('')}`; return `${orgShortName} ${parts.join(' ')}`;
} }