商品成本:线上单号保持业绩明细原始格式 #470

Merged
chenxi merged 1 commits from fix/chenxi-product-cost-preserve-bill-order-no into main 2026-10-23 13:49:51 +08:00
2 changed files with 7 additions and 1 deletions

View File

@ -307,6 +307,11 @@ class SyncStoreReceiptProductCost extends Command
$mismatchRows = 0;
foreach ($billByCore as $core => $bill) {
// 展示单号与业绩明细完全一致;$core 只用于订单侧清洗后匹配。
$displayOrderNo = (string) ($bill->online_order_no ?? '');
if ($displayOrderNo === '') {
$displayOrderNo = $core;
}
foreach ($this->costLines($lines[$core] ?? []) as $line) {
$short = $shortNames['by_provider'][$line['warehouse']] ?? '';
$price = $short !== '' ? ($prices[$short . "\0" . $line['sku']] ?? null) : null;
@ -370,7 +375,7 @@ class SyncStoreReceiptProductCost extends Command
'platform' => $bill->platform,
'occurred_date' => $bill->occurred_date,
'store_name' => $bill->store_name,
'online_order_no' => $core,
'online_order_no' => $displayOrderNo,
'warehouse' => $line['warehouse'] !== '' ? $line['warehouse'] : null,
'warehouse_short_name' => $short !== '' ? $short : null,
'product_code' => $line['sku'],

View File

@ -106,6 +106,7 @@
<div class="product-cost-note">
口径:以「业绩明细」的账单行为基数(发生时间 / 店铺名称 / 线上单号),按「店铺 + 线上订单号」展开订单侧商品行,
只取收入金额有数据且不为 0 的账单行,「种菜金额」有数据(&gt;0)的账单行整条排除、不参与匹配;
线上单号直接展示业绩明细中的原始格式;匹配订单时仍使用清洗后的核心单号。
一行 = 一个发货仓库的一个商品;发货仓库取订单的聚水潭仓库名称,
仓库简称按仓库映射表用「仓储方」匹配「仓库名含主仓」的那条取简称(没有主仓行时认同名仓库,
常州简尚家居有限公司对应映射表里的「配件单仓」行),