123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\common\model;
- use app\common\model\Base;
- use app\common\model\AllocationDetail;
- /**
- * 物品调拨单
- *
- * @property string $date 出入库日期
- * @property int $from_repo_id 调出仓库id
- * @property int $to_repo_id 调入仓库id
- * @property int $revert_id 回滚id
- * @property int $out_io_id 调出单ids
- * @property int $in_io_id 调入单id
- * @property array<AllocationDetail> $details 明细
- * @property Repo $from 调出仓库
- * @property Repo $to 调入仓库
- * @property Io $out_id 调出单
- * @property Io $in_io 调入单
- */
- class Allocation extends Base
- {
- protected $schema = [
- 'id' => 'int', // id
- 'from_repo_id' => 'int', // 调出仓库ID
- 'to_repo_id' => 'int', // 调入仓库ID
- 'create_time' => 'datetime', // 创建时间
- 'update_time' => 'datetime', // 更新时间
- 'delete_time' => 'datetime', // 删除时间
- 'valid' => 'tinyint', // 状态,1启用,0禁用
- 'date' => 'date', // 出入库日期
- 'remark' => 'varchar', // 备注
- 'admin_id' => 'int', // 操作人ID
- 'revert_id' => 'int', // 回滚id
- 'out_io_id' => 'int', // 调出单id
- 'in_io_id' => 'int', // 调入单id
- ];
- public function details()
- {
- return $this->hasMany(AllocationDetail::class);
- }
- public function from()
- {
- return $this->belongsTo(Repo::class, 'from_repo_id', 'id');
- }
- public function to()
- {
- return $this->belongsTo(Repo::class, 'to_repo_id', 'id');
- }
- public function out_io()
- {
- return $this->belongsTo(Io::class, 'out_io_id', 'id');
- }
- public function in_io()
- {
- return $this->belongsTo(Io::class, 'in_io_id', 'id');
- }
- }
|