37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Modules\EcommerceFinance\Services\ThirdPartyWarehouseStorageAuthoritativeAnchorImporter;
|
|
use Throwable;
|
|
|
|
class ImportThirdPartyWarehouseStorageAuthoritativeAnchor extends Command
|
|
{
|
|
protected $signature = 'business-mirror:import-third-party-warehouse-anchor
|
|
{path : 聚水潭三方仓按商品加按天多维分析完整 XLSX 导出文件}';
|
|
|
|
protected $description = '导入三方仓权威日进销存明细及月末库存锚点,用于稳定历史余额';
|
|
|
|
public function handle(ThirdPartyWarehouseStorageAuthoritativeAnchorImporter $importer): int
|
|
{
|
|
try {
|
|
$result = $importer->import((string) $this->argument('path'));
|
|
} catch (Throwable $exception) {
|
|
report($exception);
|
|
$this->error('三方仓权威进销存导入失败,已保留上一版有效数据。');
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$this->info(sprintf(
|
|
'三方仓权威日明细导入完成:校验 %s 条明细,生成 %s 个商品锚点,锚点时刻 %s。',
|
|
number_format($result['source_rows']),
|
|
number_format($result['anchor_skus']),
|
|
$result['anchor_at'],
|
|
));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|