From 9cf5b4b65fc264eff0e9d2b008059567ccf7e625 Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 17 Apr 2026 17:04:01 +0300 Subject: [PATCH] =?utf8?q?feat(ERP-292):=20=D0=BA=D0=BE=D0=BD=D1=81=D0=BE?= =?utf8?q?=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD?= =?utf8?q?=D0=B4=D0=B0=20auto-mark?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/AutoMarkController.php | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 erp24/commands/AutoMarkController.php 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; + } +} -- 2.39.5