fix(remote): ACK 的 message 寫入 note,否則失敗原因與查詢結果都被丟棄
ProcessCommandAck 的通用路徑原本只把 result/stock 併進 payload,未保存機台
回報的 message,導致:
- 指令失敗時 note 為空,後台看不到原因(Machine busy / 下位機無回應 /
Unknown command…),無從診斷。
- query_jam 以 message 回傳查詢結果 JSON {"jam":[2,5],"belt":[]},
在指令中心永遠顯示不出來。
改為一律將 message 寫入 note;機台未回 message 時保留既有 note,
避免覆蓋 Superseded 等既有提示。update_app 的 progress 分支不受影響。
This commit is contained in:
parent
84ec95d95f
commit
53b5d44fde
@ -140,9 +140,16 @@ class ProcessCommandAck implements ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 機台回報的 message 一律寫入 note:
|
||||||
|
// - 失敗時是原因(Machine busy / 下位機無回應 / Unknown command…),沒存就無從診斷。
|
||||||
|
// - query_jam 的 message 是查詢結果 JSON {"jam":[2,5],"belt":[]},指令中心據此渲染。
|
||||||
|
// 機台沒回 message 時保留既有 note(如 Superseded 提示),不覆蓋。
|
||||||
|
$ackMessage = $this->payload['message'] ?? null;
|
||||||
|
|
||||||
$command->update([
|
$command->update([
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'executed_at' => now(),
|
'executed_at' => now(),
|
||||||
|
'note' => ($ackMessage !== null && $ackMessage !== '') ? $ackMessage : $command->note,
|
||||||
'payload' => array_merge($command->payload, $payloadUpdates),
|
'payload' => array_merge($command->payload, $payloadUpdates),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user