From 3bb5d8cfcce6b0866b8b455d25fa9d8db81ab318 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Tue, 12 May 2026 08:57:27 +0800 Subject: [PATCH] =?UTF-8?q?[FIX]=20=E4=BF=AE=E6=AD=A3=E9=81=A0=E7=AB=AF?= =?UTF-8?q?=E5=87=BA=E8=B2=A8=E6=8C=87=E4=BB=A4=E9=80=BE=E6=99=82=E8=99=95?= =?UTF-8?q?=E7=90=86=E6=A9=9F=E5=88=B6=E8=88=87=E8=A3=9C=E5=85=A8=E5=A4=9A?= =?UTF-8?q?=E8=AA=9E=E7=B3=BB=E6=94=AF=E6=8F=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 建立資料庫遷移,於 remote_commands 的 status ENUM 中新增 timeout 狀態,修復 Data truncated 錯誤。 2. 更新 MachineService::dispatchDispense 邏輯,當指令超過 1 分鐘未回報時自動標記為 timeout 並記錄原因。 3. 於 zh_TW.json 與 en.json 補全 timeout、superseded 狀態及相關備註的翻譯。 4. 更新 status-badge 元件預設值,支援遠端指令相關狀態(sent, success, failed, timeout, superseded)並套用視覺樣式。 --- app/Services/Machine/MachineService.php | 2 +- ...timeout_to_remote_commands_status_enum.php | 29 +++++++++++++++++++ lang/en.json | 4 +++ lang/zh_TW.json | 4 +++ .../views/components/status-badge.blade.php | 5 ++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2026_05_12_084832_add_timeout_to_remote_commands_status_enum.php diff --git a/app/Services/Machine/MachineService.php b/app/Services/Machine/MachineService.php index 73b0028..cc7e1dd 100644 --- a/app/Services/Machine/MachineService.php +++ b/app/Services/Machine/MachineService.php @@ -423,7 +423,7 @@ class MachineService // 超過 1 分鐘:視為逾時,自動標記舊指令 $pendingCommand->update([ 'status' => 'timeout', - 'note' => '指令逾時 (1 分鐘未回報),已被新指令覆蓋。', + 'note' => __('Superseded by new command (Timeout)'), ]); } diff --git a/database/migrations/2026_05_12_084832_add_timeout_to_remote_commands_status_enum.php b/database/migrations/2026_05_12_084832_add_timeout_to_remote_commands_status_enum.php new file mode 100644 index 0000000..0720021 --- /dev/null +++ b/database/migrations/2026_05_12_084832_add_timeout_to_remote_commands_status_enum.php @@ -0,0 +1,29 @@ + ['label' => __('Verified'), 'color' => 'emerald'], 'consume' => ['label' => __('Consumed'), 'color' => 'cyan'], 'completed' => ['label' => __('Completed'), 'color' => 'cyan'], + 'sent' => ['label' => __('Sent'), 'color' => 'indigo'], + 'success' => ['label' => __('Success'), 'color' => 'emerald'], + 'failed' => ['label' => __('Failed'), 'color' => 'rose'], + 'timeout' => ['label' => __('Timeout'), 'color' => 'rose'], + 'superseded' => ['label' => __('Superseded'),'color' => 'slate'], ]; $preset = $presets[$status] ?? ['label' => $status, 'color' => 'slate'];