[FIX] 修正遠端出貨指令逾時處理機制與補全多語系支援
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)並套用視覺樣式。
This commit is contained in:
parent
53ced5ca5b
commit
3bb5d8cfcc
@ -423,7 +423,7 @@ class MachineService
|
||||
// 超過 1 分鐘:視為逾時,自動標記舊指令
|
||||
$pendingCommand->update([
|
||||
'status' => 'timeout',
|
||||
'note' => '指令逾時 (1 分鐘未回報),已被新指令覆蓋。',
|
||||
'note' => __('Superseded by new command (Timeout)'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
DB::statement("ALTER TABLE remote_commands MODIFY COLUMN status ENUM('pending', 'sent', 'success', 'failed', 'superseded', 'timeout') DEFAULT 'pending'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
DB::statement("ALTER TABLE remote_commands MODIFY COLUMN status ENUM('pending', 'sent', 'success', 'failed', 'superseded') DEFAULT 'pending'");
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1415,11 +1415,13 @@
|
||||
"Submit Record": "Submit Record",
|
||||
"Subtotal": "Subtotal",
|
||||
"Success": "Success",
|
||||
"Timeout": "Timeout",
|
||||
"Super Admin": "Super Admin",
|
||||
"Super-admin role cannot be assigned to tenant accounts.": "Super-admin role cannot be assigned to tenant accounts.",
|
||||
"Superseded": "Superseded",
|
||||
"Superseded by new adjustment": "Superseded by new adjustment",
|
||||
"Superseded by new command": "Superseded by new command",
|
||||
"Superseded by new command (Timeout)": "Superseded by new command (Timeout)",
|
||||
"Survey Analysis": "Survey Analysis",
|
||||
"Syncing": "Syncing",
|
||||
"Syncing Permissions...": "Syncing Permissions...",
|
||||
@ -1760,6 +1762,8 @@
|
||||
"special-permission": "special-permission",
|
||||
"standby": "standby",
|
||||
"success": "success",
|
||||
"superseded": "superseded",
|
||||
"timeout": "timeout",
|
||||
"super-admin": "super-admin",
|
||||
"to": "to",
|
||||
"update": "Update",
|
||||
|
||||
@ -1541,11 +1541,13 @@
|
||||
"Submit Record": "提交紀錄",
|
||||
"Subtotal": "小計",
|
||||
"Success": "成功",
|
||||
"Timeout": "逾時",
|
||||
"Super Admin": "超級管理員",
|
||||
"Super-admin role cannot be assigned to tenant accounts.": "超級管理員角色無法指派給客戶帳號。",
|
||||
"Superseded": "已取代",
|
||||
"Superseded by new adjustment": "此指令已由後面最新的調整所取代",
|
||||
"Superseded by new command": "此指令已由後面最新的指令所取代",
|
||||
"Superseded by new command (Timeout)": "指令逾時 (1 分鐘未回報),已被新指令覆蓋。",
|
||||
"Survey Analysis": "問卷分析",
|
||||
"Syncing": "同步中",
|
||||
"Syncing Permissions...": "正在同步權限...",
|
||||
@ -1911,6 +1913,8 @@
|
||||
"special-permission": "特殊權限",
|
||||
"standby": "待機廣告",
|
||||
"success": "成功",
|
||||
"superseded": "指令已覆蓋",
|
||||
"timeout": "指令逾時",
|
||||
"super-admin": "超級管理員",
|
||||
"to": "至",
|
||||
"update": "更新",
|
||||
|
||||
@ -60,6 +60,11 @@
|
||||
'verified' => ['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'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user