1. 修復倉庫統計數據加總與樣式。 2. 修正可用庫存計算邏輯(排除不可銷售倉庫)。 3. 撥補單商品列表加入批號與效期顯示。 4. 修正撥補單儲存邏輯以支援精確批號轉移。 5. 整合 FEATURES.md 至 README.md。
42 lines
991 B
PHP
42 lines
991 B
PHP
<?php
|
|
|
|
namespace App\Modules\Procurement\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Modules\Inventory\Models\Product;
|
|
|
|
class PurchaseOrderItem extends Model
|
|
{
|
|
/** @use HasFactory<\Database\Factories\PurchaseOrderItemFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'purchase_order_id',
|
|
'product_id',
|
|
'quantity',
|
|
'unit_price',
|
|
'subtotal',
|
|
// 驗收欄位
|
|
'received_quantity',
|
|
// 批號與效期 (驗收時填寫)
|
|
'batch_number',
|
|
'expiry_date',
|
|
];
|
|
|
|
protected $casts = [
|
|
'quantity' => 'decimal:2',
|
|
'unit_price' => 'decimal:4',
|
|
'subtotal' => 'decimal:2',
|
|
'received_quantity' => 'decimal:2',
|
|
'expiry_date' => 'date',
|
|
];
|
|
|
|
public function purchaseOrder(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(PurchaseOrder::class);
|
|
}
|
|
|
|
|
|
}
|