From 12591a55f24f50cc573c06aca4fa801a31974ab6 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Wed, 22 Apr 2026 16:38:37 +0800 Subject: [PATCH] cleanup: remove redundant ProcessErrorLog job in favor of existing ProcessMachineError --- app/Jobs/Machine/ProcessErrorLog.php | 60 ---------------------------- 1 file changed, 60 deletions(-) delete mode 100644 app/Jobs/Machine/ProcessErrorLog.php diff --git a/app/Jobs/Machine/ProcessErrorLog.php b/app/Jobs/Machine/ProcessErrorLog.php deleted file mode 100644 index 398f146..0000000 --- a/app/Jobs/Machine/ProcessErrorLog.php +++ /dev/null @@ -1,60 +0,0 @@ -serialNo = $serialNo; - $this->payload = $payload; - } - - /** - * Execute the job. - */ - public function handle(): void - { - $machine = Machine::withoutGlobalScopes()->where('serial_no', $this->serialNo)->first(); - - if (!$machine) { - Log::warning("MQTT ErrorLog: Machine not found", ['serial_no' => $this->serialNo]); - return; - } - - $errorCode = $this->payload['error_code'] ?? 'Unknown'; - $tid = $this->payload['tid'] ?? 'N/A'; - - // 這裡可以整合 i18n 翻譯,或是直接記錄 - // 依照 SKILL.md 定義,error_code 會被翻譯 - - ProcessStateLog::dispatch( - $machine->id, - $machine->company_id, - "Hardware Error reported: :code on slot :tid", - 'error', - [ - 'code' => $errorCode, - 'tid' => $tid, - 'raw_payload' => $this->payload - ], - 'error' - ); - } -}