21 lines
931 B
PHP
21 lines
931 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Modules\EcommerceFinance\Services\SupplierBookkeepingShippingImporter;
|
|
|
|
class ImportSupplierBookkeepingShipments extends Command
|
|
{
|
|
protected $signature = 'supplier-bookkeeping:import-shipments {file} {manifest} {--dry-run}';
|
|
protected $description = '流式导入工作平台月度发货精简文件;保留来源摘要,支持断点,整月完成后生效';
|
|
|
|
public function handle(SupplierBookkeepingShippingImporter $importer): int
|
|
{
|
|
$start = microtime(true);
|
|
$result = $importer->import($this->argument('file'), $this->argument('manifest'), (bool) $this->option('dry-run'));
|
|
$this->info(json_encode($result + ['seconds' => round(microtime(true) - $start, 2), 'peak_mb' => round(memory_get_peak_usage(true) / 1048576, 2)], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR));
|
|
return self::SUCCESS;
|
|
}
|
|
}
|