9 Commits
Author SHA1 Message Date
Claude c5b0896bb4 fix: dedupe foucad rows by foucode before full refresh
The source MSSQL FOUCAD table can return several rows for the same
FOUCODE, but the PostgreSQL foucad table uses foucode as PRIMARY KEY.
The bulk INSERT in fullRefresh has no conflict handling, so duplicate
FOUCODE values triggered:

  duplicate key value violates unique constraint "foucad_pkey"

Deduplicate by foucode before insert, keeping the most recently
modified row (suividatemodif). Routes join foucad 1:1 on foucode, so
one config row per supplier code is the intended shape.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ad1qwhDEHNniSUDveTQHL
2026-06-29 06:30:00 +00:00
MichaelandClaude Sonnet 4.6 c75fd5c56d fix: utiliser FOUPORT2.SEUIL comme source principale du franco fournisseur
FOUCAD ne couvre que 53/153 fournisseurs actifs (commande auto uniquement).
FOUPORT2.SEUIL est la source officielle de l'ERP et couvre 108 fournisseurs.
4 fournisseurs dans COMMANDE_AUTO_QTEPROPO n'avaient pas de franco visible
(IMDIFA, MYCANDYSHOP, PTIT CLOWN, PUCKATOR BV).

- Sync : ajout de FOUPORT et FOUPORT2 dans le pipeline de synchronisation
- API : franco = COALESCE(fouport2.seuil, foucad.franco) dans les deux routes
- Schema PG : création des tables fouport et fouport2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 15:58:15 +02:00
Michael 5a5bc8b6f3 feat: add sync script for procurement tables including orders, lines, and reordering plans 2026-04-09 08:19:55 +02:00
Michael d74cdeb7b3 feat: implement automated procurement synchronization and API endpoints for supply chain management 2026-04-09 08:18:10 +02:00
MichaelandClaude Sonnet 4.6 6e5bc3bc07 feat: ajout endpoint /api/commandes-auto avec franco fournisseur
- Nouvelle route GET /api/commandes-auto : propositions par site et fournisseur
  avec comparaison au franco (franco_atteint, ecart_franco)
- Nouvelle route GET /api/commandes-auto/:codefou : détail articles d'un fournisseur
- Sync FOUCAD (config commande auto + franco) vers PostgreSQL
- Ajout table foucad dans init.sql

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 15:24:51 +02:00
Michael d885f51bdb feat: add sync script for appro tables including commande_fou, cdefou_ligne, commande_auto_qtepropo, and plan_reappro 2026-03-30 18:34:24 +02:00
Michael e629a1c699 feat: implement provisioning and synchronization logic for procurement tables 2026-03-30 17:59:51 +02:00
Michael 624d9ab851 feat: add sync logic for procurement tables including orders, lines, and reappro plans 2026-03-30 13:11:49 +02:00
Michael 3f23f181f4 feat: Implement initial PostgreSQL schema and synchronization scripts for various data tables. 2026-03-30 12:43:41 +02:00