[FIX] 優化 MQTT 錯誤代碼翻譯與交易核銷邏輯

1. 更新 MQTT 錯誤代碼 0205 的標籤為 Slot sensor blocked,並將繁體中文翻譯修正為「貨道口有物」,同步更新多語系檔 (zh_TW, en, ja)。
2. 修改 TransactionService,移除遠端出貨 (payment_type: 100) 在交易結案時的 code_id 自動核銷邏輯。
3. 更新 SKILL.md 與 api-docs.php 規格文件,將「通行碼 (5)」納入 code_id 核銷範圍,並移除遠端出貨的說明。
This commit is contained in:
sky121113 2026-05-12 14:27:00 +08:00
parent 2cf33cfbb4
commit a290d5b306
7 changed files with 6 additions and 16 deletions

View File

@ -254,7 +254,7 @@ Mqtt3Client client = MqttClient.builder()
> [!NOTE] > [!NOTE]
> - `serial_no` 不需放在 Payload 中Go Gateway 自動從 Topic 路徑提取並注入。 > - `serial_no` 不需放在 Payload 中Go Gateway 自動從 Topic 路徑提取並注入。
> - 若 Payload 不含 `action` 欄位,系統預設視為 `create`(向後相容既有 B600 格式)。 > - 若 Payload 不含 `action` 欄位,系統預設視為 `create`(向後相容既有 B600 格式)。
> - **閉環勾稽參數**:當使用特定支付方式 (如 `payment_type: 6`=取貨碼, `41`=員工卡, `100`=遠端出貨) 時,請務必在 `order` 中帶入 `code_id` 欄位。後端會根據此 ID 完成對應的狀態更新與核銷。 > - **閉環勾稽參數**:當使用特定支付方式 (如 `payment_type: 6`=取貨碼, `5`=通行碼, `41`=員工卡) 時,請務必在 `order` 中帶入 `code_id` 欄位。後端會根據此 ID 完成對應的狀態更新與核銷。
### 3.4 雲端指令 (Downstream Commands) - `machine/{serial_no}/command` ### 3.4 雲端指令 (Downstream Commands) - `machine/{serial_no}/command`
這是雲端主動下發給機台的訊息,取代原本 B010 Response 的輪詢等待。 這是雲端主動下發給機台的訊息,取代原本 B010 Response 的輪詢等待。

View File

@ -51,7 +51,7 @@ class MachineService
'0201' => ['label' => 'Slot normal', 'level' => 'info'], '0201' => ['label' => 'Slot normal', 'level' => 'info'],
'0202' => ['label' => 'Product empty', 'level' => 'warning'], '0202' => ['label' => 'Product empty', 'level' => 'warning'],
'0203' => ['label' => 'Slot empty', 'level' => 'warning'], '0203' => ['label' => 'Slot empty', 'level' => 'warning'],
'0205' => ['label' => 'Product detected (0205)', 'level' => 'warning'], '0205' => ['label' => 'Slot sensor blocked', 'level' => 'warning'],
'0206' => ['label' => 'Slot not closed', 'level' => 'warning'], '0206' => ['label' => 'Slot not closed', 'level' => 'warning'],
'0207' => ['label' => 'Slot motor error (0207)', 'level' => 'error'], '0207' => ['label' => 'Slot motor error (0207)', 'level' => 'error'],
'0208' => ['label' => 'Slot motor error (0208)', 'level' => 'error'], '0208' => ['label' => 'Slot motor error (0208)', 'level' => 'error'],

View File

@ -343,17 +343,6 @@ class TransactionService
'remark' => "MQTT 交易完成自動紀錄取貨,訂單: #{$order->id}" 'remark' => "MQTT 交易完成自動紀錄取貨,訂單: #{$order->id}"
]); ]);
break; break;
case 100: // 遠端出貨 (Remote Admin)
$remoteCommand = \App\Models\Machine\RemoteCommand::find($codeId);
if ($remoteCommand) {
$remoteCommand->update([
'status' => 'success',
'executed_at' => $order->machine_time ?? now(),
'note' => "Transaction Finalized: #{$order->order_no}"
]);
}
break;
} }
} }

View File

