From fce31f0c094d957d27e24497a1147f4b44fd5080 Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 20 Oct 2026 14:12:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=88=90=E6=9C=AC=EF=BC=9A?= =?UTF-8?q?=E7=A7=8D=E8=8F=9C=E9=87=91=E9=A2=9D=E6=9C=89=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E8=B4=A6=E5=8D=95=E8=A1=8C=E6=95=B4=E6=9D=A1=E6=8E=92?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 账单侧按业绩明细取数时,除「收入金额有数据且不为 0」外,再排除 planting_amount > 0 的账单行 (种菜订单整条不参与商品成本匹配),页面口径说明同步补充。 --- app/Console/Commands/SyncStoreReceiptProductCost.php | 7 ++++++- .../pages/financial-operations/product-costs.blade.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/SyncStoreReceiptProductCost.php b/app/Console/Commands/SyncStoreReceiptProductCost.php index 6241ec7d..23ad2683 100644 --- a/app/Console/Commands/SyncStoreReceiptProductCost.php +++ b/app/Console/Commands/SyncStoreReceiptProductCost.php @@ -120,10 +120,15 @@ class SyncStoreReceiptProductCost extends Command // 账单侧取数:业绩明细里本月(可按平台限定)的账单行,一行 = 一个店铺的一个订单。 // 只取「收入金额有数据且不为 0」的账单行:收入为 0 的行是补出来的优惠/冲减/无收款账单行, // 没有对应的收款商品,不参与商品成本。 + // 「种菜金额」有数据(>0)的账单行整条排除,不参与匹配。 $billQuery = $mirror->table(self::SOURCE_TABLE) ->where('report_month', $reportMonth) ->whereNotNull('income_amount') - ->where('income_amount', '!=', 0); + ->where('income_amount', '!=', 0) + ->where(static function ($query): void { + $query->whereNull('planting_amount') + ->orWhere('planting_amount', '<=', 0); + }); if ($platform !== '') { $billQuery->where('platform', $platform); } diff --git a/resources/views/business/pages/financial-operations/product-costs.blade.php b/resources/views/business/pages/financial-operations/product-costs.blade.php index e2326cab..3949b202 100644 --- a/resources/views/business/pages/financial-operations/product-costs.blade.php +++ b/resources/views/business/pages/financial-operations/product-costs.blade.php @@ -113,7 +113,8 @@
口径:以「业绩明细」的账单行为基数(发生时间 / 店铺名称 / 线上单号),按「店铺 + 线上订单号」展开订单侧商品行, - 只取收入金额有数据且不为 0 的账单行,一行 = 一个发货仓库的一个商品;发货仓库取订单的聚水潭仓库名称,仓库简称查仓库映射表, + 只取收入金额有数据且不为 0 的账单行,「种菜金额」有数据(>0)的账单行整条排除、不参与匹配; + 一行 = 一个发货仓库的一个商品;发货仓库取订单的聚水潭仓库名称,仓库简称查仓库映射表, 商品单价按「仓库简称 + 商品编码」取「商品月加权平均单价」里的加权平均价;匹配不到时退回「线上代发价格」 (采购单价优先、其次钉钉代发单价),仍匹配不到时用「普通商品资料」里的商品成本价兜底;商品成本 = 商品数量 × 商品单价。 拆单子单重复列出的同一批商品只算一次,同一单分多仓发货的按子单实际仓库分行;虚拟条码(X0000x)不计入;