From fe2e7f48152d8688e77c7f71fb2c0bc1c4be7277 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 11 Nov 2026 18:32:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8C=89=E8=81=9A=E6=B0=B4=E6=BD=AD?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=A1=A8=E5=A4=B4=E5=B1=95=E7=A4=BA=E9=A1=BE?= =?UTF-8?q?=E5=AE=B6=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KukaPostingBaseImporter.php | 9 +++++ .../Commands/ImportKukaPostingBase.php | 1 + config/kuka_posting.php | 40 ++++++++++++++++--- .../Business/KukaPostingBasePageTest.php | 8 +++- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/app/Business/KukaPostingBase/KukaPostingBaseImporter.php b/app/Business/KukaPostingBase/KukaPostingBaseImporter.php index 3d155605..4a5377b1 100644 --- a/app/Business/KukaPostingBase/KukaPostingBaseImporter.php +++ b/app/Business/KukaPostingBase/KukaPostingBaseImporter.php @@ -30,6 +30,7 @@ class KukaPostingBaseImporter * store_count: int, * order_count: int, * skipped_store_rows: int, + * skipped_cancelled_rows: int, * file_sha256: string * } */ @@ -77,6 +78,7 @@ class KukaPostingBaseImporter $orders = []; $rowCount = 0; $skippedStoreRows = 0; + $skippedCancelledRows = 0; $sourceRowNumber = 1; $now = now(); @@ -93,6 +95,7 @@ class KukaPostingBaseImporter &$orders, &$rowCount, &$skippedStoreRows, + &$skippedCancelledRows, &$sourceRowNumber, $fileHash, $now, @@ -122,6 +125,11 @@ class KukaPostingBaseImporter continue; } + if (trim((string) ($sourceValues['订单状态'] ?? '')) === '已取消') { + $skippedCancelledRows++; + + continue; + } $payload = []; foreach ($fields as $field) { @@ -231,6 +239,7 @@ class KukaPostingBaseImporter 'store_count' => count(array_filter($storeCounts)), 'order_count' => count($orders), 'skipped_store_rows' => $skippedStoreRows, + 'skipped_cancelled_rows' => $skippedCancelledRows, 'file_sha256' => strtolower($fileHash), ]; } diff --git a/app/Console/Commands/ImportKukaPostingBase.php b/app/Console/Commands/ImportKukaPostingBase.php index 788c1f3a..f1e02d84 100644 --- a/app/Console/Commands/ImportKukaPostingBase.php +++ b/app/Console/Commands/ImportKukaPostingBase.php @@ -52,6 +52,7 @@ class ImportKukaPostingBase extends Command ['店铺数', number_format($result['store_count'])], ['订单数', number_format($result['order_count'])], ['非指定店铺跳过', number_format($result['skipped_store_rows'])], + ['已取消状态跳过', number_format($result['skipped_cancelled_rows'])], ['文件 SHA-256', $result['file_sha256']], ]); $this->table(['店铺', '行数'], $storeRows); diff --git a/config/kuka_posting.php b/config/kuka_posting.php index fa1b971e..403f0a76 100644 --- a/config/kuka_posting.php +++ b/config/kuka_posting.php @@ -96,12 +96,40 @@ return [ ['name' => 'product_code', 'source' => '商品编码', 'label' => '商品编码'], ['name' => 'original_online_order_no', 'source' => '原始线上订单号', 'label' => '原始线上订单号'], ['name' => 'style_code', 'source' => '款式编码', 'label' => '款式编码'], - ['name' => 'item_number', 'source' => '货号', 'label' => '货号'], - ['name' => 'material_number', 'source' => '物料编号', 'label' => '物料编号'], - ['name' => 'model', 'source' => '型号', 'label' => '型号'], - ['name' => 'cost', 'source' => '成本', 'label' => '成本', 'kind' => 'number'], - ['name' => 'product_material', 'source' => '产品材质', 'label' => '产品材质'], + ['name' => 'product_category', 'source' => '产品分类', 'label' => '产品分类'], + ['name' => 'product_short_name', 'source' => '商品简称', 'label' => '商品简称'], + ['name' => 'color_spec', 'source' => '颜色规格', 'label' => '颜色规格'], + ['name' => 'brand', 'source' => '品牌', 'label' => '品牌'], + ['name' => 'cost_source', 'source' => '成本价来源', 'label' => '成本价来源'], + ['name' => 'sales_quantity', 'source' => '销售数量', 'label' => '销售数量', 'kind' => 'number'], ['name' => 'shipped_quantity', 'source' => '实发数量', 'label' => '实发数量', 'kind' => 'number'], - ['name' => 'shipping_amount', 'source' => '发货金额', 'label' => '发货金额', 'kind' => 'number'], + ['name' => 'actual_shipping_amount', 'source' => '实发金额', 'label' => '实发金额', 'kind' => 'number'], + ['name' => 'sales_amount', 'source' => '销售金额', 'label' => '销售金额', 'kind' => 'number'], + ['name' => 'paid_amount', 'source' => '已付金额', 'label' => '已付金额', 'kind' => 'number'], + ['name' => 'payable_amount', 'source' => '应付金额', 'label' => '应付金额', 'kind' => 'number'], + ['name' => 'sale_price', 'source' => '售价', 'label' => '售价', 'kind' => 'number'], + ['name' => 'current_return_quantity', 'source' => '当期退货数量', 'label' => '当期退货数量', 'kind' => 'number'], + ['name' => 'current_actual_return_quantity', 'source' => '当期实退数量', 'label' => '当期实退数量', 'kind' => 'number'], + ['name' => 'current_return_amount', 'source' => '当期退货金额', 'label' => '当期退货金额', 'kind' => 'number'], + ['name' => 'current_actual_return_amount', 'source' => '当期实退金额', 'label' => '当期实退金额', 'kind' => 'number'], + ['name' => 'freight_income', 'source' => '运费收入', 'label' => '运费收入', 'kind' => 'number'], + ['name' => 'freight_income_allocated', 'source' => '运费收入分摊', 'label' => '运费收入分摊', 'kind' => 'number'], + ['name' => 'whole_order_freight_expense', 'source' => '整单运费支出', 'label' => '整单运费支出', 'kind' => 'number'], + ['name' => 'freight_expense', 'source' => '运费支出', 'label' => '运费支出', 'kind' => 'number'], + ['name' => 'discount_amount', 'source' => '优惠金额', 'label' => '优惠金额', 'kind' => 'number'], + ['name' => 'order_weight', 'source' => '订单重量', 'label' => '订单重量', 'kind' => 'number'], + ['name' => 'supplier', 'source' => '供销商', 'label' => '供销商'], + ['name' => 'salesperson', 'source' => '业务员', 'label' => '业务员'], + ['name' => 'product_status', 'source' => '商品状态', 'label' => '商品状态', 'kind' => 'badge'], + ['name' => 'refund_status', 'source' => '退款状态', 'label' => '退款状态', 'kind' => 'badge'], + ['name' => 'buyer_paid', 'source' => '买家实付', 'label' => '买家实付', 'kind' => 'number'], + ['name' => 'merchant_received', 'source' => '商家实收', 'label' => '商家实收', 'kind' => 'number'], + ['name' => 'flag', 'source' => '小旗', 'label' => '小旗'], + ['name' => 'platform_subsidy_amount', 'source' => '平台补贴金额', 'label' => '平台补贴金额', 'kind' => 'number'], + ['name' => 'product_name', 'source' => '商品名称', 'label' => '商品名称'], + ['name' => 'supplier_product_code', 'source' => '供应商商品编码', 'label' => '供应商商品编码'], + ['name' => 'specification_model', 'source' => '规格型号', 'label' => '规格型号'], + ['name' => 'item_number', 'source' => '货号', 'label' => '货号'], + ['name' => 'material', 'source' => '材质', 'label' => '材质'], ], ]; diff --git a/tests/Feature/Business/KukaPostingBasePageTest.php b/tests/Feature/Business/KukaPostingBasePageTest.php index 7049ca91..ebe5b607 100644 --- a/tests/Feature/Business/KukaPostingBasePageTest.php +++ b/tests/Feature/Business/KukaPostingBasePageTest.php @@ -25,6 +25,7 @@ class KukaPostingBasePageTest extends FeatureTestCase 'period' => '2026-10', 'row_count' => 12, 'store_count' => 12, + 'order_count' => 12, ], 'business_mirror'); $this->loginAs() @@ -35,7 +36,7 @@ class KukaPostingBasePageTest extends FeatureTestCase ])) ->assertOk() ->assertSeeText('内部订单号') - ->assertSeeText('发货金额') + ->assertSeeText('实发金额') ->assertSeeText('灵珊店铺业绩') ->assertSeeText('发货明细数据') ->assertSeeText('顾家报价单') @@ -173,6 +174,11 @@ class KukaPostingBasePageTest extends FeatureTestCase '发货金额' => '199.00', ]; } + $rows[] = array_merge($rows[0], [ + '内部订单号' => 'KUKA-CANCELLED', + '线上订单号' => 'ONLINE-CANCELLED', + '订单状态' => '已取消', + ]); $path = tempnam(sys_get_temp_dir(), 'kuka-posting-base-') . '.xlsx'; $zip = new ZipArchive();