feat(inventory): 實作盤點、盤調與調撥操作紀錄,並支援前端本地化顯示

This commit is contained in:
2026-02-04 13:24:33 +08:00
parent 95fdec8a06
commit a8b88b3375
4 changed files with 122 additions and 12 deletions

View File

@@ -200,12 +200,19 @@ class CountDocController extends Controller
->with('success', '已取消核准,單據回復為盤點中狀態');
}
public function destroy(InventoryCountDoc $doc)
{
if ($doc->status === 'completed') {
return redirect()->back()->with('error', '已完成的盤點單無法刪除');
}
// 記錄活動
activity()
->performedOn($doc)
->causedBy(auth()->user())
->event('deleted')
->withProperties([
'snapshot' => [
'doc_no' => $doc->doc_no,
'warehouse_name' => $doc->warehouse?->name,
]
])
->log('deleted');
$doc->items()->delete();
$doc->delete();