fix(inventory): 修復調撥單明細庫存顯示與統一過帳按鈕樣式

This commit is contained in:
2026-02-02 09:34:24 +08:00
parent 71458dd976
commit 5e897e4197
3 changed files with 12 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Modules\Inventory\Controllers;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Modules\Inventory\Models\InventoryTransferOrder; use App\Modules\Inventory\Models\InventoryTransferOrder;
use App\Modules\Inventory\Models\Warehouse; use App\Modules\Inventory\Models\Warehouse;
use App\Modules\Inventory\Models\Inventory;
use App\Modules\Inventory\Services\TransferService; use App\Modules\Inventory\Services\TransferService;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Inertia\Inertia; use Inertia\Inertia;
@@ -118,7 +119,13 @@ class TransferOrderController extends Controller
'remarks' => $order->remarks, 'remarks' => $order->remarks,
'created_at' => $order->created_at->format('Y-m-d H:i'), 'created_at' => $order->created_at->format('Y-m-d H:i'),
'created_by' => $order->createdBy?->name, 'created_by' => $order->createdBy?->name,
'items' => $order->items->map(function ($item) { 'items' => $order->items->map(function ($item) use ($order) {
// 獲取來源倉庫的當前庫存
$stock = Inventory::where('warehouse_id', $order->from_warehouse_id)
->where('product_id', $item->product_id)
->where('batch_number', $item->batch_number)
->first();
return [ return [
'id' => (string) $item->id, 'id' => (string) $item->id,
'product_id' => (string) $item->product_id, 'product_id' => (string) $item->product_id,
@@ -127,6 +134,7 @@ class TransferOrderController extends Controller
'batch_number' => $item->batch_number, 'batch_number' => $item->batch_number,
'unit' => $item->product->baseUnit?->name, 'unit' => $item->product->baseUnit?->name,
'quantity' => (float) $item->quantity, 'quantity' => (float) $item->quantity,
'max_quantity' => $stock ? (float) $stock->quantity : 0.0,
'notes' => $item->notes, 'notes' => $item->notes,
]; ];
}), }),

View File

@@ -389,7 +389,7 @@ export default function Index({ warehouses, orders, filters }: any) {
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel></AlertDialogCancel> <AlertDialogCancel></AlertDialogCancel>
<AlertDialogAction onClick={handleDelete} className="bg-red-600 hover:bg-red-700"></AlertDialogAction> <AlertDialogAction onClick={handleDelete} className="button-filled-error"></AlertDialogAction>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>

View File

@@ -251,7 +251,7 @@ export default function Show({ order }: any) {
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel></AlertDialogCancel> <AlertDialogCancel></AlertDialogCancel>
<AlertDialogAction onClick={handleDelete} className="bg-red-600 hover:bg-red-700"></AlertDialogAction> <AlertDialogAction onClick={handleDelete} className="button-filled-error"></AlertDialogAction>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
@@ -287,7 +287,7 @@ export default function Show({ order }: any) {
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogFooter> <AlertDialogFooter>
<AlertDialogCancel></AlertDialogCancel> <AlertDialogCancel></AlertDialogCancel>
<AlertDialogAction onClick={handlePost} className="bg-primary-600 hover:bg-primary-700"></AlertDialogAction> <AlertDialogAction onClick={handlePost} className="button-filled-primary"></AlertDialogAction>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>