Allocation.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace app\common\model;
  3. use app\common\model\Base;
  4. use app\common\model\AllocationDetail;
  5. /**
  6. * 物品调拨单
  7. *
  8. * @property string $date 出入库日期
  9. * @property int $from_repo_id 调出仓库id
  10. * @property int $to_repo_id 调入仓库id
  11. * @property int $revert_id 回滚id
  12. * @property int $out_io_id 调出单ids
  13. * @property int $in_io_id 调入单id
  14. * @property array<AllocationDetail> $details 明细
  15. * @property Repo $from 调出仓库
  16. * @property Repo $to 调入仓库
  17. * @property Io $out_id 调出单
  18. * @property Io $in_io 调入单
  19. */
  20. class Allocation extends Base
  21. {
  22. protected $schema = [
  23. 'id' => 'int', // id
  24. 'from_repo_id' => 'int', // 调出仓库ID
  25. 'to_repo_id' => 'int', // 调入仓库ID
  26. 'create_time' => 'datetime', // 创建时间
  27. 'update_time' => 'datetime', // 更新时间
  28. 'delete_time' => 'datetime', // 删除时间
  29. 'valid' => 'tinyint', // 状态,1启用,0禁用
  30. 'date' => 'date', // 出入库日期
  31. 'remark' => 'varchar', // 备注
  32. 'admin_id' => 'int', // 操作人ID
  33. 'revert_id' => 'int', // 回滚id
  34. 'out_io_id' => 'int', // 调出单id
  35. 'in_io_id' => 'int', // 调入单id
  36. ];
  37. public function details()
  38. {
  39. return $this->hasMany(AllocationDetail::class);
  40. }
  41. public function from()
  42. {
  43. return $this->belongsTo(Repo::class, 'from_repo_id', 'id');
  44. }
  45. public function to()
  46. {
  47. return $this->belongsTo(Repo::class, 'to_repo_id', 'id');
  48. }
  49. public function out_io()
  50. {
  51. return $this->belongsTo(Io::class, 'out_io_id', 'id');
  52. }
  53. public function in_io()
  54. {
  55. return $this->belongsTo(Io::class, 'in_io_id', 'id');
  56. }
  57. }