feat: #10000 盘点导入数据更新,过滤空数据

This commit is contained in:
赵世界 2023-01-28 09:48:28 +08:00
parent 1c4e9cc040
commit 73285afbc1

View File

@ -82,6 +82,7 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
->pluck('id') ->pluck('id')
->toArray(); ->toArray();
$downSkuIds = array_diff($onSkuIds, $updateIds); $downSkuIds = array_diff($onSkuIds, $updateIds);
if ($downSkuIds) {
$goodsSkus = GoodsSku::query()->whereIn('id', $downSkuIds) $goodsSkus = GoodsSku::query()->whereIn('id', $downSkuIds)
->get(['id', 'yesterday_num', 'stock']) ->get(['id', 'yesterday_num', 'stock'])
->toArray(); ->toArray();
@ -91,6 +92,7 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
'stock' => 0, 'stock' => 0,
]); ]);
} }
}
sleep(2); sleep(2);
event(new StockUpdateEvent($onSkuIds, 1)); event(new StockUpdateEvent($onSkuIds, 1));
} }