實作產品與庫存匯入邏輯 (ProductImport, InventoryImport) 並更新相關 Service 與 Controller
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 56s

This commit is contained in:
2026-03-02 11:58:04 +08:00
parent 649af40919
commit 7dac2d1f77
7 changed files with 138 additions and 114 deletions

View File

@@ -23,7 +23,12 @@ class InventoryImport implements ToModel, WithHeadingRow, WithValidation, WithMa
{
HeadingRowFormatter::default('none');
$this->warehouse = $warehouse;
$this->inboundDate = $inboundDate;
// 修正時間精度:將選定的日期與「現在的時分秒」結合
// 這樣既能保留使用者選的日期,又能提供精確的紀錄時點排順序
$currentTime = date('H:i:s');
$this->inboundDate = $inboundDate . ' ' . $currentTime;
$this->notes = $notes;
}
@@ -95,7 +100,7 @@ class InventoryImport implements ToModel, WithHeadingRow, WithValidation, WithMa
// 更新單價與總價值
$inventory->unit_cost = $unitCost;
$inventory->total_value = $inventory->quantity * $unitCost;
$inventory->save();
$inventory->saveQuietly();
// 記錄交易歷史
$inventory->transactions()->create([