refactor: 重構 VendorProduct API 與新增進貨單重複檢查前端邏輯
1. 將 VendorProductController 中的 Eloquent 關聯操作改為透過 ProcurementService 使用 DB 操作,解除跨模組 Model 直接依賴。 2. ProcurementService 加入 vendor product 的資料存取方法。 3. 進貨單建立前端 (GoodsReceipt/Create.tsx) 新增重複進貨檢查與警告對話框邏輯。
This commit is contained in:
@@ -79,4 +79,29 @@ interface ProcurementServiceInterface
|
||||
* @return Collection
|
||||
*/
|
||||
public function getVendorsByIds(array $ids): Collection;
|
||||
|
||||
/**
|
||||
* 新增供貨商品關聯
|
||||
*/
|
||||
public function attachProductToVendor(int $vendorId, int $productId, ?float $lastPrice): void;
|
||||
|
||||
/**
|
||||
* 更新供貨商品價格
|
||||
*/
|
||||
public function updateVendorProductPrice(int $vendorId, int $productId, ?float $lastPrice): void;
|
||||
|
||||
/**
|
||||
* 檢查廠商是否已有該供貨商品
|
||||
*/
|
||||
public function checkVendorHasProduct(int $vendorId, int $productId): bool;
|
||||
|
||||
/**
|
||||
* 取得供貨商品的價格
|
||||
*/
|
||||
public function getVendorProductPrice(int $vendorId, int $productId): ?float;
|
||||
|
||||
/**
|
||||
* 移除供貨商品關聯
|
||||
*/
|
||||
public function detachProductFromVendor(int $vendorId, int $productId): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user