u
This commit is contained in:
@@ -153,10 +153,27 @@ export async function executeCompanyImport({
|
||||
// MARK: - Phase 4: Orders / Receipts
|
||||
// #region Phase 4: Orders / Receipts
|
||||
const allArtIdToSku = new Map();
|
||||
const parentSkus = new Set(articlesResult.parentSkus || []);
|
||||
const parentIds = new Set();
|
||||
for (const a of artRecords) {
|
||||
const kArt = cleanValue(a.id ?? a.kArtikel);
|
||||
const sku = cleanValue(a.sku ?? a.cArtNr);
|
||||
if (kArt && sku) allArtIdToSku.set(kArt, sku);
|
||||
|
||||
const pid = cleanValue(a.parentid ?? a.kVaterArtikel);
|
||||
if (pid && pid !== '0') parentIds.add(pid);
|
||||
const isParent = a.is_parent === '1' || a.nIstVater === '1';
|
||||
if (isParent) {
|
||||
if (kArt) parentIds.add(kArt);
|
||||
if (sku) parentSkus.add(sku);
|
||||
}
|
||||
}
|
||||
for (const a of artRecords) {
|
||||
const kArt = cleanValue(a.id ?? a.kArtikel);
|
||||
if (kArt && parentIds.has(kArt)) {
|
||||
const sku = cleanValue(a.sku ?? a.cArtNr);
|
||||
if (sku) parentSkus.add(sku);
|
||||
}
|
||||
}
|
||||
|
||||
const ordersResult = await importOrders({
|
||||
@@ -165,6 +182,7 @@ export async function executeCompanyImport({
|
||||
manRecords,
|
||||
itemRecords,
|
||||
jtlArtIdToSku: allArtIdToSku,
|
||||
parentSkus,
|
||||
progressTracker,
|
||||
});
|
||||
// #endregion
|
||||
|
||||
Reference in New Issue
Block a user