南昌樵舍仓:江西仓送货的采购单据条码一并纳入行维度,采购数量合计与江西仓送货一致

This commit is contained in:
chenxi 2026-09-29 20:21:02 +08:00
parent 27c351f0c5
commit e54b7f8d25

View File

@ -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;