the serial letter normalization added to the code to normalize the Heh , Ya , Kaf and etc to the correct character

This commit is contained in:
2026-07-27 10:38:35 +03:30
parent 778544c321
commit 182db56e15
13 changed files with 337 additions and 11 deletions

View File

@@ -156,6 +156,7 @@ import {
resolvePartCaptureIndex,
} from "src/helpers/outer-damage-parts";
import { normalizeMoneyAmountString } from "src/utils/unicode-digits";
import { PlateNormalizerService } from "src/utils/plate-normalizer/plate-normalizer.service";
import {
CAPTURE_PHASE_DAMAGED_PARTY_DOC_KEYS,
@@ -352,6 +353,7 @@ export class ClaimRequestManagementService {
private readonly fanavaranLookupService: FanavaranLookupService,
private readonly fileMakerDbService: FileMakerDbService,
private readonly fieldExpertDbService: FieldExpertDbService,
private readonly plateNormalizer: PlateNormalizerService,
) {}
private requiredDocumentKeysV2(isCarBody: boolean): string[] {
@@ -503,7 +505,7 @@ export class ClaimRequestManagementService {
const ir = Number(irRaw);
const leftDigits = Number(leftRaw);
const centerDigits = Number(centerRaw);
const centerAlphabet = String(alphaRaw || "").trim();
const centerAlphabet = this.plateNormalizer.normalizePlateText(String(alphaRaw || ""));
if (
!Number.isFinite(ir) ||
!Number.isFinite(leftDigits) ||
@@ -530,11 +532,11 @@ export class ClaimRequestManagementService {
Number.isFinite(Number(p.leftDigits)) &&
Number.isFinite(Number(p.centerDigits)) &&
Number.isFinite(Number(p.ir)) &&
String(p.centerAlphabet || "").trim()
this.plateNormalizer.normalizePlateText(String(p.centerAlphabet || ""))
) {
return {
leftDigits: Number(p.leftDigits),
centerAlphabet: String(p.centerAlphabet).trim(),
centerAlphabet: this.plateNormalizer.normalizePlateText(String(p.centerAlphabet)),
centerDigits: Number(p.centerDigits),
ir: Number(p.ir),
};
@@ -3602,9 +3604,10 @@ export class ClaimRequestManagementService {
if (centerAlphabet == null) return null;
const raw = String(centerAlphabet).trim();
if (!raw) return null;
const asNumber = Number(raw);
const normalized = this.plateNormalizer.normalizePlateText(raw);
const asNumber = Number(normalized);
if (Number.isFinite(asNumber)) return asNumber;
return FANAVARAN_PLATE_LETTER_CODE[raw] ?? null;
return this.plateNormalizer.resolvePlateLetterCode(normalized, FANAVARAN_PLATE_LETTER_CODE);
}
private formatFanavaranPlateNo(