Add NocoDB invoice verification to reconcile deliveries automatically

Integrate NocoDB for automated invoice verification against delivery records, supporting both invoice reference and Bill of Lading number matching, with caching and improved UI feedback.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d
Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
michaelschal committed 2025-08-13 10:18:51 +00:00
1 parent 695cd8ad7c
commit 967f34ae7f
4 files changed
+474 -5

No files matched your search

+24 -1
View File
@@ -152,7 +152,24 @@ export const nocodbConfig = pgTable("nocodb_config", {
apiToken: varchar("api_token").notNull(), // Personal API Token
description: text("description"), // Description de la configuration
isActive: boolean("is_active").default(true), // Configuration active ou non
createdBy: varchar("created_by").notNull(),
createdBy: varchar("created_by"),
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
});
// Cache de vérification des factures pour éviter les re-vérifications
export const invoiceVerificationCache = pgTable("invoice_verification_cache", {
id: serial("id").primaryKey(),
cacheKey: varchar("cache_key", { length: 255 }).notNull(), // Clé unique de cache
groupId: integer("group_id").notNull(), // ID du magasin
invoiceReference: varchar("invoice_reference", { length: 255 }).notNull(), // Référence facture
supplierName: varchar("supplier_name", { length: 255 }), // Nom du fournisseur
exists: boolean("exists").notNull(), // Facture trouvée ou non
matchType: varchar("match_type", { length: 50 }).notNull(), // Type de correspondance (invoice_ref, bl_number)
errorMessage: text("error_message"), // Message d'erreur si applicable
cacheHit: boolean("cache_hit").default(false), // Cache hit ou non
apiCallTime: integer("api_call_time"), // Temps d'appel API en ms
expiresAt: timestamp("expires_at").notNull(), // Date d'expiration du cache
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow(),
});
@@ -444,6 +461,12 @@ export const insertNocodbConfigSchema = createInsertSchema(nocodbConfig).omit({
updatedAt: true,
});
export const insertInvoiceVerificationCacheSchema = createInsertSchema(invoiceVerificationCache).omit({
id: true,
createdAt: true,
updatedAt: true,
});
export const insertCustomerOrderSchema = createInsertSchema(customerOrders).omit({
id: true,
createdAt: true,