@ -539,7 +539,7 @@ return [
'order.points_used' => ['type' => 'integer', 'description' => '(選填) 使用點數,預設 0', 'required' => false], 'order.points_used' => ['type' => 'integer', 'description' => '(選填) 使用點數,預設 0', 'required' => false],
'order.payment_type' => ['type' => 'integer', 'description' => "(必填) 支付類型代碼:\n1:信用卡, 2:悠遊卡/一卡通, 3:掃碼支付, 4:紙鈔機, 5:通行碼, 6:取貨碼, 7:來店禮, 8:問卷, 9:零錢, 41:員工卡。\n21~25:線下付款+X (21:線下+1, 22:線下+2, 23:線下+3, 24:線下+4, 25:線下+9)。\n30:LINE Pay, 31:街口, 32:悠遊付, 33:Pi, 34:全盈+。\n40:會員驗證取貨商品。\n50~54:線下付款+TapPay (50:線下+30, 51:線下+31, 52:線下+32, 53:線下+33, 54:線下+34)。\n60:點數/優惠卷全額折抵。61~69:會員+X (61:會員+1...69:會員+9)。\n90~94:會員+TapPay (90:會員+30...94:會員+34)。\n100:遠端出貨。"], 'order.payment_type' => ['type' => 'integer', 'description' => "(必填) 支付類型代碼:\n1:信用卡, 2:悠遊卡/一卡通, 3:掃碼支付, 4:紙鈔機, 5:通行碼, 6:取貨碼, 7:來店禮, 8:問卷, 9:零錢, 41:員工卡。\n21~25:線下付款+X (21:線下+1, 22:線下+2, 23:線下+3, 24:線下+4, 25:線下+9)。\n30:LINE Pay, 31:街口, 32:悠遊付, 33:Pi, 34:全盈+。\n40:會員驗證取貨商品。\n50~54:線下付款+TapPay (50:線下+30, 51:線下+31, 52:線下+32, 53:線下+33, 54:線下+34)。\n60:點數/優惠卷全額折抵。61~69:會員+X (61:會員+1...69:會員+9)。\n90~94:會員+TapPay (90:會員+30...94:會員+34)。\n100:遠端出貨。"],
'order.payment_status' => ['type' => 'integer', 'description' => '(必填) 支付狀態 (1:成功)'], 'order.payment_status' => ['type' => 'integer', 'description' => '(必填) 支付狀態 (1:成功)'],
'order.code_id' => ['type' => 'string', 'description' => '(選填) 閉環勾稽用的指令ID或取貨碼ID (payment_type為 6, 41, 100 時必填)', 'required' => false], 'order.code_id' => ['type' => 'string', 'description' => '(選填) 閉環勾稽用的代碼 ID (payment_type 為 5, 6, 41 時必填)', 'required' => false],
'order.payment_request' => ['type' => 'string', 'description' => '(選填) 金流請求原始字串', 'required' => false], 'order.payment_request' => ['type' => 'string', 'description' => '(選填) 金流請求原始字串', 'required' => false],
'order.payment_response' => ['type' => 'string', 'description' => '(選填) 金流回應原始字串', 'required' => false], 'order.payment_response' => ['type' => 'string', 'description' => '(選填) 金流回應原始字串', 'required' => false],
'order.member_barcode' => ['type' => 'string', 'description' => '(選填) 會員條碼', 'required' => false], 'order.member_barcode' => ['type' => 'string', 'description' => '(選填) 會員條碼', 'required' => false],

View File

@ -1103,7 +1103,7 @@
"Product Status": "商品狀態", "Product Status": "商品狀態",
"Product created successfully": "Product created successfully", "Product created successfully": "Product created successfully",
"Product deleted successfully": "Product deleted successfully", "Product deleted successfully": "Product deleted successfully",
"Product detected (0205)": "Product detected (0205)", "Slot sensor blocked": "Slot sensor blocked",
"Product empty": "Product empty", "Product empty": "Product empty",
"Product status updated to :status": "Product status updated to :status", "Product status updated to :status": "Product status updated to :status",
"Product updated successfully": "Product updated successfully", "Product updated successfully": "Product updated successfully",

View File

@ -1336,6 +1336,7 @@
"Slot not closed": "Slot not closed", "Slot not closed": "Slot not closed",
"Slot not found": "Slot not found", "Slot not found": "Slot not found",
"Slot report synchronized success": "Slot report synchronized success", "Slot report synchronized success": "Slot report synchronized success",
"Slot sensor blocked": "貨道センサー異常(有物)",
"Slot updated successfully.": "Slot updated successfully.", "Slot updated successfully.": "Slot updated successfully.",
"Slots": "貨道", "Slots": "貨道",
"Slots need replenishment": "補充が必要なスロット", "Slots need replenishment": "補充が必要なスロット",

View File

@ -1214,7 +1214,7 @@
"Product Status": "商品狀態", "Product Status": "商品狀態",
"Product created successfully": "商品已成功建立", "Product created successfully": "商品已成功建立",
"Product deleted successfully": "商品已成功刪除", "Product deleted successfully": "商品已成功刪除",
"Product detected (0205)": "貨道有物 (0205)", "Slot sensor blocked": "貨道口有物",
"Product empty": "貨道缺貨 (PDT_EMPTY)", "Product empty": "貨道缺貨 (PDT_EMPTY)",
"Product status updated to :status": "商品狀態已更新為 :status", "Product status updated to :status": "商品狀態已更新為 :status",
"Product updated successfully": "商品已成功更新", "Product updated successfully": "商品已成功更新",