import((string) $this->argument('path')); } catch (Throwable $exception) { report($exception); $this->error('进销存权威月报导入失败:' . $exception->getMessage()); $this->warn('已保留上一版有效数据。'); return self::FAILURE; } $this->info(sprintf( '进销存权威月报导入完成:月份 %s,明细 %d 行。', $result['source_month'], $result['source_rows'], )); try { $alert = $alerts->syncMonth( $result['source_month'], max(1, (int) $this->option('company-id')), ); if ($alert['missing_pair_count'] > 0) { $this->warn(sprintf( '仓库简称提醒:%d 个仓储方/仓库组合未映射,涉及 %d 行;提醒任务 #%d 已%s。', $alert['missing_pair_count'], $alert['missing_row_count'], $alert['task_id'], match ($alert['action']) { 'created' => '创建', 'reopened' => '重新打开', default => '更新', }, )); } else { $this->info('仓库简称映射完整。'); } } catch (Throwable $exception) { report($exception); $this->error('进销存月报已导入,但仓库简称提醒任务创建失败:' . $exception->getMessage()); return self::FAILURE; } return self::SUCCESS; } }