diff --git a/app/Console/Commands/SyncStoreReceiptOrderMatches.php b/app/Console/Commands/SyncStoreReceiptOrderMatches.php index 4b1817d0..325a2911 100644 --- a/app/Console/Commands/SyncStoreReceiptOrderMatches.php +++ b/app/Console/Commands/SyncStoreReceiptOrderMatches.php @@ -1455,13 +1455,14 @@ class SyncStoreReceiptOrderMatches extends Command } /** - * 种菜未报销订单号:只取聚水潭订单标签明细里「是否种菜订单=是」的订单号。 + * 种菜未报销订单号:聚水潭订单标签明细里「是否种菜订单=是」,且尚未出现在种菜明细表。 * * @return array */ private function plantingUnreimbursedCores(): array { $companyId = (int) $this->option('company'); + $reimbursementCores = $this->plantingReimbursementCores(); $positiveLabels = []; foreach (app(JstOrderLabelPlantingRules::class)->map($companyId) as $label => $flag) { if ($flag === '是') { @@ -1472,7 +1473,7 @@ class SyncStoreReceiptOrderMatches extends Command $cores = []; foreach (app(PlantingOrderLabelLookup::class)->orderNumbers($companyId, $positiveLabels) as $orderNo) { $core = self::orderCoreNo((string) $orderNo); - if ($core !== '') { + if ($core !== '' && ! isset($reimbursementCores[$core])) { $cores[$core] = true; } } diff --git a/database/migrations/2026_10_20_030000_add_planting_unreimbursed_amount_to_store_receipt_order_match_rows.php b/database/migrations/2026_10_20_030000_add_planting_unreimbursed_amount_to_store_receipt_order_match_rows.php index 4c511bec..a37d382f 100644 --- a/database/migrations/2026_10_20_030000_add_planting_unreimbursed_amount_to_store_receipt_order_match_rows.php +++ b/database/migrations/2026_10_20_030000_add_planting_unreimbursed_amount_to_store_receipt_order_match_rows.php @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Schema; /** * 业绩明细新增「种菜未报销」列(放在种菜报销后面): - * 仅按聚水潭订单标签明细「是否种菜订单=是」的订单号命中,金额取收入金额。 + * 按聚水潭订单标签明细「是否种菜订单=是」且未出现在种菜明细表的订单号命中,金额取收入金额。 */ return new class extends Migration {