統一庫存盤點與盤調 UI 及邏輯:修正狀態顯示、操作權限與列表樣式
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 50s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-29 13:41:31 +08:00
parent a31c8d6052
commit 2efaded77b
6 changed files with 115 additions and 52 deletions

View File

@@ -54,7 +54,7 @@ class AdjustService
}
/**
* 更新調單內容 (Items)
* 更新調單內容 (Items)
* 此處採用 "全量更新" 方式處理 items (先刪後加),簡單可靠
*/
public function updateItems(InventoryAdjustDoc $doc, array $itemsData): void
@@ -123,7 +123,7 @@ class AdjustService
'unit_cost' => $inventory->unit_cost,
'balance_before' => $oldQty,
'balance_after' => $newQty,
'reason' => "調{$doc->doc_no}: " . ($doc->reason ?? '手動調整'),
'reason' => "調單 {$doc->doc_no}: " . ($doc->reason ?? '手動調整'),
'actual_time' => now(),
'user_id' => $userId,
]);
@@ -134,6 +134,13 @@ class AdjustService
'posted_at' => now(),
'posted_by' => $userId,
]);
// 4. 若關聯盤點單,連動更新盤點單狀態
if ($doc->count_doc_id) {
InventoryCountDoc::where('id', $doc->count_doc_id)->update([
'status' => 'adjusted'
]);
}
});
}