mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-15 19:28:52 +02:00
feat: Add FF Nancy API client and status endpoint, implement grid product fetching and draft change saving, and introduce AI Copilot core logic.
This commit is contained in:
1 parent
22aa6f101a
commit
1035489db1
13 files changed
+706
-265
No files matched your search
@@ -154,6 +154,25 @@ SI AUCUNE RÈGLE MANAGER n'est définie, tu recommandes UNIQUEMENT A ou Z (jamai
|
||||
lines.push(` → ${scoreRelatif >= 100 ? "✓ Au-dessus de la moyenne" : scoreRelatif >= 50 ? "⚠️ Entre 50% et 100% de la moyenne" : "✗ Très en dessous de la moyenne"}`);
|
||||
lines.push("");
|
||||
|
||||
// Bloc stock & approvisionnement (si données disponibles)
|
||||
const hasStockData = ctx.stockCoverage !== undefined || ctx.isLowStock || ctx.isDeadInventory || ctx.isCommandeEnCours;
|
||||
if (hasStockData) {
|
||||
lines.push(`--- STOCK & APPROVISIONNEMENT ---`);
|
||||
if (ctx.stockCoverage > 0) {
|
||||
lines.push(`• Couverture stock : ${ctx.stockCoverage.toFixed(1)} mois de ventes en stock`);
|
||||
}
|
||||
if (ctx.isLowStock) {
|
||||
lines.push(`• ⚠️ Stock faible : moins d'un PCB disponible`);
|
||||
}
|
||||
if (ctx.isDeadInventory) {
|
||||
lines.push(`• ⚠️ Stock dormant : pas de vente depuis > 90 jours`);
|
||||
}
|
||||
if (ctx.isCommandeEnCours) {
|
||||
lines.push(`• Commande en cours : réapprovisionnement prévu`);
|
||||
}
|
||||
lines.push("");
|
||||
}
|
||||
|
||||
lines.push(`Génère UNIQUEMENT le JSON :`);
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
@@ -127,6 +127,16 @@ export interface ProductContextProfile {
|
||||
*/
|
||||
isLocomotiveRayon: boolean;
|
||||
|
||||
// Signaux stock & approvisionnement (API FF Nancy)
|
||||
/** Stock actuel ≤ PCB → moins d'un conditionnement disponible */
|
||||
isLowStock: boolean;
|
||||
/** Commande fournisseur en cours */
|
||||
isCommandeEnCours: boolean;
|
||||
/** Stock > 0 mais pas de vente depuis > 90 jours */
|
||||
isDeadInventory: boolean;
|
||||
/** Couverture en mois : stockActuel / (totalQuantite / 12) */
|
||||
stockCoverage: number;
|
||||
|
||||
// Gardes-fous (issus du ScoringEngine)
|
||||
isProtected: boolean;
|
||||
protectionReason: string;
|
||||
@@ -405,6 +415,17 @@ export class ContextProfiler {
|
||||
isProtected,
|
||||
protectionReason,
|
||||
scoreCritique,
|
||||
|
||||
// Stock & approvisionnement
|
||||
isLowStock: (target.stockActuel !== undefined && target.pcb !== undefined && target.pcb > 0)
|
||||
? target.stockActuel <= target.pcb
|
||||
: false,
|
||||
isCommandeEnCours: (target.commandesEnCours ?? 0) > 0,
|
||||
isDeadInventory: (target.stockTotal ?? 0) > 0 && (target.nbJoursDerniereVente ?? 0) > 90,
|
||||
stockCoverage: (() => {
|
||||
const avgMonthlyQty = (target.totalQuantite ?? 0) / 12;
|
||||
return avgMonthlyQty > 0 ? (target.stockActuel ?? 0) / avgMonthlyQty : 0;
|
||||
})(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,13 @@ export interface ProductAnalysisInput {
|
||||
};
|
||||
/** Optional context rules for the supplier */
|
||||
supplierContext?: string;
|
||||
/** Données stock & approvisionnement (API FF Nancy) */
|
||||
stockActuel?: number;
|
||||
stockTotal?: number;
|
||||
pcb?: number;
|
||||
commandesEnCours?: number;
|
||||
nbJoursDerniereVente?: number;
|
||||
derniereVente?: string;
|
||||
|
||||
/**
|
||||
* Fiche de contexte enrichie générée par le ContextProfiler.
|
||||
|
||||
Reference in new issue
Block a user