新增 POS 庫存查詢 API:實作 InventorySyncController 與相關 Service 邏輯,並更新 API 整合手冊
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m24s

This commit is contained in:
2026-03-02 10:19:20 +08:00
parent 4bbbde685d
commit 5f8b2a1c2d
10 changed files with 255 additions and 27 deletions

View File

@@ -259,7 +259,7 @@ class InventoryController extends Controller
$inventory->quantity = $newQty;
// 更新總價值
$inventory->total_value = $inventory->quantity * $inventory->unit_cost;
$inventory->save();
$inventory->saveQuietly(); // 使用 saveQuietly() 避免產生冗餘的「單據已更新」日誌
// 寫入異動紀錄
$inventory->transactions()->create([
@@ -436,7 +436,7 @@ class InventoryController extends Controller
$inventory->quantity = $newQty;
// 更新總值
$inventory->total_value = $inventory->quantity * $inventory->unit_cost;
$inventory->save();
$inventory->saveQuietly(); // 使用 saveQuietly() 避免與下方的 transaction 紀錄重複
// 異動類型映射
$type = $validated['type'] ?? ($isAdjustment ? 'manual_adjustment' : 'adjustment');