- 新增共享镜像表 business_internal_flow_records 与整份替换导入命令 internal-flow:import - 按 Excel 表头展示抬头、标签、预计9月销量、开票、所需进项成本、收票、剩余缺口与开票比例 - 复用公司基础信息的字段查询、表头排序、筛选字段与导出 Excel 交互 - 新增导入与页面测试,覆盖合计行跳过、重导入替换、筛选排序与未导入空状态
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
||
|
||
namespace App\Console\Commands;
|
||
|
||
use Illuminate\Console\Command;
|
||
use Modules\EcommerceFinance\Services\InternalFlowWorkbookImporter;
|
||
use Throwable;
|
||
|
||
class ImportInternalFlowReport extends Command
|
||
{
|
||
protected $signature = 'internal-flow:import
|
||
{path : 「一般纳税人内部流转」工作簿路径(.xlsx)}';
|
||
|
||
protected $description = '导入内部流转报表明细,整份替换共享业务镜像中的上一版数据';
|
||
|
||
public function handle(InternalFlowWorkbookImporter $importer): int
|
||
{
|
||
try {
|
||
$result = $importer->import((string) $this->argument('path'));
|
||
} catch (Throwable $exception) {
|
||
report($exception);
|
||
$this->error('内部流转报表导入失败:' . $exception->getMessage());
|
||
|
||
return self::FAILURE;
|
||
}
|
||
|
||
$this->info(sprintf(
|
||
'内部流转报表导入完成:明细 %s 行,跳过合计/空行 %s 行,来源文件 %s。',
|
||
number_format($result['imported']),
|
||
number_format($result['skipped']),
|
||
$result['source_file'],
|
||
));
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
}
|