CaiWuXiTong/app/Console/Commands/ImportThirdPartyWarehouseStorageAuthoritativeAnchor.php
limeng 179b2cdbcc 接入并校准三方仓进销存 (#176)
新增三方仓进销存共享镜像、按日查询汇总导出、每日零点增量同步和权威历史锚点校准。
2026-09-12 20:29:43 +08:00

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;
}
}