Files
xin-procurement/app/Models/ReconciliationItemModel.php
T
2026-08-12 14:38:20 +08:00

83 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* 对账明细模型(订货量/称重/数量/金额可修改,diff = publish actual
*/
class ReconciliationItemModel extends Model
{
/** 未对账 */
public const NOT_RECONCILED = 0;
/** 已对账 */
public const RECONCILED = 1;
protected $table = 'reconciliation_item';
protected $primaryKey = 'id';
protected $fillable = [
'recon_id',
'store_id',
'order_item_id',
'product_id',
'product_name',
'quantity',
'weight',
'publish_amount',
'actual_amount',
'diff_amount',
'is_reconciled',
'store_remark',
'sort',
];
protected $casts = [
'recon_id' => 'integer',
'store_id' => 'integer',
'order_item_id' => 'integer',
'product_id' => 'integer',
'quantity' => 'decimal:2',
'weight' => 'decimal:3',
'publish_amount' => 'decimal:2',
'actual_amount' => 'decimal:2',
'diff_amount' => 'decimal:2',
'is_reconciled' => 'integer',
'sort' => 'integer',
];
/**
* 所属对账单
*/
public function recon(): BelongsTo
{
return $this->belongsTo(ReconciliationModel::class, 'recon_id', 'id');
}
/**
* 所属门店
*/
public function store(): BelongsTo
{
return $this->belongsTo(StoreModel::class, 'store_id', 'id');
}
/**
* 对账商品
*/
public function product(): BelongsTo
{
return $this->belongsTo(ProductModel::class, 'product_id', 'id');
}
/**
* 溯源订货明细
*/
public function orderItem(): BelongsTo
{
return $this->belongsTo(StoreOrderItemModel::class, 'order_item_id', 'id');
}
}