feat(legacy-sync): filet adresse — géocodage inverse (pin fibre) quand coords mais pas d'adresse
Un job avec des coords résolues mais AUCUNE adresse texte (compte/delivery/facturation vides) reçoit maintenant une adresse APPROXIMATIVE via reverseNearestFibre (pin fibre le plus proche), marquée « ≈ … (approx. GPS) » → le dispatch n'est jamais aveugle quand on a au moins une position. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
257924c9c6
commit
cb03f222ef
|
|
@ -657,6 +657,12 @@ async function buildJob (t, { dryRun = false } = {}) {
|
|||
const tc = await townCenterFromSubject(t.subject)
|
||||
if (tc) { payload.latitude = tc.lat; payload.longitude = tc.lon; coordSrc = 'ville_centre'; if (!payload.address) payload.address = tc.ville + ' (secteur — adresse à confirmer)' }
|
||||
}
|
||||
// FILET ADRESSE : des coords résolues mais AUCUNE adresse texte (compte/delivery/facturation vides) → géocodage INVERSE
|
||||
// sur le pin fibre le plus proche → adresse APPROXIMATIVE (marquée) pour que le dispatch ne soit jamais aveugle.
|
||||
if (!payload.address && payload.latitude != null && payload.longitude != null) {
|
||||
const rev = await reverseNearestFibre(payload.latitude, payload.longitude)
|
||||
if (rev && rev.address) payload.address = ('≈ ' + rev.address + ' (approx. GPS)').slice(0, 140)
|
||||
}
|
||||
return { legacy_id: String(t.id), payload, matched: { customer: !!cust, service_location: !!sl, customer_name: cname, coords: !!coordSrc, coord_src: coordSrc, delivery_id: t.delivery_id || null, parent: Number(t.parent) || 0 }, dept: t.dept, addr }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user