FinancialProducts.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\cxinv\model;
  3. use app\user\model\TaxCategory;
  4. use think\model\concern\SoftDelete;
  5. class FinancialProducts extends Base
  6. {
  7. use SoftDelete;
  8. //设置字段信息
  9. protected $schema = [
  10. 'id' =>'bigint',//
  11. 'skuCode' =>'varchar',//订单商品编号
  12. 'goodName' =>'varchar',//商品名称
  13. 'inv_good_name' =>'varchar',//发票商品名称
  14. 'seller_code' =>'varchar',//销售方公司编号
  15. 'seller_name' =>'varchar',//销售方公司
  16. 'buyer_code' =>'varchar',//买方公司编号
  17. 'buyer_name' =>'varchar',//买方公司
  18. 'good_type' =>'varchar',//商品类型 1 库存2非库存 3 咨询
  19. 'good_source' =>'tinyint',//来源1采销 2 非采销
  20. 'spec' =>'varchar',//规格
  21. 'good_code' =>'varchar',//商品代码
  22. 'unit' =>'varchar',//单位
  23. 'unit_price' =>'decimal',//成本税前单价
  24. 'subunit_price' =>'decimal',//成本税后单价
  25. 'unit_weight' =>'decimal',//单位重量
  26. 'spectral' =>'varchar',//分光
  27. 'inv_type' =>'varchar',//发票类型
  28. 'cat_code' =>'varchar',//进项类目
  29. 'cat_tax' =>'varchar',//税率
  30. 'status' =>'tinyint',//0禁用 1启用
  31. 'basic_status' =>'tinyint',//1 真实成本 2 预估成本
  32. 'is_combind' =>'tinyint',//组合商品 0否 1是
  33. 'apply_id' =>'int',//创建人
  34. 'apply_name' =>'varchar',//创建人
  35. 'create_time' =>'datetime',//
  36. 'update_time' =>'datetime',//
  37. 'delete_time' =>'datetime',//
  38. ];
  39. protected $createTime = "create_time";
  40. protected $updateTime = "update_time";
  41. protected $deleteTime='delete_time';
  42. public function ProductsCombind(){
  43. return $this->hasMany('ProductsCombind','parent_id','id');
  44. }
  45. public function CatInfo(){
  46. return $this->belongsTo(TaxCategory::class,'cat_code','merge_code')->bind(["cat_name","merge_code","short_name"]);
  47. }
  48. public function ProductStock(){
  49. return $this->hasOne(ProductStock::class,'product_id','id')->bind(['residue_stock','total_stock','pending_stock']);
  50. }
  51. }