[FIX] 修復所有 E2E 模組測試的標題定位器以及將測試帳號還原為 admin 權限
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s

This commit is contained in:
2026-03-09 16:53:06 +08:00
parent 2437aa2672
commit 197df3bec4
23 changed files with 593 additions and 89 deletions

View File

@@ -101,11 +101,13 @@ class SalesImportController extends Controller
public function confirm(SalesImportBatch $import, InventoryServiceInterface $inventoryService)
{
if ($import->status !== 'pending') {
return back()->with('error', '此批次無法確認。');
}
return DB::transaction(function () use ($import, $inventoryService) {
// 加上 lockForUpdate() 防止併發確認
$import = SalesImportBatch::lockForUpdate()->find($import->id);
DB::transaction(function () use ($import, $inventoryService) {
if (!$import || $import->status !== 'pending') {
throw new \Exception('此批次無法確認或已被處理。');
}
// 1. Prepare Aggregation
$aggregatedDeductions = []; // Key: "warehouse_id:product_id:slot"