From: fomichev Date: Fri, 17 Apr 2026 14:04:01 +0000 (+0300) Subject: feat(ERP-292): консольная команда auto-mark X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=9cf5b4b65fc264eff0e9d2b008059567ccf7e625;p=erp24_rep%2Fyii-erp24%2F.git feat(ERP-292): консольная команда auto-mark --- diff --git a/erp24/commands/AutoMarkController.php b/erp24/commands/AutoMarkController.php new file mode 100644 index 00000000..b48c6613 --- /dev/null +++ b/erp24/commands/AutoMarkController.php @@ -0,0 +1,61 @@ +stdout("Запуск авторазметки новых товаров...\n"); + + $service = new AutoMarkService(); + $count = $service->batchPredict(); + + $this->stdout("Создано предсказаний: {$count}\n"); + return ExitCode::OK; + } + + public function actionRunProduct(string $guid): int + { + $service = new AutoMarkService(); + $result = $service->predictForProduct($guid); + + if ($result === null) { + $this->stderr("Не удалось создать предсказание для {$guid}\n"); + return ExitCode::UNSPECIFIED_ERROR; + } + + $this->stdout("Предсказание создано (ID={$result->id}, confidence={$result->confidence}, method={$result->method})\n"); + return ExitCode::OK; + } + + public function actionApply(int $predictionId): int + { + $service = new AutoMarkService(); + $success = $service->applyApprovedPrediction($predictionId); + + if (!$success) { + $this->stderr("Не удалось применить предсказание ID={$predictionId}\n"); + return ExitCode::UNSPECIFIED_ERROR; + } + + $this->stdout("Предсказание ID={$predictionId} применено.\n"); + return ExitCode::OK; + } +}