wufeng 2 years ago
parent
commit
f5fd756d8a
1 changed files with 5 additions and 21 deletions
  1. 5 21
      app/admin/controller/Purch.php

+ 5 - 21
app/admin/controller/Purch.php

@@ -114,15 +114,7 @@ class Purch extends Base
         $count=Db::name("purchease_order")->where($where)->count();
         $total = ceil($count/$size);
         $page = $page >= $total ? $total : $page;
-        $list = Db::name("purchease_order")
-            ->where($where)
-            ->page($page,$size)
-            ->order("addtime desc")
-            ->select()
-            ->toArray();
-        $all_orderCodes = Db::name('order_num')
-            ->whereIn('cgdNo',array_column($list,'cgdNo'))
-            ->column('orderCode','cgdNo');
+        $list = Db::name("purchease_order")->where($where)->page($page,$size)->order("addtime desc")->select();
         $data=[];
         foreach ($list as $value){
             $value['wsm_name']="";
@@ -163,9 +155,6 @@ class Purch extends Base
 
             $inorder= Db::name("purchease_in")->where(['cgdNo'=>$value['cgdNo'],"is_del"=>0])->select();
             $value['child']=empty($inorder)? [] : $inorder;
-
-            //补充orderCode
-            $value['orderCode']=isset($all_orderCodes[$value['cgdNo']])?$all_orderCodes[$value['cgdNo']]:'';
             $data[]=$value;
         }
         return app_show(0,"获取成功",["list"=>$data ,"count"=>$count]);
@@ -287,11 +276,6 @@ class Purch extends Base
         $data['company'] = isset($company['company'])?$company['company']:"";
         //$data['info'] = $var;
         $data['purcheaseback'] = $var;
-
-        //补充orderCode
-        $data['orderCode']=$all_orderCodes = Db::name('order_num')
-            ->where('cgdNo',$data['cgdNo'])
-            ->value('orderCode','');
         return app_show(0,"获取成功",$data);
     }
 
@@ -641,10 +625,10 @@ class Purch extends Base
             $item = Db::name("purchease_diff")->insert($data,true);
             if($item>0){
 
-                            $sto = ["order_code"=>$cgdNo,"status"=>1,"action_remark"=>'',"action_type"=>"create"];
-                            ActionLog::logAdd($this->post['token'],$sto,"CGGCD",1,$data);
-                            $process=["order_code"=>$cgdNo,"order_id"=>$item,"order_status"=>1,"order_type"=>'CGGCD',"before_status"=>1];
-                            ProcessOrder::AddProcess($this->post['token'],$process);
+                $sto = ["order_code"=>$cgdNo,"status"=>1,"action_remark"=>'',"action_type"=>"create"];
+                ActionLog::logAdd($this->post['token'],$sto,"CGGCD",1,$data);
+                $process=["order_code"=>$cgdNo,"order_id"=>$item,"order_status"=>1,"order_type"=>'CGGCD',"before_status"=>1];
+                ProcessOrder::AddProcess($this->post['token'],$process);
 
                 $orderCode = Db::name("order_num")->where([["cgdNo","=",$cg['cgdNo']],["status","=",1]])->find();
                 if($orderCode!=false){