123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- namespace app\cxinv\model;
- class CgdInfo extends Base
- {
- //设置字段信息
- protected $schema = [
- 'id' =>'bigint',//
- 'name' =>'varchar',//采购单名称
- 'sequenceNo' =>'varchar',//采购单编号
- 'ownerName' =>'varchar',//采购员名称
- 'ownerid' =>'int',//采购员id
- 'department' =>'varchar',//部门名称
- 'createdTime' =>'datetime',//订单创建时间
- 'status' =>'tinyint',//订单状态:0未对账,1参与对账,2不参与对账
- 'cgdType' =>'tinyint',//采购单类型商品类型:1备库2非库存品3咨询商品
- 'cgdSource' =>'tinyint',//订单来源:0备库,1直接下单,2咨询,3项目,4平台,5有赞,6售后补换货,7报备转单,8支付渠道,9网络录单,10结算补录
- 'companyNo' =>'varchar',//业务公司编号
- 'companyName' =>'varchar',//业务公司
- 'cgdTime' =>'datetime',//采购下单时间
- 'bkCode' =>'varchar',//备库单编号
- 'qrdCode' =>'varchar',//确认单编号
- 'goodNo' =>'varchar',//商品编号
- 'goodName' =>'varchar',//商品名称
- 'goodType' =>'varchar',//商品类型
- 'goodBrand' =>'varchar',//商品品牌
- 'goodModel' =>'varchar',//商品型号
- 'firstCat' =>'varchar',//商品一级分类
- 'secCat' =>'varchar',//二级分类
- 'thirdCat' =>'varchar',//三级分类
- 'catInfo' =>'text',//分类明细
- 'fundCode' =>'varchar',//
- 'goodMaterial' =>'varchar',//商品材质
- 'goodUnit' =>'varchar',//商品单位
- 'goodDesc' =>'varchar',//工艺说明
- 'metalsType' =>'varchar',//贵金属种类
- 'weight' =>'decimal',//商品重量
- 'goldPrice' =>'decimal',//贵金属实时金价
- 'is_diff' =>'tinyint',//是否有工差
- 'deliveryDay' =>'varchar',//物流天数
- 'workDay' =>'varchar',//产品工期
- 'tax' =>'varchar',//税点
- 'barePrice' =>'decimal',//裸价
- 'markPrice' =>'decimal',//加标费
- 'packPrice' =>'decimal',//包装费
- 'certPrice' =>'decimal',//证书费
- 'openPrice' =>'decimal',//开模费
- 'costPrice' =>'decimal',//工艺费
- 'deliveryPrice' =>'decimal',//物流费
- 'goodPrice' =>'decimal',//成本合计/单价
- 'isStock' =>'tinyint',//是否库存品
- 'goodNum' =>'int',//下单数量
- 'totalPrice' =>'decimal',//采购总货款
- 'origin_total' =>'decimal',//采购总货款
- 'supplierNo' =>'varchar',//供应商编号
- 'supplierName' =>'varchar',//供应商名称
- 'apay_fee' =>'decimal',//已付款金额
- 'wpay_fee' =>'decimal',//未付款金额
- 'ainv_fee' =>'decimal',//已开票金额
- 'winv_fee' =>'decimal',//未开票金额
- 'sendType' =>'varchar',//发货方式
- 'bkCreater' =>'varchar',//备库申请人
- 'sendStatus' =>'tinyint',//发货状态
- 'qrdSend' =>'tinyint',//销售单发货状态
- 'wsendNum' =>'int',//未发货数量
- 'sendNum' =>'int',//已发货数量
- 'wareHouse' =>'varchar',//仓库名称
- 'wsmCode' =>'varchar',//仓库编号
- 'remark' =>'varchar',//备注
- 'pay_status' =>'tinyint',//付款情况
- 'inv_status' =>'tinyint',//开票情况
- 'diff_weight' =>'decimal',//工差重量
- 'diff_fee' =>'decimal',//工差金额
- 'thNum' =>'int',//退货数量
- 'th_fee' =>'decimal',//退货金额
- 'check_rate' =>'varchar',//修正后的税率
- 'cxCode' =>'varchar',//采销原单号
- 'mainCode' =>'varchar',//源头采购单号
- 'cgd_status' =>'tinyint',//采购单状态0待供应商确认1待入库2部分入库3全部入库4取消订单
- 'is_comon' =>'tinyint',//是否是通用订单 0否1是2源头订单
- 'is_del' =>'tinyint',//
- 'addtime' =>'datetime',//
- 'updatetime' =>'datetime',//
- 'supplier_origin_price' =>'decimal',//供应商采购成本
- 'cgd_supplier_code' =>'varchar',//采购供应商编号
- 'cgd_supplier_name' =>'varchar',//采购供应商名称
- 'cgd_apply_id' =>'int',//竞单人
- 'cgd_apply_name' =>'varchar',//竞单人
- 'inv_tag' =>'tinyint',//回票标签
- 'pay_tag' =>'tinyint',//付款标签
- 'inv_tag_fee' =>'decimal',//回票标签金额
- 'pay_tag_fee' =>'decimal',//付款标签金额
- ];
- protected $updateTime = 'updatetime';
- protected $createTime = 'addtime';
- public static function CheckCgd($where,&$data){
- $cgdinfo= self::where($where)->where(['status'=>1,'is_del'=>0])->findOrEmpty();
- if(!$cgdinfo->isEmpty()){
- if($cgdinfo['inv_tag']==1){
- $uname= TagLog::alias('a')
- ->join('order_tag b','a.tag_id=b.id','left')
- ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>6])
- ->order('a.id desc')
- ->value('creater','');
- $data[]=['type'=>'结算采购单回票标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],
- 'companyName'=>$cgdinfo['companyName']];
- }
- if($cgdinfo['pay_tag']==1){
- $uname= TagLog::alias('a')
- ->join('order_tag b','a.tag_id=b.id','left')
- ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>5])
- ->order('a.id desc')
- ->value('creater','');
- $data[]=['type'=>'结算采购单付款标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],'companyName'=>$cgdinfo['companyName']];
- }
- PayInfo::CheckCgd($cgdinfo['sequenceNo'],$data);
- InvoiceOrder::CheckOrder($cgdinfo['sequenceNo'],$data);
- }
- }
- }
|