Optimize order and product import scripts with improved performance and incremental update handling

- Refactor orders import to use temporary tables for more efficient data processing
- Improve batch processing and memory management in order import script
- Update product import to use temporary tables for inventory status
- Modify purchase orders import to use updated timestamp for incremental updates
- Enhance error handling and logging for import processes
This commit is contained in:
2025-01-30 21:13:53 -05:00
parent c433f1aae8
commit b506f89dd7
4 changed files with 357 additions and 274 deletions

View File

@@ -29,7 +29,7 @@ async function importPurchaseOrders(prodConnection, localConnection, incremental
// Build incremental conditions
const incrementalWhereClause = incrementalUpdate
? `AND (
p.stamp > ?
p.date_updated > ?
OR p.date_modified > ?
OR p.date_ordered > ?
OR p.date_estin > ?
@@ -81,7 +81,7 @@ async function importPurchaseOrders(prodConnection, localConnection, incremental
USE INDEX (idx_date_created)
WHERE date_ordered >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR)
AND (date_ordered > ?
OR stamp > ?
OR date_updated > ?
OR date_modified > ?)
UNION
SELECT DISTINCT r.receiving_id as po_id