CgdInfo.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. namespace app\cxinv\model;
  3. class CgdInfo extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'bigint',//
  8. 'name' =>'varchar',//采购单名称
  9. 'sequenceNo' =>'varchar',//采购单编号
  10. 'ownerName' =>'varchar',//采购员名称
  11. 'ownerid' =>'int',//采购员id
  12. 'department' =>'varchar',//部门名称
  13. 'createdTime' =>'datetime',//订单创建时间
  14. 'status' =>'tinyint',//订单状态:0未对账,1参与对账,2不参与对账
  15. 'cgdType' =>'tinyint',//采购单类型商品类型:1备库2非库存品3咨询商品
  16. 'cgdSource' =>'tinyint',//订单来源:0备库,1直接下单,2咨询,3项目,4平台,5有赞,6售后补换货,7报备转单,8支付渠道,9网络录单,10结算补录
  17. 'companyNo' =>'varchar',//业务公司编号
  18. 'companyName' =>'varchar',//业务公司
  19. 'cgdTime' =>'datetime',//采购下单时间
  20. 'bkCode' =>'varchar',//备库单编号
  21. 'qrdCode' =>'varchar',//确认单编号
  22. 'goodNo' =>'varchar',//商品编号
  23. 'goodName' =>'varchar',//商品名称
  24. 'goodType' =>'varchar',//商品类型
  25. 'goodBrand' =>'varchar',//商品品牌
  26. 'goodModel' =>'varchar',//商品型号
  27. 'firstCat' =>'varchar',//商品一级分类
  28. 'secCat' =>'varchar',//二级分类
  29. 'thirdCat' =>'varchar',//三级分类
  30. 'catInfo' =>'text',//分类明细
  31. 'fundCode' =>'varchar',//
  32. 'goodMaterial' =>'varchar',//商品材质
  33. 'goodUnit' =>'varchar',//商品单位
  34. 'goodDesc' =>'varchar',//工艺说明
  35. 'metalsType' =>'varchar',//贵金属种类
  36. 'weight' =>'decimal',//商品重量
  37. 'goldPrice' =>'decimal',//贵金属实时金价
  38. 'is_diff' =>'tinyint',//是否有工差
  39. 'deliveryDay' =>'varchar',//物流天数
  40. 'workDay' =>'varchar',//产品工期
  41. 'tax' =>'varchar',//税点
  42. 'barePrice' =>'decimal',//裸价
  43. 'markPrice' =>'decimal',//加标费
  44. 'packPrice' =>'decimal',//包装费
  45. 'certPrice' =>'decimal',//证书费
  46. 'openPrice' =>'decimal',//开模费
  47. 'costPrice' =>'decimal',//工艺费
  48. 'deliveryPrice' =>'decimal',//物流费
  49. 'goodPrice' =>'decimal',//成本合计/单价
  50. 'isStock' =>'tinyint',//是否库存品
  51. 'goodNum' =>'int',//下单数量
  52. 'totalPrice' =>'decimal',//采购总货款
  53. 'origin_total' =>'decimal',//采购总货款
  54. 'supplierNo' =>'varchar',//供应商编号
  55. 'supplierName' =>'varchar',//供应商名称
  56. 'apay_fee' =>'decimal',//已付款金额
  57. 'wpay_fee' =>'decimal',//未付款金额
  58. 'ainv_fee' =>'decimal',//已开票金额
  59. 'winv_fee' =>'decimal',//未开票金额
  60. 'sendType' =>'varchar',//发货方式
  61. 'bkCreater' =>'varchar',//备库申请人
  62. 'sendStatus' =>'tinyint',//发货状态
  63. 'qrdSend' =>'tinyint',//销售单发货状态
  64. 'wsendNum' =>'int',//未发货数量
  65. 'sendNum' =>'int',//已发货数量
  66. 'wareHouse' =>'varchar',//仓库名称
  67. 'wsmCode' =>'varchar',//仓库编号
  68. 'remark' =>'varchar',//备注
  69. 'pay_status' =>'tinyint',//付款情况
  70. 'inv_status' =>'tinyint',//开票情况
  71. 'diff_weight' =>'decimal',//工差重量
  72. 'diff_fee' =>'decimal',//工差金额
  73. 'thNum' =>'int',//退货数量
  74. 'th_fee' =>'decimal',//退货金额
  75. 'check_rate' =>'varchar',//修正后的税率
  76. 'cxCode' =>'varchar',//采销原单号
  77. 'mainCode' =>'varchar',//源头采购单号
  78. 'cgd_status' =>'tinyint',//采购单状态0待供应商确认1待入库2部分入库3全部入库4取消订单
  79. 'is_comon' =>'tinyint',//是否是通用订单 0否1是2源头订单
  80. 'is_del' =>'tinyint',//
  81. 'addtime' =>'datetime',//
  82. 'updatetime' =>'datetime',//
  83. 'supplier_origin_price' =>'decimal',//供应商采购成本
  84. 'cgd_supplier_code' =>'varchar',//采购供应商编号
  85. 'cgd_supplier_name' =>'varchar',//采购供应商名称
  86. 'cgd_apply_id' =>'int',//竞单人
  87. 'cgd_apply_name' =>'varchar',//竞单人
  88. 'inv_tag' =>'tinyint',//回票标签
  89. 'pay_tag' =>'tinyint',//付款标签
  90. 'inv_tag_fee' =>'decimal',//回票标签金额
  91. 'pay_tag_fee' =>'decimal',//付款标签金额
  92. ];
  93. protected $updateTime = 'updatetime';
  94. protected $createTime = 'addtime';
  95. public static function CheckCgd($where,&$data){
  96. $cgdinfo= self::where($where)->where(['status'=>1,'is_del'=>0])->findOrEmpty();
  97. if(!$cgdinfo->isEmpty()){
  98. if($cgdinfo['inv_tag']==1){
  99. $uname= TagLog::alias('a')
  100. ->join('order_tag b','a.tag_id=b.id','left')
  101. ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>6])
  102. ->order('a.id desc')
  103. ->value('creater','');
  104. $data[]=['type'=>'结算采购单回票标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],
  105. 'companyName'=>$cgdinfo['companyName']];
  106. }
  107. if($cgdinfo['pay_tag']==1){
  108. $uname= TagLog::alias('a')
  109. ->join('order_tag b','a.tag_id=b.id','left')
  110. ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>5])
  111. ->order('a.id desc')
  112. ->value('creater','');
  113. $data[]=['type'=>'结算采购单付款标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],'companyName'=>$cgdinfo['companyName']];
  114. }
  115. PayInfo::CheckCgd($cgdinfo['sequenceNo'],$data);
  116. InvoiceOrder::CheckOrder($cgdinfo['sequenceNo'],$data);
  117. }
  118. }
  119. }