panlumeng 3 years ago
parent
commit
7ad95ab5fa

+ 21 - 0
app/admin/controller/Proorder.php

@@ -80,4 +80,25 @@ public function waitlist(){
     }
     return app_show(0,"获取成功",['count'=>$count,"list"=>$data]);
 }
+public function all(){
+    $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+    if($token==""){
+        return error_show(101,'token不能为空');
+    }
+    $effetc = VerifyTokens($token);
+    if(!empty($effetc) && $effetc['code']!=0){
+        return error_show($effetc['code'],$effetc['message']);
+    }
+    $where=[["is_del","=",0]];
+    $process_name = isset($this->post['process_name']) && $this->post['process_name'] !==""? trim($this->post['process_name']) :"";
+    if($process_name!=""){
+        $where[]=["process_name","like","%$process_name%"];
+    }
+    $process_type = isset($this->post['process_type']) && $this->post['process_type'] !==""? trim($this->post['process_type']) :"";
+    if($process_type!=""){
+        $where[]=["process_type","like","%$process_type%"];
+    }
+    $list = Db::name('process')->where($where)->order("addtime desc")->select();
+    return app_show(0,"获取成功",$list);
+}
 }

+ 22 - 15
app/admin/controller/Purch.php

@@ -376,38 +376,39 @@ class Purch extends \app\BaseController
     public function difflist(){
         $page = isset($this->post['page']) && $this->post['page'] !==""? intval($this->post['page']):"1";
         $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']):"10";
-        $where = [['is_del',"=",0]];
+        $where = [['a.is_del',"=",0],['b.is_del',"=",0]];
         $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo']!="" ? trim($this->post['cgdNo']):"";
         if($cgdNo!=""){
-            $where[]=['cgdNo',"like", "%$cgdNo%"];
+            $where[]=['a.cgdNo',"like", "%$cgdNo%"];
         }
         $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"";
         if($status!==""){
-            $where[]=['status',"=",$status];
+            $where[]=['a.status',"=",$status];
         }
         $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
         if ($start !="") {
-            $where[]= ["addtime",'>=',$start];
+            $where[]= ["a.addtime",'>=',$start];
         }
         $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
         if($end !=""){
-            $where[]= ["addtime",'<=',$end];
+            $where[]= ["a.addtime",'<=',$end];
         }
         $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !==""? intval($this->post['apply_name']):"";
         if($apply_name!==""){
-            $where[]=['apply_name',"like","%$apply_name%"];
+            $where[]=['a.apply_name',"like","%$apply_name%"];
         }
-        $count = Db::name('purchease_diff')->alias('a')->where($where)->count();
+        $count = Db::name('purchease_diff')->alias('a')->join("good b","b.good_code=a.good_code","left")
+            ->where($where)->count();
         $total = ceil($count/$size);
         $page = $page >= $total ? $total : $page;
-        $list = Db::name('purchease_diff')//->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
-            ->where($where)->page($page,$size)->order("addtime desc")->select();
-//        $data=[];
-//        foreach ($list as $value){
-//            $value['can']= isset($value['good_catid']) && $value['good_catid'] !=0 ? made($value['good_catid']):[];
-//            $data[]=$value;
-//        }
-        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+        $list = Db::name('purchease_diff')->alias('a')->join("good b","b.good_code=a.good_code","left")
+            ->where($where)->page($page,$size)->order("a.addtime desc")->select();
+        $data=[];
+        foreach ($list as $value){
+            $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
     }
     public function diffinfo(){
         $id = isset($this->post['id']) && $this->post['id'] !=="" ? trim($this->post['id']) :"";
@@ -418,6 +419,12 @@ class Purch extends \app\BaseController
         if($idinf==false){
             return error_show(1002,"未找到采购工差单数据");
         }
+        $goon = Db::name('good')->where(['good_code'=>$idinf['good_code']])->find();
+        if(empty($goon)){
+            return error_show(1002,"未找到商品数据");
+        }
+        $int= isset($goon['cat_id']) && $goon['cat_id'] !=0 ? made($goon['cat_id']):[];
+        $idinf['can']=$int;
        return  app_show(0,"获取成功",$idinf);
 
     }

+ 30 - 2
app/admin/controller/Purchin.php

@@ -52,15 +52,43 @@ class Purchin extends BaseController
         if($good_name !=""){
             $where[]= ["b.good_name",'like',"%$good_name%"];
         }
+        $supplierNo=isset($this->post['supplierNo']) && $this->post['supplierNo']!==""? trim($this->post['supplierNo']):"";
+        if($supplierNo !=""){
+            $where[]= ["b.supplierNo",'like',"%$supplierNo%"];
+        }
+        $wsm_code=isset($this->post['wsm_code']) && $this->post['wsm_code']!==""? trim($this->post['wsm_code']):"";
+        if($wsm_code !=""){
+            $where[]= ["a.wsm_code",'=',$wsm_code];
+        }
+        $supplierNo =isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']):"";
+        if($supplierNo!=""){
+            $supplier = Db::name("supplier")->where(["code"=>$supplierNo])->find();
+            if(empty($supplier)){
+                return error_show(1004,"未找到供应商信息");
+            }
+            $wsmcode = Db::name("warehouse_info")->where([
+                "is_del"=>0,"supplierNo"=>$supplierNo])->column("wsm_code");
+            $where[]=['a.wsm_code',"in",$wsmcode];
+        }
         $count = Db::name('purchease_in')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
             ->where($where)->count();
         $total = ceil($count/$size);
         $page = $page >= $total ? $total : $page;
         $list = Db::name('purchease_in')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
             ->where($where)->page($page,$size)
-            ->field("a.apply_name,a.sendtime,b.order_type,a.status,a.cgdNo,a.wsm_in_code,b.good_name,b.send_num")
+            ->field("a.apply_name,a.sendtime,b.order_type,a.status,a.cgdNo,a.wsm_in_code,b.good_name,a.send_num,a.wsm_code,b.good_name,b.good_code,
+            a.post_company,a.post_code,a.post_fee,a.apply_id,a.wsm_num,a.error_num,a.wait_num,a.status,a.check_name,a.checkid")
             ->order("a.addtime desc")->select();
-        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+        $data=[];
+        foreach ($list as $value){
+            $wsmcode = Db::name("warehouse_info")->alias("k")->leftJoin("supplier c","k.supplierNo=c.code")
+                ->where(["k.wsm_code"=>$value['wsm_code']])->field("k.name as wsm_name,c.name,c.code")->find();
+            $value['wsm_name'] = $wsmcode['wsm_name'];
+            $value['wsm_supplier'] = $wsmcode['name'];
+            $value['wsm_supplierNo'] = $wsmcode['code'];
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
     }
     public function  add(){
         $cgdNo = isset($this->post['cgdNo']) && $this->post['cgdNo']!=""? trim($this->post['cgdNo']):"";

+ 1 - 0
app/admin/route/app.php

@@ -230,6 +230,7 @@ Route::rule('aftergys','admin/After/GysFeed');
 
 Route::rule('processolist','admin/Proorder/list');
 Route::rule('processowaitlist','admin/Proorder/waitlist');
+Route::rule('processoall','admin/Proorder/all');
 
 Route::rule('orderbacklist','admin/Orderback/list');
 Route::rule('orderbackinfo','admin/Orderback/info');