CaiWuXiTong/app/Models/Business/CourierStockQuoteEntry.php
limeng 9a25db91cc feat(报价管理): 存量报价整本批量录入及签署原图归档 (#346)
保留各家工作表报价原文、公式、独立执行日期及签署原件;审核后按执行日期管理版本。33项测试、336项断言通过。生产业务迁移已获明确授权,服务器私有备份已完成并逐条校验。
2026-10-16 14:56:44 +08:00

39 lines
1.3 KiB
PHP

<?php
namespace App\Models\Business;
use App\Abstracts\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CourierStockQuoteEntry extends Model
{
protected $table = 'business_courier_stock_quote_entries';
protected $fillable = [
'company_id', 'courier_expcode', 'courier_name', 'quote_type', 'source_change_id',
'sheet_name', 'source_range', 'values_json', 'formulas_json', 'files', 'created_by',
];
protected $casts = ['company_id' => 'integer', 'files' => 'array'];
public function change(): BelongsTo
{
return $this->belongsTo(CourierQuoteChange::class, 'source_change_id');
}
public function sourceQuote(): array
{
return [
'id' => 'STOCK-' . $this->id,
'courier_expcode' => $this->courier_expcode,
'billing_rules' => data_get($this->change?->quote_payload, 'billing_rules'),
'company_name' => $this->courier_name,
'sheet_name' => $this->sheet_name,
'quote_type' => $this->quote_type,
'source_range' => $this->source_range,
'values' => json_decode($this->values_json, true, 512, JSON_THROW_ON_ERROR),
'formulas' => json_decode($this->formulas_json, true, 512, JSON_THROW_ON_ERROR),
];
}
}