mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-21 14:08:15 +02:00
Merge pull request #490 from R0m1k3/1.1
Improve date handling for delivery due dates
This commit is contained in:
3 files changed
+214
-4
No files matched your search
+201
@@ -0,0 +1,201 @@
|
|||||||
|
|
||||||
|
|
||||||
|
✅ PRODUCTION: getDelivery #427 found associated order #256 with status: delivered
|
||||||
|
|
||||||
|
🔄 Updating delivery: { id: 427, data: { invoiceReference: '197771' }, user: 'admin_local' }
|
||||||
|
|
||||||
|
🔍 [INVOICE] Début vérification facture: { invoiceReference: '197771', groupId: 1, forceRefresh: true }
|
||||||
|
|
||||||
|
🔄 [INVOICE] Refresh forcé, ignorant le cache
|
||||||
|
|
||||||
|
🔧 Configuration groupe: {
|
||||||
|
|
||||||
|
groupName: 'Frouard',
|
||||||
|
|
||||||
|
hasNocodbConfig: true,
|
||||||
|
|
||||||
|
hasTableName: true,
|
||||||
|
|
||||||
|
hasWebhook: true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔍 Vérification NocoDB en production...
|
||||||
|
|
||||||
|
🔧 Configuration NocoDB active récupérée: {
|
||||||
|
|
||||||
|
id: 1,
|
||||||
|
|
||||||
|
name: 'Nocodb',
|
||||||
|
|
||||||
|
baseUrl: 'https://nocodb.ffnancy.fr',
|
||||||
|
|
||||||
|
projectId: 'pcg4uw79ukvycxc',
|
||||||
|
|
||||||
|
apiToken: 'z4BAwLo6dgoN_E7PKJSHN7PA7kdBePtKOYcsDlwQ',
|
||||||
|
|
||||||
|
description: '',
|
||||||
|
|
||||||
|
isActive: true,
|
||||||
|
|
||||||
|
createdBy: 'admin_local',
|
||||||
|
|
||||||
|
createdAt: 2025-07-22T11:12:54.971Z,
|
||||||
|
|
||||||
|
updatedAt: 2025-07-25T23:07:17.197Z
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔧 Configuration NocoDB trouvée: {
|
||||||
|
|
||||||
|
configName: 'Nocodb',
|
||||||
|
|
||||||
|
baseUrl: 'https://nocodb.ffnancy.fr',
|
||||||
|
|
||||||
|
projectId: 'pcg4uw79ukvycxc',
|
||||||
|
|
||||||
|
hasToken: true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔧 Utilisation table ID: {
|
||||||
|
|
||||||
|
groupTable: 'CommandeF',
|
||||||
|
|
||||||
|
configuredId: 'mrr733dfb8wtt9b',
|
||||||
|
|
||||||
|
resolvedId: 'mrr733dfb8wtt9b'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔍 Recherche NocoDB: { tableId: 'mrr733dfb8wtt9b', column: 'RefFacture' }
|
||||||
|
|
||||||
|
💾 [CACHE] Tentative sauvegarde: {
|
||||||
|
|
||||||
|
invoiceReference: '197771',
|
||||||
|
|
||||||
|
groupId: 1,
|
||||||
|
|
||||||
|
cacheKey: '1_197771',
|
||||||
|
|
||||||
|
exists: true,
|
||||||
|
|
||||||
|
isReconciled: false,
|
||||||
|
|
||||||
|
cacheType: 'temporaire 6h (trouvé)',
|
||||||
|
|
||||||
|
expiresAt: '2025-11-03T23:28:12.943Z'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Error updating delivery: TypeError: value.toISOString is not a function
|
||||||
|
|
||||||
|
at PgTimestamp.mapToDriverValue (file:///app/node_modules/drizzle-orm/pg-core/columns/timestamp.js:34:18)
|
||||||
|
|
||||||
|
at file:///app/node_modules/drizzle-orm/sql/sql.js:131:73
|
||||||
|
|
||||||
|
at Array.map (<anonymous>)
|
||||||
|
|
||||||
|
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||||
|
|
||||||
|
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||||
|
|
||||||
|
at Array.map (<anonymous>)
|
||||||
|
|
||||||
|
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||||
|
|
||||||
|
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||||
|
|
||||||
|
at Array.map (<anonymous>)
|
||||||
|
|
||||||
|
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||||
|
|
||||||
|
✅ [CACHE] Résultat sauvé en cache: {
|
||||||
|
|
||||||
|
␍ id: 31803,
|
||||||
|
|
||||||
|
invoiceReference: '197771',
|
||||||
|
|
||||||
|
groupId: 1,
|
||||||
|
|
||||||
|
exists: true,
|
||||||
|
|
||||||
|
isReconciled: false,
|
||||||
|
|
||||||
|
cacheType: 'temporaire 6h (trouvé)',
|
||||||
|
|
||||||
|
cacheKey: '1_197771'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
📅 Date d'échéance récupérée et normalisée: 2025-11-29 (original: 2025-11-29)
|
||||||
|
|
||||||
|
PUT /api/deliveries/427 500 in 339ms
|
||||||
|
|
||||||
|
🔍 Recherche NocoDB: { tableId: 'mrr733dfb8wtt9b', column: 'Numero_BL' }
|
||||||
|
|
||||||
|
💾 [CACHE] Tentative sauvegarde: {
|
||||||
|
|
||||||
|
invoiceReference: '197771',
|
||||||
|
|
||||||
|
groupId: 1,
|
||||||
|
|
||||||
|
cacheKey: '1_197771',
|
||||||
|
|
||||||
|
exists: true,
|
||||||
|
|
||||||
|
isReconciled: false,
|
||||||
|
|
||||||
|
cacheType: 'temporaire 6h (trouvé)',
|
||||||
|
|
||||||
|
expiresAt: '2025-11-03T23:28:12.963Z'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
✅ [CACHE] Résultat sauvé en cache: {
|
||||||
|
|
||||||
|
␍ id: 31803,
|
||||||
|
|
||||||
|
invoiceReference: '197771',
|
||||||
|
|
||||||
|
groupId: 1,
|
||||||
|
|
||||||
|
exists: true,
|
||||||
|
|
||||||
|
isReconciled: false,
|
||||||
|
|
||||||
|
cacheType: 'temporaire 6h (trouvé)',
|
||||||
|
|
||||||
|
cacheKey: '1_197771'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
📅 Date d'échéance récupérée et normalisée: 2025-11-29 (original: 2025-11-29)
|
||||||
|
|
||||||
|
Error updating delivery: TypeError: value.toISOString is not a function
|
||||||
|
|
||||||
|
at PgTimestamp.mapToDriverValue (file:///app/node_modules/drizzle-orm/pg-core/columns/timestamp.js:34:18)
|
||||||
|
|
||||||
|
at file:///app/node_modules/drizzle-orm/sql/sql.js:131:73
|
||||||
|
|
||||||
|
at Array.map (<anonymous>)
|
||||||
|
|
||||||
|
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||||
|
|
||||||
|
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||||
|
|
||||||
|
at Array.map (<anonymous>)
|
||||||
|
|
||||||
|
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||||
|
|
||||||
|
at file:///app/node_modules/drizzle-orm/sql/sql.js:95:21
|
||||||
|
|
||||||
|
at Array.map (<anonymous>)
|
||||||
|
|
||||||
|
at SQL.buildQueryFromSourceParams (file:///app/node_modules/drizzle-orm/sql/sql.js:73:32)
|
||||||
|
|
||||||
|
PUT /api/deliveries/427 500 in 50ms
|
||||||
|
|
||||||
|
HEAD /api/health 200 in 1ms
|
||||||
|
|
||||||
|
HEAD /api/health 200 in 1ms
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
+13
-4
@@ -415,8 +415,10 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
|
|
||||||
if (result.exists && result.dueDate) {
|
if (result.exists && result.dueDate) {
|
||||||
// Normaliser la date avant de la stocker
|
// Normaliser la date avant de la stocker
|
||||||
const normalizedDate = normalizeDateString(result.dueDate);
|
const normalizedDateString = normalizeDateString(result.dueDate);
|
||||||
if (normalizedDate) {
|
if (normalizedDateString) {
|
||||||
|
// Convertir la string normalisée en objet Date pour Drizzle
|
||||||
|
const normalizedDate = new Date(normalizedDateString);
|
||||||
// Mettre à jour deliveries avec la date normalisée (caching)
|
// Mettre à jour deliveries avec la date normalisée (caching)
|
||||||
await storage.updateDelivery(delivery.id, { dueDate: normalizedDate });
|
await storage.updateDelivery(delivery.id, { dueDate: normalizedDate });
|
||||||
delivery.dueDate = normalizedDate;
|
delivery.dueDate = normalizedDate;
|
||||||
@@ -1449,8 +1451,15 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
|
|
||||||
if (result.exists && result.dueDate) {
|
if (result.exists && result.dueDate) {
|
||||||
// Normaliser la date avant de la stocker
|
// Normaliser la date avant de la stocker
|
||||||
data.dueDate = normalizeDateString(result.dueDate);
|
const normalizedDateString = normalizeDateString(result.dueDate);
|
||||||
console.log(`📅 Date d'échéance récupérée et normalisée: ${data.dueDate} (original: ${result.dueDate})`);
|
if (normalizedDateString) {
|
||||||
|
// Convertir la string normalisée en objet Date pour Drizzle
|
||||||
|
data.dueDate = new Date(normalizedDateString);
|
||||||
|
console.log(`📅 Date d'échéance récupérée et normalisée: ${normalizedDateString} (original: ${result.dueDate})`);
|
||||||
|
} else {
|
||||||
|
data.dueDate = null;
|
||||||
|
console.log(`📅 Date d'échéance invalide, ignorée`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
data.dueDate = null;
|
data.dueDate = null;
|
||||||
console.log(`📅 Aucune date d'échéance trouvée dans NocoDB`);
|
console.log(`📅 Aucune date d'échéance trouvée dans NocoDB`);
|
||||||
|
|||||||
Reference in new issue
Block a user