diff --git a/app/Console/Commands/ImportProductMonthlyWeightedAverageBase.php b/app/Console/Commands/ImportProductMonthlyWeightedAverageBase.php index 85505578..5d2ee2e2 100644 --- a/app/Console/Commands/ImportProductMonthlyWeightedAverageBase.php +++ b/app/Console/Commands/ImportProductMonthlyWeightedAverageBase.php @@ -106,6 +106,27 @@ class ImportProductMonthlyWeightedAverageBase extends Command $isDelivery ? $deliveryRows++ : $mirrorRows++; } + // 南昌樵舍仓的采购数量取自"简尚-江西仓送货主仓",这些条码也要一并纳入行维度, + // 否则只存在于江西仓送货的单据会因为表里没有对应行而丢掉采购数量。 + foreach (array_keys($jiangxiPurchase) as $code) { + $rowKey = $this->rowKey($month, '南昌樵舍仓', $code); + if (isset($payload[$rowKey])) { + continue; + } + $payload[$rowKey] = [ + 'report_month' => $month->toDateString(), + 'row_key' => $rowKey, + 'barcode_warehouse' => '南昌樵舍仓' . $code, + 'warehouse_short_name' => '南昌樵舍仓', + 'product_code' => $code, + 'opening_unit_price' => null, + 'previous_pricing_status' => null, + 'base_source' => 'mirror', + 'imported_at' => $now, + ]; + $mirrorRows++; + } + $matched = 0; foreach ($payload as $key => $row) { $item = $inventory[$row['warehouse_short_name'] . "\0" . $row['product_code']] ?? null;