wugg 3 mēneši atpakaļ
vecāks
revīzija
ace259ebe9

+ 0 - 2
app/admin/controller/GoodZx.php

@@ -132,7 +132,6 @@ class GoodZx extends Base{
         }
         return success("更新成功");
     }
-
     public function info(){
         $id = $this->request->post("id","", "int");
         $info = $this->model->with(["brand","unit","cat","Platform","GoodTax"=>["outCategory","inCategory","cgdCategory"]])
@@ -146,5 +145,4 @@ class GoodZx extends Base{
         $info["order_creater_depart"] = $account["depart_name"]??"";
         return  success("获取成功",$info);
     }
-
 }

+ 2 - 2
app/command/makeModel.php

@@ -24,10 +24,10 @@ class makeModel extends Command
 	static $epp = 'cxinv';
     protected function execute(Input $input, Output $output)
     {
-        $str = 'mysql_yz';
+        $str = 'mysql_cxinv';
         self::$schema = Env("{$str}_database");
         self::$prefix =  Env("{$str}_prefix");
-        self::$epp = "youzan";
+        self::$epp = "cxinv";
          //获取表名
         $tables = Db::query("SELECT TABLE_NAME  as 'name'
         from information_schema.tables

+ 125 - 0
app/cxinv/controller/FinancialManager.php

@@ -0,0 +1,125 @@
+<?php
+
+
+namespace app\cxinv\controller;
+
+
+use think\App;
+class FinancialManager extends Base{
+    public function __construct(App $app) {
+        parent::__construct($app);
+        $this->model=new \app\cxinv\model\FinancialManager();
+    }
+    public function List(){
+        $param = $this->request->param(["code"=>"","type"=>"","seller_code"=>"","buyer_code"=>"","orderCode"=>"","cxCode"=>"",
+        "goodNo"=>"","inv_number"=>"","inv_buyer_code"=>"","start"=>"","end"=>"","page"=>1,"size"=>15],"post","trim");
+        $where=[];
+        if($param['code']!="") $where[]= ["code","=","%{$param['code']}%"];
+        if($param['type']!="") $where[]= ["type","=",$param['type']];
+        if($param['start']!="") $where[]= ["create_time",">=",startTime($param['start'])];
+        if($param['end']!="") $where[]= ["create_time","<=",endTime($param['end'])];
+        if($param['seller_code']!="") $where[]= ["seller_code","=",$param['seller_code']];
+        if($param['buyer_code']!="") $where[]= ["buyer_code","=",$param['buyer_code']];
+        if($param['orderCode']!="") $where[]= ["orderCode","=",$param['orderCode']];
+        if($param['cxCode']!="") $where[]= ["cxCode","=",$param['cxCode']];
+        if($param['goodNo']!="") $where[]= ["goodNo","=",$param['goodNo']];
+        if($param['inv_number']!="") $where[]= ["inv_number","=",$param['inv_number']];
+        if($param['inv_buyer_code']!="") $where[]= ["inv_buyer_code","=",$param['inv_buyer_code']];
+        $list = $this->model
+        ->where($where)
+        ->order("id desc")
+        ->paginate(['page'=>$param['page'],'list_rows'=>$param['size']]);
+        return success('获取成功',['list'=>$list->items(),'count'=>$list->total()]);
+    }
+
+    //'code'=>'string',//订单或记录的唯一标识符
+    //        'type'=>'int',//记录类型 1入库2出库
+    //        'source'=>'int',//数据来源,1结算 2 线下订单
+    //        'seller_code'=>'string',//卖方代码
+    //        'seller_name'=>'string',//卖方名称
+    //        'buyer_code'=>'string',//买方代码
+    //        'buyer_name'=>'string',//买方名称
+    //        'orderCode'=>'string',//订单编号
+    //        'cxCode'=>'string',//客户编号
+    //        'poCode'=>'string',//采购订单编号
+    //        'platform_type'=>'int',//平台类型,1ToB 2ToC
+    //        'goodNo'=>'string',//商品编号
+    //        'goodName'=>'string',//商品名称
+    //        'unit'=>'string',//商品单位
+    //        'num'=>'int',//商品数量
+    //        'goodPrice'=>'decimal',//商品单价
+    //        'totalPrice'=>'decimal',//商品总价
+    //        'cat_code'=>'string',//商品分类代码
+    //        'cat_name'=>'string',//商品分类名称
+    //        'tax'=>'decimal',//税率或税费
+    //        'inv_fee'=>'decimal',//发票费用
+    //        'inv_seller_code'=>'string',//发票卖方代码
+    //        'inv_seller_name'=>'string',//发票卖方名称
+    //        'inv_buyer_code'=>'string',//发票买方代码
+    //        'inv_buyer_name'=>'string',//发票买方名称
+    //        'inv_number'=>'string',//发票编号
+    //        'inv_type'=>'string',//发票类型
+    //        'inv_item_id'=>'int',//发票项目ID
+    //        'inv_good_name'=>'string',//发票商品名称
+    //        'inv_cat_code'=>'string',//发票商品分类代码
+    //        'inv_spec'=>'string',//发票商品规格
+    //        'inv_unit'=>'string',//发票商品单位
+    //        'inv_num'=>'int',//发票商品数量
+    //        'inv_subprice'=>'decimal',//发票商品子项单价
+    //        'inv_subtotal'=>'decimal',//发票商品子项总价
+    //        'inv_tax'=>'decimal',//发票税额
+    //        'inv_tax_total'=>'decimal',//发票总税额
+    //        'inv_price'=>'decimal',//发票单价
+    //        'inv_total'=>'decimal',//发票总价
+    //        'cat_diff'=>'int',//分类差异
+    //        'tax_diff'=>'int',//税费差异
+    //        'remark'=>'string',//备注或说明
+    public function create(){
+        $list=$this->request->post("list",[],"trim");
+        $valid = $this->validate($list,[
+            'code|单据编号'=>'require|max:255',
+            'type|单据类型'=>'require|in:1,2,3',
+            "source|单据来源"=>'require|in:1,2',
+            'seller_code|卖方公司纳税识别号'=>'require|max:255',
+            'seller_name|卖方公司名称'=>'require|max:255',
+            'buyer_code|买方公司纳税识别号'=>'require|max:255',
+            'buyer_name|买方公司名称'=>'require|max:255',
+            'orderCode|订单号'=>'max:255',
+            'cxCode|核销单号'=>'max:255',
+            'poCode|采购订单号'=>'max:255',
+            'platform_type|平台类型'=>'require|in:1,2',
+            'goodNo|商品编号'=>'require|max:255',
+            'goodName|商品名称'=>'require|max:255',
+            'unit|商品单位'=>'require|max:255',
+            'num|商品数量'=>'require|integer',
+            'goodPrice|商品单价'=>'require|float',
+            'totalPrice|商品总价'=>'require|float',
+            'cat_code|商品分类代码'=>'require|max:255',
+            'cat_name|商品分类名称'=>'require|max:255',
+            'tax|税率或税费'=>'require|float',
+            'inv_fee|发票费用'=>'float',
+            'inv_seller_code|发票卖方代码'=>'max:255',
+            'inv_seller_name|发票卖方名称'=>'max:255',
+            'inv_buyer_code|发票买方代码'=>'max:255',
+            'inv_buyer_name|发票买方名称'=>'max:255',
+            'inv_number|发票编号'=>'max:255',
+            'inv_type|发票类型'=>'max:255',
+            'inv_item_id|发票项目ID'=>'integer',
+            'inv_good_name|发票商品名称'=>'max:255',
+            'inv_cat_code|发票商品分类代码'=>'max:255',
+            'inv_spec|发票商品规格'=>'max:255',
+            'inv_unit|发票商品单位'=>'max:255',
+            'inv_num|发票商品数量'=>'integer',
+            'inv_subprice|发票商品子项单价'=>'float',
+            'inv_subtotal|发票商品子项总价'=>'float',
+            'inv_tax|发票税额'=>'float',
+            'inv_tax_total|发票总税额'=>'float',
+            'inv_price|发票单价'=>'float',
+            'inv_total|发票总价'=>'float',
+            'cat_diff|分类差异'=>'integer',
+            'tax_diff|税费差异'=>'integer',
+            'remark|备注'=>'max:255',
+        ]);
+
+    }
+}

+ 231 - 0
app/cxinv/controller/FinancialProducts.php

@@ -0,0 +1,231 @@
+<?php
+
+
+namespace app\cxinv\controller;
+
+
+use app\cxinv\model\ProductsCombind;
+use think\App;
+class FinancialProducts extends Base{
+    public function __construct(App $app) {
+        parent::__construct($app);
+        $this->model=new \app\cxinv\model\FinancialProducts();
+    }
+    public function List(){
+       $param = $this->request->param(["skuCode"=>"","good_type"=>"","buyer_code"=>"","buyer_name"=>"","start"=>"",
+       "end"=>"","page"=>1,"size"=>15],"post","trim");
+       $where=[];
+       if($param['skuCode']!="") $where[]= ["skuCode","=","%{$param['skuCode']}%"];
+       if($param['good_type']!="") $where[]= ["good_type","=",$param['good_type']];
+       if($param['buyer_code']!="") $where[]= ["buyer_code","=",$param['buyer_code']];
+       if($param['buyer_name']!="") $where[]= ["buyer_name","like","%{$param['buyer_name']}%"];
+       if($param['start']!="") $where[]= ["create_time",">=",startTime($param['start'])];
+       if($param['end']!="") $where[]= ["create_time","<=",endTime($param['end'])];
+       $list = $this->model
+       ->where($where)
+       ->order("id desc")
+       ->paginate(['page'=>$param['page'],'list_rows'=>$param['size']]);
+        return success('获取成功',['list'=>$list->items(),'count'=>$list->total()]);
+    }
+    public function create(){
+        $param= $this->request->param(["skuCode"=>"","goodName"=>"","good_type"=>"","buyer_code"=>"","buyer_name"=>"",
+        "seller_code"=>"","seller_name"=>"","good_source"=>"","inv_good_name"=>"","is_combind"=>"","spec"=>"","good_code"=>"",
+       "unit"=>"","unit_price"=>"","subunit_price"=>"","unit_weight"=>"","cat_code"=>"","cat_tax"=>"","inv_type"=>"",
+       "basic_status"=>1,"childArr"=>[]],"post","trim");
+        $valid = $this->validate($param,[
+            'skuCode|商品编号'=>'require|max:255',
+            'goodName|商品名称'=>'require|max:255',
+            'good_type|商品类型'=>'require|in:1,2,3',
+            'buyer_code|买方公司纳税识别号'=>'require|max:255',
+            'buyer_name|买方公司名称'=>'require|max:255',
+            'seller_code|卖方公司纳税识别号'=>'require|max:255',
+            'seller_name|卖方公司名称'=>'require|max:255',
+            'good_source|商品来源'=>'require|in:1,2',
+            'inv_good_name|发票商品名称'=>'require|max:255',
+            'is_combind|是否组合商品'=>'require|in:0,1',
+            'spec|规格'=>'max:255',
+            'good_code|商品代码'=>'max:255',
+            'unit|单位'=>'require|max:255',
+            'unit_price|成本税前单价'=>'require|float',
+            'subunit_price|成本税后单价'=>'require|float',
+            'unit_weight|重量'=>'float',
+            "spectral|分光"=>'max:255',
+            'cat_code|进项类目'=>'require|max:255',
+            'cat_tax|进项税率'=>'require|max:255',
+            'inv_type|发票类型'=>'require|max:255',
+            'basic_status|进项成本状态'=>'require|in:1,2',
+            'childArr|商品子商品'=>'requireIf:is_combind:1|array'
+        ]);
+        if($valid!==true) return error($valid);
+        $param['apply_id']=$this->uid;
+        $param['apply_name']=$this->uname;
+        $this->model->startTrans();
+        try{
+             $res = $this->model->create($param);
+             if($res->isEmpty()) throw new \Exception('添加失败');
+             if($param['is_combind']==1){
+                 $parentid = $res->id;
+                 $childRes = (new ProductsCombind)->saveAll(array_map(function ($item) use ($parentid ){
+                                      $item['parent_id']=$parentid;
+                                      return $item;
+                                  },$param['childArr']));
+                 if($childRes->isEmpty()) throw new \Exception('添加失败');
+             }
+             $this->model->commit();
+        }catch (\Exception $e){
+            $this->model->rollback();
+            return error($e->getMessage());
+        }
+
+        return success('添加成功');
+    }
+    public function update(){
+        $param= $this->request->param(["id"=>"","skuCode"=>"","goodName"=>"","good_type"=>"","buyer_code"=>"","buyer_name"=>"",
+        "seller_code"=>"","seller_name"=>"","good_source"=>"","inv_good_name"=>"","is_combind"=>"","spec"=>"","good_code"=>"",
+       "unit"=>"","unit_price"=>"","subunit_price"=>"","unit_weight"=>"","cat_ code"=>"","cat_tax"=>"","inv_type"=>"",
+       "basic_status"=>"","childArr"=>[]],"post","trim");
+        $valid = $this->validate($param,[
+            'id|商品ID'=>'require|integer',
+            'skuCode|商品编号'=>'require|max:255',
+            'goodName|商品名称'=>'require|max:255',
+            'good_type|商品类型'=>'require|in:1,2,3',
+            'buyer_code|买方公司纳税识别号'=>'require|max:255',
+            'buyer_name|买方公司名称'=>'require|max:255',
+            'seller_code|卖方公司纳税识别号'=>'require|max:255',
+            'seller_name|卖方公司名称'=>'require|max:255',
+            'good_source|商品来源'=>'require|in:1,2',
+            'inv_good_name|发票商品名称'=>'require|max:255',
+            'is_combind|是否组合商品'=>'require|in:0,1',
+            'spec|规格'=>'max:255',
+            'good_code|商品代码'=>'max:255',
+            'unit|单位'=>'require|max:255',
+            'unit_price|成本税前单价'=>'require|float',
+            'subunit_price|成本税后单价'=>'require|float',
+            'unit_weight|重量'=>'float',
+            "spectral|分光"=>'max:255',
+            'cat_code|进项类目'=>'require|max:255',
+            'cat_tax|进项税率'=>'require|max:255',
+            'inv_type|发票类型'=>'require|max:255',
+            'basic_status|进项成本状态'=>'require|in:1,2',
+            'childArr|商品子商品'=>'requireIf:is_combind:1|array'
+            ]);
+        if($valid!==true) return error($valid);
+        $info = $this->model->with(['ProductsCombind'])->findOrEmpty($param['id']);
+        if($info->isEmpty()) return error('数据不存在');
+        if($info->is_combind==1|| $param['is_combind']==1){
+            $childIds =array_column($info->ProductsCombind->toArray(),"id") ;
+            $paramChilds = array_column($param['childArr'],'id');
+            $delIds = array_diff($childIds,$paramChilds);
+            $add = array_map(function ($item)use ($param){
+                $item['id']= $item['id']??null;
+                $item['parent_id']=$param['id'];
+                return $item;
+            },$param['childArr']);
+        }
+
+       $this->model->startTrans();
+       try{
+            $res = $info->save($param);
+            if(!$res) throw new \Exception('更新失败');
+            if($param['is_combind']==1){
+                if(!empty($delIds)) ProductsCombind::where(["parent_id"=>$param['id'],"id"=>$delIds])->delete();
+                if(!empty( $add)){
+                    $childRes = (new ProductsCombind)->saveAll( $add);
+                    if($childRes->isEmpty()) throw new \Exception('更新失败');
+                }
+            }
+            $this->model->commit();
+       }catch (\Exception $e){
+           $this->model->rollback();
+           return error($e->getMessage());
+       }
+
+       return success('更新成功');
+    }
+    public function info(){
+        $id= $this->request->param("id","0","int");
+        $info = $this->model->with(["ProductsCombind"=>['products']])->findOrEmpty($id);
+        if($info->isEmpty()) return error('数据不存在');
+        return success('获取成功',$info);
+    }
+    public function delete(){
+        $id= $this->request->param("id","0","int");
+        $info = $this->model->findOrEmpty($id);
+        if($info->isEmpty()) return error('数据不存在');
+        $res = $info->delete();
+        if($info->is_combind==1){
+            ProductsCombind::where("parent_id",$id)->delete();
+        }
+        return $res?success('删除成功'):error('删除失败');
+    }
+    public function status(){
+        $param= $this->request->param(["id"=>"","status"=>""],"post","trim");
+        $valid = $this->validate($param,[
+            'id|商品ID'=>'require|integer',
+            'status|状态'=>'require|in:0,1'
+        ]);
+        if($valid!==true) return error($valid);
+        $info = $this->model->findOrEmpty($param['id']);
+        if($info->isEmpty()) return error('数据不存在');
+        $res = $info->save(['status'=>$param['status']]);
+        return $res?success('修改成功'):error('修改失败');
+    }
+    public function getGoods(){
+        $param= $this->request->param(["skuCode"=>"","good_type"=>"","buyer_code"=>"","seller_code"=>"","start"=>"",
+               "end"=>"","limit"=>100],"post","trim");
+        $valid = $this->validate($param,[
+            'skuCode|商品编号'=>'max:255',
+            'good_type|商品类型'=>'in:1,2,3',
+            'buyer_code|买方公司纳税识别号'=>'max:255',
+            'seller_code|卖方公司纳税识别号'=>'max:255',
+            'start|开始时间'=>'date',
+            'end|结束时间'=>'date'
+        ]);
+        if($valid!==true) return error($valid);
+        $where=[];
+        if(!empty($param['skuCode'])) $where[]=['skuCode','like','%'.$param['skuCode'].'%'];
+        if(!empty($param['good_type'])) $where[]=['good_type','=',$param['good_type']];
+        if(!empty($param['buyer_code'])) $where[]=['buyer_code','like','%'.$param['buyer_code'].'%'];
+        if(!empty($param['seller_code'])) $where[]=['seller_code','like','%'.$param['seller_code'].'%'];
+        if(!empty($param['start']) && !empty($param['end'])) $where[]=['create_time','between',[$param['start'],$param['end']]];
+        $list = $this->model->where($where)->order('id desc')->limit($param['limit'])->select();
+        return success('获取成功',$list);
+    }
+    public function combindGood(){
+        $param= $this->request->param(["parent_id"=>"","childArr"=>[]],"post","trim");
+        $valid = $this->validate($param,[
+            'parent_id|商品ID'=>'require|integer',
+            'childArr|子商品'=>'require|array'
+        ]);
+        if($valid!==true) return error($valid);
+        $parent = $this->model->findOrEmpty($param['pid']);
+        if($parent->isEmpty()) return error('数据不存在');
+        $combind= new ProductsCombind();
+        $ist = $combind->where(['parent_id'=>$param['parent_id']])->column("child_id");
+        $del=array_diff($ist, array_column($param['childArr'],'child_id'));
+        $add=[];
+        foreach ($param['childArr'] as $item){
+            $vali = $this->validate($item,[
+                        'child_id|子商品ID'=>'require|integer',
+                        'child_num|子商品数量'=>'require|integer'
+                    ]);
+            if($vali!==true) return error($vali);
+            $add[]=[
+                "id"=>$ist[$item['child_id']]??null,
+                "parent_id"=>$param['parent_id'],
+                "child_num"=>$item['child_num'],
+                "child_id"=>$item['child_id']
+                ];
+        }
+        $this->model->startTrans();
+        try{
+            if(!empty($del))$combind->where(["parent_id"=>$param['parent_id'],"child_id"=>$del])->delete();
+            if(!empty($add))$combind->saveAll($add);
+            $this->model->commit();
+        }catch (\Exception $e){
+            $this->model->rollback();
+            return error($e->getMessage());
+        }
+        return success('修改成功');
+    }
+}

+ 1 - 1
app/cxinv/controller/Trade.php

@@ -619,7 +619,7 @@ class Trade extends Base{
                  $order->status=1;
                  $ordersave=$order->save();
                  if(!$ordersave) throw new \Exception($value['orderCode'].'订单信息更新失败');
-                 if($order->pay_status==3 && $order->is_comon=0 && $order->cxCode!=''){
+                 if($order->pay_status==3 && $order->is_comon==0 && $order->cxCode!=''){
                         ComonOrder::where(['cxCode'=>$order->cxCode,'status'=>-1])->save(['status'=>0]);
                   }
              }

+ 3 - 3
app/cxinv/model/Assoc.php

@@ -46,7 +46,7 @@ class Assoc extends Base
         $qrd->pay_status = $qrd->wpay_fee==0 && $qrd->pay_fee==0?3:2;
         $qrdsav=$qrd->save();
         if(!$qrdsav) throw new \Exception("关联订单{$data->orderCode}更新失败");
-        if($qrd->pay_status==3 && $qrd->is_comon=0 && $qrd->cxCode!=''){
+        if($qrd->pay_status==3 && $qrd->is_comon==0 && $qrd->cxCode!=''){
             ComonOrder::where(['cxCode'=>$qrd['cxCode'],'status'=>-1])->save(['status'=>0]);
         }
         $data->status = 2;
@@ -65,7 +65,7 @@ class Assoc extends Base
         $qrd->status =$qrd->pay_status==1 && $qrd->inv_status==1?0:1;
         $qrdsav=$qrd->save();
         if(!$qrdsav) throw new \Exception("关联订单{$data->orderCode}更新失败");
-        if($qrd->pay_status==1 && $qrd->is_comon=0 && $qrd->cxCode!='') {
+        if($qrd->pay_status==1 && $qrd->is_comon==0 && $qrd->cxCode!='') {
             ComonOrder::where(['cxCode'=>$qrd->cxCode,'status'=>0])->save(['status'=>-1]);
         }
         $data->status = 3;
@@ -83,7 +83,7 @@ class Assoc extends Base
         $qrd->status =$qrd->pay_status==1 && $qrd->inv_status==1?0:1;
         $qrdsav=$qrd->save();
         if(!$qrdsav) throw new \Exception("关联订单{$data->orderCode}更新失败");
-        if($qrd->pay_status==1 && $qrd->is_comon=0 && $qrd->cxCode!='') {
+        if($qrd->pay_status==1 && $qrd->is_comon==0 && $qrd->cxCode!='') {
             ComonOrder::where(['cxCode'=>$qrd->cxCode,'status'=>0])->save(['status'=>-1]);
         }
         $data->status = 3;

+ 68 - 0
app/cxinv/model/FinancialManager.php

@@ -0,0 +1,68 @@
+<?php
+
+
+namespace app\cxinv\model;
+
+
+use think\model\concern\SoftDelete;
+class FinancialManager extends Base{
+    use SoftDelete;
+    protected $schema=[
+        'id'=>'int',//主键,自动递增
+        'code'=>'string',//订单或记录的唯一标识符
+        'type'=>'int',//记录类型 1入库2出库
+        'source'=>'int',//数据来源,1结算 2 线下订单
+        'seller_code'=>'string',//卖方代码
+        'seller_name'=>'string',//卖方名称
+        'buyer_code'=>'string',//买方代码
+        'buyer_name'=>'string',//买方名称
+        'orderCode'=>'string',//订单编号
+        'cxCode'=>'string',//客户编号
+        'poCode'=>'string',//采购订单编号
+        'platform_type'=>'int',//平台类型,1ToB 2ToC
+        'goodNo'=>'string',//商品编号
+        'goodName'=>'string',//商品名称
+        'unit'=>'string',//商品单位
+        'num'=>'int',//商品数量
+        'goodPrice'=>'decimal',//商品单价
+        'totalPrice'=>'decimal',//商品总价
+        'cat_code'=>'string',//商品分类代码
+        'cat_name'=>'string',//商品分类名称
+        'tax'=>'decimal',//税率或税费
+        'inv_fee'=>'decimal',//发票费用
+        'inv_seller_code'=>'string',//发票卖方代码
+        'inv_seller_name'=>'string',//发票卖方名称
+        'inv_buyer_code'=>'string',//发票买方代码
+        'inv_buyer_name'=>'string',//发票买方名称
+        'inv_number'=>'string',//发票编号
+        'inv_type'=>'string',//发票类型
+        'inv_item_id'=>'int',//发票项目ID
+        'inv_good_name'=>'string',//发票商品名称
+        'inv_cat_code'=>'string',//发票商品分类代码
+        'inv_spec'=>'string',//发票商品规格
+        'inv_unit'=>'string',//发票商品单位
+        'inv_num'=>'int',//发票商品数量
+        'inv_subprice'=>'decimal',//发票商品子项单价
+        'inv_subtotal'=>'decimal',//发票商品子项总价
+        'inv_tax'=>'decimal',//发票税额
+        'inv_tax_total'=>'decimal',//发票总税额
+        'inv_price'=>'decimal',//发票单价
+        'inv_total'=>'decimal',//发票总价
+        'cat_diff'=>'int',//分类差异
+        'tax_diff'=>'int',//税费差异
+        'remark'=>'string',//备注或说明
+        'status'=>'int',//1 正常 2异常/计提
+        'apply_id'=>'int',
+        'apply_name'=>'string',
+        'create_time'=>'datetime',
+        'update_time'=>'datetime',
+        'delete_time'=>'datetime',
+        ];
+    protected $createTime='create_time';
+    protected $updateTime='update_time';
+    protected $deleteTime='delete_time';
+    public static $ManagerType=[1=>'入库',2=>'出库'];
+    public static $ManagerSource=[1=>'结算',2=>'线下订单'];
+    public static $PlatformType=[1=>'ToB',2=>'ToC'];
+
+}

+ 47 - 0
app/cxinv/model/FinancialProducts.php

@@ -0,0 +1,47 @@
+<?php
+namespace app\cxinv\model;
+
+use think\model\concern\SoftDelete;
+class FinancialProducts extends Base
+{
+    use SoftDelete;
+//设置字段信息
+    protected $schema = [
+        'id'  =>'bigint',//
+        'skuCode'  =>'varchar',//订单商品编号
+        'goodName'  =>'varchar',//商品名称
+        'inv_good_name'  =>'varchar',//发票商品名称
+        'saller_code'  =>'varchar',//销售方公司编号
+        'saller_name'  =>'varchar',//销售方公司
+        'buyer_code'  =>'varchar',//买方公司编号
+        'buyer_name'  =>'varchar',//买方公司
+        'good_type'  =>'varchar',//商品类型 1 库存2非库存 3 咨询
+        'good_source'  =>'tinyint',//来源1采销 2 非采销
+        'spec'  =>'varchar',//规格
+        'good_code'  =>'varchar',//商品代码
+        'unit'  =>'varchar',//单位
+        'unit_price'  =>'decimal',//成本税前单价
+        'subunit_price'  =>'decimal',//成本税后单价
+        'unit_weight'  =>'decimal',//单位重量
+        'spectral'  =>'varchar',//分光
+        'inv_type'  =>'varchar',//发票类型
+        'cat_code'  =>'varchar',//进项类目
+        'cat_name'  =>'varchar',//进项类目
+        'cat_tax'  =>'varchar',//税率
+        'status'  =>'tinyint',//0禁用 1启用
+        'basic_status'  =>'tinyint',//1 真实成本 2 预估成本
+        'is_combind'  =>'tinyint',//组合商品 0否 1是
+        'apply_id'  =>'int',//创建人
+        'apply_name'  =>'varchar',//创建人
+        'create_time'  =>'datetime',//
+        'update_time'  =>'datetime',//
+        'delete_time'  =>'datetime',//
+       ];
+    protected $createTime = "create_time";
+    protected $updateTime = "update_time";
+    protected $deleteTime='delete_time';
+
+    public function ProductsCombind(){
+        return $this->hasMany('ProductsCombind','parent_id','id');
+    }
+}

+ 23 - 0
app/cxinv/model/ProductCheck.php

@@ -0,0 +1,23 @@
+<?php
+namespace app\cxinv\model;
+
+class ProductCheck extends Base
+{
+//设置字段信息
+    protected $schema = [
+        'id'  =>'bigint',//
+        'checkCode'  =>'varchar',//盘点编号
+        'product_id'  =>'bigint',//财务商品id
+        'check_num'  =>'bigint',//盘点数量
+        'diff_num'  =>'bigint',//盈亏数量
+        'is_diff'  =>'tinyint',//1盘盈0盘亏
+        'apply_id'  =>'int',//盘点人
+        'apply_name'  =>'varchar',//
+        'create_time'  =>'datetime',//
+        'update_time'  =>'datetime',//
+        'delete_time'  =>'datetime',//
+       ];
+    protected $createTime = 'create_time';
+    protected $updateTime = 'update_time';
+    protected $deleteTime='delete_time';
+}

+ 20 - 0
app/cxinv/model/ProductOnlog.php

@@ -0,0 +1,20 @@
+<?php
+namespace app\cxinv\model;
+
+class ProductOnlog extends Base
+{
+//设置字段信息
+    protected $schema = [
+        'id'  =>'bigint',//
+        'order_item_id'  =>'bigint',//关联明细采购单id
+        'product_id'  =>'bigint',//商品id
+        'first_on_time'  =>'datetime',//第一次入账
+        'on_time'  =>'datetime',//入账时间
+        'num'  =>'int',//入账数量
+        'unit_price'  =>'decimal',//单价
+        'rate'  =>'varchar',//比例
+        'apply_id'  =>'int',//
+        'apply_name'  =>'varchar',//
+        'create_time'  =>'datetime',//
+       ];
+}

+ 20 - 0
app/cxinv/model/ProductOutlog.php

@@ -0,0 +1,20 @@
+<?php
+namespace app\cxinv\model;
+
+class ProductOutlog extends Base
+{
+//设置字段信息
+    protected $schema = [
+        'id'  =>'bigint',//
+        'order_item_id'  =>'bigint',//关联明细采购单id
+        'product_id'  =>'bigint',//商品id
+        'first_out_time'  =>'datetime',//第一次入账
+        'out_time'  =>'datetime',//入账时间
+        'num'  =>'int',//入账数量
+        'unit_price'  =>'decimal',//单价
+        'status'  =>'tinyint',//
+        'apply_id'  =>'int',//
+        'apply_name'  =>'varchar',//
+        'create_time'  =>'datetime',//
+       ];
+}

+ 18 - 0
app/cxinv/model/ProductStock.php

@@ -0,0 +1,18 @@
+<?php
+namespace app\cxinv\model;
+
+class ProductStock extends Base
+{
+//设置字段信息
+    protected $schema = [
+        'id'  =>'bigint',//
+        'product_id'  =>'bigint',//商品id
+        'residue_stock'  =>'bigint',//剩余库存
+        'pending_stock'  =>'bigint',//待出库存
+        'total_stock'  =>'bigint',//总库存
+        'create_time'  =>'datetime',//
+        'updatetime'  =>'datetime',//
+       ];
+    protected $createTime = 'create_time';
+    protected $updateTime = 'update_time';
+}

+ 24 - 0
app/cxinv/model/ProductsCombind.php

@@ -0,0 +1,24 @@
+<?php
+namespace app\cxinv\model;
+
+use think\model\concern\SoftDelete;
+class ProductsCombind extends Base
+{
+    use SoftDelete;
+//设置字段信息
+    protected $schema = [
+        'id'  =>'bigint',//
+        'parent_id'  =>'bigint',//组合商品id
+        'child_id'  =>'bigint',//子商品id
+        'child_num'  =>'int',//子商品每单位对应数量
+        'create_time'  =>'datetime',//
+        'delete_time'  =>'datetime',//
+       ];
+    protected $createTime = 'create_time';
+    protected $updateTime = false;
+    protected $deleteTime = 'delete_time';
+
+    public function Products(){
+        return $this->hasOne('FinancialProducts','id','child_id');
+    }
+}