[FIX] 統一搜尋欄位命名、更新語系檔與 IoT 規範文件

1. 修改 ProductController.php,將搜尋參數統一改為 search 以匹配前端表單欄位。
2. 更新 lang/zh_TW.json 語系檔,修正部分翻譯詞彙 (如 Inactive, Standby, Confirm Status Change)。
3. 更新 .agents/skills/mqtt-communication-specs/SKILL.md 規範文件。
4. 包含 Machine Model 與 MachineService 的優化變更。
This commit is contained in:
sky121113 2026-05-07 11:54:47 +08:00
parent 577bf136de
commit c52cf2900f
6 changed files with 26 additions and 37 deletions

View File

@ -284,14 +284,10 @@ Mqtt3Client client = MqttClient.builder()
"command": "update_inventory",
"command_id": "3",
"payload": {
"data": [
{
"slot_no": "3",
"stock": 6,
"expiry_date": null,
"batch_no": "B2026042201"
}
]
"slot_no": "3",
"stock": 6,
"expiry_date": null,
"batch_no": "B2026042201"
}
}
```

View File

@ -26,8 +26,8 @@ class ProductController extends Controller
$productQuery = Product::with(['category.translations', 'translations', 'company']);
// 搜尋
if ($request->filled('product_search')) {
$search = $request->product_search;
if ($request->filled('search')) {
$search = $request->search;
$productQuery->where(function($q) use ($search) {
$q->where('name', 'like', "%{$search}%")
->orWhere('barcode', 'like', "%{$search}%")
@ -55,8 +55,8 @@ class ProductController extends Controller
$categoryQuery->where('company_id', $request->category_company_id);
}
if ($request->filled('category_search')) {
$search = $request->category_search;
if ($request->filled('search')) {
$search = $request->search;
$categoryQuery->where(function($q) use ($search) {
$q->where('name', 'like', "%{$search}%");
});

View File

@ -253,7 +253,7 @@ class Machine extends Model
}
public const PAGE_STATUSES = [
'0' => 'Offline',
'0' => 'Standby',
'1' => 'Home Page',
'2' => 'Vending Page',
'3' => 'Admin Page',

View File

@ -326,14 +326,10 @@ class MachineService
// 4. 推播 MQTT
$mqttPayload = [
'data' => [
[
'slot_no' => $command->payload['slot_no'],
'stock' => $command->payload['new']['stock'],
'expiry_date' => $command->payload['new']['expiry_date'],
'batch_no' => $command->payload['new']['batch_no'] ?? null,
]
]
'slot_no' => $command->payload['slot_no'],
'stock' => $command->payload['new']['stock'],
'expiry_date' => $command->payload['new']['expiry_date'],
'batch_no' => $command->payload['new']['batch_no'] ?? null,
];
app(\App\Services\Machine\MqttService::class)->pushCommand(

View File

@ -678,24 +678,19 @@ return [
'command' => ['type' => 'string', 'description' => '固定為 "update_inventory"'],
'command_id' => ['type' => 'string', 'description' => '指令唯一 ID'],
'payload' => ['type' => 'object', 'description' => '更新參數'],
'payload.data' => ['type' => 'array', 'description' => '欲更新的貨道資料陣列'],
'payload.data[].slot_no' => ['type' => 'string', 'description' => '貨道號碼'],
'payload.data[].stock' => ['type' => 'integer', 'description' => '最新庫存量'],
'payload.data[].expiry_date' => ['type' => 'string', 'description' => '最新效期 (YYYY-MM-DD)'],
'payload.data[].batch_no' => ['type' => 'string', 'description' => '批號 (可為 null)'],
'payload.slot_no' => ['type' => 'string', 'description' => '貨道號碼'],
'payload.stock' => ['type' => 'integer', 'description' => '最新庫存量'],
'payload.expiry_date' => ['type' => 'string', 'description' => '最新效期 (YYYY-MM-DD)'],
'payload.batch_no' => ['type' => 'string', 'description' => '批號 (可為 null)'],
],
'payload_example' => [
'command' => 'update_inventory',
'command_id' => '5566778899',
'payload' => [
'data' => [
[
'slot_no' => '1',
'stock' => 10,
'expiry_date' => '2026-12-31',
'batch_no' => null
]
]
'slot_no' => '1',
'stock' => 10,
'expiry_date' => '2026-12-31',
'batch_no' => null
]
],
],

View File

@ -31,7 +31,8 @@
"Action": "操作",
"Action / Target": "操作 / 對象",
"Actions": "操作",
"Active": "有效",
"Active": "已啟用",
"Are you sure you want to change the status of this item?": "您確定要變更此項目的狀態嗎?",
"Active Slots": "使用中貨道",
"Active Status": "啟用狀態",
"Ad Settings": "廣告設置",
@ -277,8 +278,8 @@
"Confirm Delete": "確認刪除",
"Confirm Deletion": "確認刪除資料",
"Confirm Password": "確認新密碼",
"Confirm Status Change": "確認狀態變更",
"Confirm Prepare": "確認備貨",
"Confirm Status Change": "確認變更狀態",
"Confirm Stock-In": "確認進貨",
"Confirm Stock-in Order": "確認進貨單",
"Confirm Transfer": "確認調撥",
@ -706,6 +707,7 @@
"Items": "筆",
"JKO_MERCHANT_ID": "街口支付 商店代號",
"Japanese": "日文",
"Inactive": "已停用",
"Joined": "加入日期",
"Just now": "剛剛",
"Key": "金鑰 (Key)",
@ -1441,10 +1443,10 @@
"Staff card created successfully": "員工識別卡建立成功",
"Staff card deleted successfully": "員工識別卡刪除成功",
"Staff card updated successfully": "員工識別卡更新成功",
"Standby": "待機廣告",
"Standby Ad": "待機廣告",
"Start Date": "起始日",
"Start Delivery": "開始配送",
"Standby": "系統待機",
"Start Time": "開始時間",
"Statistics": "數據統計",
"Status": "狀態",