feat(inventory): 完善庫存盤調更新與日誌邏輯,新增「無需盤調」狀態判定
1. 修正 AdjustDocController 缺失 update 方法導致的錯誤。 2. 修正 ActivityDetailDialog 前端 map 渲染 undefined 的 TypeError。 3. 優化盤調單「過帳」日誌,現在會同步包含當時的商品明細快照。 4. 實作盤點單「無需盤調」(no_adjust) 自動判定邏輯: - 當盤點數量與庫存完全一致時,自動標記為 no_adjust 結案。 - 更新前端標籤樣式與操作按鈕對應邏輯。 - 限制 no_adjust 單據不可重複建立盤調單。 5. 統一盤點單與盤調單的日誌配置,優化 ID 轉名稱顯示。
This commit is contained in:
@@ -143,6 +143,8 @@ export default function Index({ docs, warehouses, filters }: any) {
|
||||
return <Badge className="bg-blue-500 hover:bg-blue-600">盤點中</Badge>;
|
||||
case 'completed':
|
||||
return <Badge className="bg-green-500 hover:bg-green-600">盤點完成</Badge>;
|
||||
case 'no_adjust':
|
||||
return <Badge className="bg-green-600 hover:bg-green-700">盤點完成 (無需盤調)</Badge>;
|
||||
case 'adjusted':
|
||||
return <Badge className="bg-purple-500 hover:bg-purple-600">已盤調庫存</Badge>;
|
||||
case 'cancelled':
|
||||
@@ -307,7 +309,7 @@ export default function Index({ docs, warehouses, filters }: any) {
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
{/* Action Button Logic: Prefer Edit if allowed and status is active, otherwise fallback to View if allowed */}
|
||||
{(() => {
|
||||
const isEditable = !['completed', 'adjusted'].includes(doc.status);
|
||||
const isEditable = !['completed', 'no_adjust', 'adjusted'].includes(doc.status);
|
||||
const canEdit = can('inventory_count.edit');
|
||||
const canView = can('inventory_count.view');
|
||||
|
||||
@@ -343,7 +345,7 @@ export default function Index({ docs, warehouses, filters }: any) {
|
||||
|
||||
return null;
|
||||
})()}
|
||||
{!['completed', 'adjusted'].includes(doc.status) && (
|
||||
{!['completed', 'no_adjust', 'adjusted'].includes(doc.status) && (
|
||||
<Can permission="inventory_count.delete">
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function Show({ doc }: any) {
|
||||
}
|
||||
|
||||
const { can } = usePermission();
|
||||
const isCompleted = ['completed', 'adjusted'].includes(doc.status);
|
||||
const isCompleted = ['completed', 'no_adjust', 'adjusted'].includes(doc.status);
|
||||
const canEdit = can('inventory_count.edit');
|
||||
const isReadOnly = isCompleted || !canEdit;
|
||||
|
||||
@@ -105,6 +105,9 @@ export default function Show({ doc }: any) {
|
||||
{doc.status === 'completed' && (
|
||||
<Badge className="bg-green-500 hover:bg-green-600">盤點完成</Badge>
|
||||
)}
|
||||
{doc.status === 'no_adjust' && (
|
||||
<Badge className="bg-green-600 hover:bg-green-700">盤點完成 (無需盤調)</Badge>
|
||||
)}
|
||||
{doc.status === 'adjusted' && (
|
||||
<Badge className="bg-purple-500 hover:bg-purple-600">已盤調庫存</Badge>
|
||||
)}
|
||||
@@ -128,7 +131,7 @@ export default function Show({ doc }: any) {
|
||||
列印
|
||||
</Button>
|
||||
|
||||
{doc.status === 'completed' && (
|
||||
{['completed', 'no_adjust'].includes(doc.status) && (
|
||||
<Can permission="inventory.adjust">
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
|
||||
Reference in New Issue
Block a user