feat: 按聚水潭导出表头展示顾家基础数据 #1102

Merged
chenxi merged 1 commits from feature/chenxi-kuka-base-export-headers into main 2026-11-11 18:33:09 +08:00
4 changed files with 51 additions and 7 deletions

View File

@ -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),
];
}

View File

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

View File

@ -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' => '材质'],
],
];

View File

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