feat(inventory): 販賣機視覺優化、修復匯入日期缺失與倉庫刪除權限錯誤

This commit is contained in:
2026-02-09 10:19:46 +08:00
parent f22df90e01
commit 5e542752ba
14 changed files with 255 additions and 71 deletions

View File

@@ -156,8 +156,9 @@ class WarehouseController extends Controller
public function destroy(Warehouse $warehouse)
{
// 檢查是否有相關聯的採購單
if ($warehouse->purchaseOrders()->exists()) {
// 檢查是否有相關聯的採購單 (跨模組檢查,不使用模型關聯以符合解耦規範)
$hasPurchaseOrders = \App\Modules\Procurement\Models\PurchaseOrder::where('warehouse_id', $warehouse->id)->exists();
if ($hasPurchaseOrders) {
return redirect()->back()->with('error', '無法刪除:該倉庫有相關聯的採購單,請先處理採購單。');
}