優化門市叫貨流程:實作庫存預扣機制、鎖定自動產生的調撥單明細、修復自動販賣機貨道數量連動 Bug 及狀態同步問題
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 56s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 56s
This commit is contained in:
@@ -269,6 +269,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
|
||||
const canEdit = can('inventory_transfer.edit');
|
||||
const isReadOnly = (order.status !== 'draft' || !canEdit);
|
||||
const isItemsReadOnly = isReadOnly || !!order.requisition;
|
||||
const isVending = order.to_warehouse_type === 'vending';
|
||||
|
||||
// 狀態 Badge 渲染
|
||||
@@ -567,7 +568,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
請選擇要調撥的商品並輸入數量。所有商品將從「{order.from_warehouse_name}」轉出。
|
||||
</p>
|
||||
</div>
|
||||
{!isReadOnly && (
|
||||
{!isItemsReadOnly && (
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" className="button-outlined-primary" onClick={() => setIsImportDialogOpen(true)}>
|
||||
<Package className="h-4 w-4 mr-2" />
|
||||
@@ -736,7 +737,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
<TableHead className="font-medium text-grey-600">單位</TableHead>
|
||||
{isVending && <TableHead className="font-medium text-grey-600">貨道</TableHead>}
|
||||
<TableHead className="font-medium text-grey-600">備註</TableHead>
|
||||
{!isReadOnly && <TableHead className="w-[50px]"></TableHead>}
|
||||
{!isItemsReadOnly && <TableHead className="w-[50px]"></TableHead>}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@@ -768,7 +769,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
{item.max_quantity} {item.unit || item.unit_name}
|
||||
</TableCell>
|
||||
<TableCell className="px-1 py-3">
|
||||
{isReadOnly ? (
|
||||
{isItemsReadOnly ? (
|
||||
<div className="text-right font-semibold mr-2">{item.quantity}</div>
|
||||
) : (
|
||||
<div className="flex flex-col gap-1 items-end pr-2">
|
||||
@@ -786,7 +787,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
<TableCell className="text-sm text-gray-500">{item.unit || item.unit_name}</TableCell>
|
||||
{isVending && (
|
||||
<TableCell className="px-1">
|
||||
{isReadOnly ? (
|
||||
{isItemsReadOnly ? (
|
||||
<span className="text-sm font-medium">{item.position}</span>
|
||||
) : (
|
||||
<Input
|
||||
@@ -799,7 +800,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
</TableCell>
|
||||
)}
|
||||
<TableCell className="px-1">
|
||||
{isReadOnly ? (
|
||||
{isItemsReadOnly ? (
|
||||
<span className="text-sm text-gray-600">{item.notes}</span>
|
||||
) : (
|
||||
<Input
|
||||
@@ -810,7 +811,7 @@ export default function Show({ order, transitWarehouses = [] }: { order: any; tr
|
||||
/>
|
||||
)}
|
||||
</TableCell>
|
||||
{!isReadOnly && (
|
||||
{!isItemsReadOnly && (
|
||||
<TableCell className="text-center">
|
||||
<Button variant="outline" size="icon" className="button-outlined-error h-8 w-8" onClick={() => handleRemoveItem(index)}>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
|
||||
Reference in New Issue
Block a user