feat: 修正庫存與撥補單邏輯並整合文件
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 53s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

1. 修復倉庫統計數據加總與樣式。
2. 修正可用庫存計算邏輯(排除不可銷售倉庫)。
3. 撥補單商品列表加入批號與效期顯示。
4. 修正撥補單儲存邏輯以支援精確批號轉移。
5. 整合 FEATURES.md 至 README.md。
This commit is contained in:
2026-01-26 14:59:24 +08:00
parent b0848a6bb8
commit 106de4e945
81 changed files with 4118 additions and 1023 deletions

View File

@@ -4,12 +4,16 @@ namespace App\Modules\Procurement\Controllers;
use App\Http\Controllers\Controller;
use App\Modules\Procurement\Models\Vendor;
use App\Modules\Inventory\Contracts\InventoryServiceInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class VendorProductController extends Controller
{
public function __construct(
protected InventoryServiceInterface $inventoryService
) {}
/**
* 新增供貨商品 (Attach)
*/
@@ -30,7 +34,7 @@ class VendorProductController extends Controller
]);
// 記錄操作
$product = \App\Modules\Inventory\Models\Product::find($validated['product_id']);
$product = $this->inventoryService->getProduct($validated['product_id']);
activity()
->performedOn($vendor)
->withProperties([
@@ -68,7 +72,7 @@ class VendorProductController extends Controller
]);
// 記錄操作
$product = \App\Modules\Inventory\Models\Product::find($productId);
$product = $this->inventoryService->getProduct($productId);
activity()
->performedOn($vendor)
->withProperties([
@@ -97,7 +101,7 @@ class VendorProductController extends Controller
public function destroy(Vendor $vendor, $productId)
{
// 記錄操作 (需在 detach 前獲取資訊)
$product = \App\Modules\Inventory\Models\Product::find($productId);
$product = $this->inventoryService->getProduct($productId);
$old_price = $vendor->products()->where('product_id', $productId)->first()?->pivot?->last_price;
$vendor->products()->detach($productId);