forked from Yara724/api
vehicle hull accessories debug , either success or clear YARA error
This commit is contained in:
@@ -215,7 +215,7 @@ import {
|
||||
FANAVARAN_HULL_DMG_KIND_CAPTION,
|
||||
findLookupIdByCaption,
|
||||
asHullDmgAccessoryRows,
|
||||
resolveVehicleHullAccessoryId,
|
||||
resolveHullDmgSectionAccessory,
|
||||
} from './fanavaran-hull-expertise-lookups';
|
||||
import {
|
||||
validateFanavaranHullLookupIds,
|
||||
@@ -2769,7 +2769,11 @@ export class ClaimRequestManagementService {
|
||||
);
|
||||
|
||||
let accessories = asHullDmgAccessoryRows([]);
|
||||
if (policyId == null && input.parts.length > 0) input.warnings.push('VehicleHullAccessoryId cannot be resolved: missing PolicyId.');
|
||||
if (policyId == null && input.parts.length > 0) {
|
||||
input.warnings.push(
|
||||
'VehicleHullAccessoryId cannot be resolved: missing PolicyId for hull policy dmg-accessories.',
|
||||
);
|
||||
}
|
||||
if (policyId != null && input.parts.length > 0) {
|
||||
try {
|
||||
accessories = asHullDmgAccessoryRows(
|
||||
@@ -2779,9 +2783,19 @@ export class ClaimRequestManagementService {
|
||||
contractOptions,
|
||||
),
|
||||
);
|
||||
if (accessories.length === 0) {
|
||||
input.warnings.push(
|
||||
`VehicleHullAccessoryId cannot be resolved: policy ${policyId} dmg-accessories returned no rows.`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
const message =
|
||||
error instanceof Error ? error.message : String(error);
|
||||
this.logger.warn(
|
||||
`[buildCarBodyFanavaranExpertisePayload] policy ${policyId} dmg-accessories lookup failed: ${error instanceof Error ? error.message : error}`,
|
||||
`[buildCarBodyFanavaranExpertisePayload] policy ${policyId} dmg-accessories lookup failed: ${message}`,
|
||||
);
|
||||
input.warnings.push(
|
||||
`VehicleHullAccessoryId cannot be resolved: policy ${policyId} dmg-accessories lookup failed (${message}).`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2828,21 +2842,28 @@ export class ClaimRequestManagementService {
|
||||
0,
|
||||
);
|
||||
|
||||
const hullSections = input.parts.map((part: any) => {
|
||||
const vehicleHullAccessoryId = resolveVehicleHullAccessoryId(
|
||||
const hullSections = input.parts.map((part: any, index: number) => {
|
||||
const partLabel = this.fanavaranPartLabel(part);
|
||||
const resolved = resolveHullDmgSectionAccessory(
|
||||
accessories,
|
||||
parseFanavaranId(part?.partId),
|
||||
partLabel,
|
||||
);
|
||||
if (!resolved) {
|
||||
input.warnings.push(
|
||||
`DmgSections[${index}] (${partLabel || part?.partId || 'part'}): no matching row in policy ${policyId ?? '(missing)'} dmg-accessories for AccessoryKindId=${part?.partId ?? '(missing)'}. Refusing to invent VehicleHullAccessoryId.`,
|
||||
);
|
||||
}
|
||||
return toFanavaranHullExpertiseDmgSection({
|
||||
partId: part?.partId,
|
||||
desc: this.fanavaranPartLabel(part),
|
||||
partId: resolved?.accessoryKindId ?? part?.partId,
|
||||
desc: partLabel,
|
||||
wasteValue: this.fanavaranDaghiWasteValue(part?.daghi),
|
||||
amount:
|
||||
this.parseFanavaranMoney(part?.price) +
|
||||
this.parseFanavaranMoney(part?.salary),
|
||||
dmgKindId,
|
||||
dmgCostKindId,
|
||||
vehicleHullAccessoryId,
|
||||
vehicleHullAccessoryId: resolved?.vehicleHullAccessoryId ?? null,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5899,10 +5920,19 @@ export class ClaimRequestManagementService {
|
||||
catalogKey?: unknown;
|
||||
};
|
||||
return String(
|
||||
d.label_fa ?? d.part ?? d.name ?? d.catalogKey ?? part?.partId ?? '',
|
||||
d.label_fa ??
|
||||
d.part ??
|
||||
d.name ??
|
||||
d.catalogKey ??
|
||||
part?.partName ??
|
||||
part?.name ??
|
||||
part?.partId ??
|
||||
'',
|
||||
);
|
||||
}
|
||||
return String(damage ?? part?.partId ?? '');
|
||||
return String(
|
||||
damage ?? part?.partName ?? part?.name ?? part?.partId ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
private fanavaranDaghiWasteValue(daghi: unknown): number {
|
||||
|
||||
Reference in New Issue
Block a user