fix: trim()
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m4s

This commit is contained in:
Adisak 2026-01-14 15:41:10 +07:00
parent 96a2d34c1f
commit 709a4e1ac6

View file

@ -598,8 +598,8 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
const posMasterActMap = new Map<ActKey, PosMasterAct[]>();
for (const act of oldposMasterAct) {
const parentDNA = act.posMaster.ancestorDNA.trim();
const childDNA = act.posMasterChild.ancestorDNA.trim();
const parentDNA = act.posMaster?.ancestorDNA?.trim() ?? '';
const childDNA = act.posMasterChild?.ancestorDNA?.trim() ?? '';
const key = `${parentDNA}|${childDNA}`;
if (!posMasterActMap.has(key)) {
@ -610,7 +610,7 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
const posMasterIdMap = new Map<string, string>();
for (const pm of posMaster) {
posMasterIdMap.set(pm.ancestorDNA.trim(), pm.id);
posMasterIdMap.set(pm.ancestorDNA?.trim() ?? '', pm.id);
}
const _null: any = null;
@ -666,8 +666,8 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
}
for (const act of oldposMasterAct) {
const parentDNA = act.posMaster.ancestorDNA.trim().toLowerCase();
const childDNA = act.posMasterChild.ancestorDNA.trim().toLowerCase();
const parentDNA = act.posMaster?.ancestorDNA?.trim()?.toLowerCase() ?? '';
const childDNA = act.posMasterChild?.ancestorDNA?.trim()?.toLowerCase() ?? '';
const newParentId = posMasterIdMap.get(parentDNA);
const newChildId = posMasterIdMap.get(childDNA);