Browse Source

啦啦啦

wufeng 2 years ago
parent
commit
3538d7f6f4

+ 12 - 0
app/admin/controller/Activity.php

@@ -76,8 +76,13 @@ class Activity extends Base
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["ga.createrid", 'in', get_company_item_user_by_name($company_name)];
 
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
+        if($relaComNo!="") $where[]=['ga.company_id','=', $relaComNo];
+
         $count = Db::name('good_activity')
             ->alias('ga')
+            ->leftJoin("depart_user u", "u.uid=ga.createrid AND u.is_del=0")
+            ->leftJoin("platform p", "p.id=ga.platform_code")
             ->where($where)
             ->count();
         $total = ceil($count / $size);
@@ -130,6 +135,10 @@ class Activity extends Base
         if($platform_code!=""){
             $where[]=['b.platform_code',"=",$platform_code];
         }
+
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
+        if($relaComNo!="") $where[]=['b.company_id','=', $relaComNo];
+
         $count = Db::name('activity_info')->alias("a")
             ->join("good_activity b","b.activity_code=a.activity_code","left")
             ->join("platform c","c.id=b.platform_code","left")
@@ -167,6 +176,9 @@ class Activity extends Base
         $end = isset($this->post['end']) && $this->post['end'] !== "" ? trim($this->post['end']) : "";
         if ($end != "") $where[] = ['a.addtime', "<=", $end.' 23:59:59'];
 
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
+        if($relaComNo!="") $where[]=['a.supplierNo|a.companyNo','=', $relaComNo];
+
         $count = Db::name('good_zixun')
             ->alias("a")
             ->join("supplier b","b.code=a.supplierNo","left")

+ 3 - 0
app/admin/controller/Allot.php

@@ -95,6 +95,9 @@ class Allot extends Base
 			$where[] = ['a.apply_id', 'in',$arr];
         }
 
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
+        if($relaComNo!="") $where[]=['a.in_companyNo|a.out_companyNo','=', $relaComNo];
+
         $count = Db::name('allot_stock')
             ->alias('a')
             ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")

+ 90 - 86
app/admin/controller/Check.php

@@ -168,100 +168,104 @@ public function __construct(App $app)
 
         return app_show(0, "获取成功", ["list" => $data, "count" => $count]);
     }
-public function list()
-{
-    $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 = [['a.is_del',"=",0],['b.is_del',"=",0]];
-    $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
-    if ($start !="") {
-      //  $where["a.addtime"]=Db::raw(">= '{$start}'");
-        $where[]=['a.addtime',">=",$start];
-    }
-    $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
-    if($end !=""){
-      //  $where["a.addtime"] = Db::raw("<= '{$end}'");
-        $where[]=['a.addtime',"<=",$end];
-    }
-    $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? trim($this->post['check_code']) : "";
-    if ($check_code !== "") {
-       // $where['a.check_code'] = Db::raw("like '%$check_code%'");
-        $where[]=['a.check_code',"like","%$check_code%"];
-    }
-    $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
-    if ($wsm_code  !== "") {
-      //  $where['a.wsm_code'] =  Db::raw("like '%$wsm_code%'");
-        $where[]=['a.wsm_code',"like","%$wsm_code%"];
-    }
-    $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name']) : "";
-    if ($apply_name !== "") {
-     //   $where['a.apply_name'] = $apply_name;
-        $where[]=['a.apply_name',"like","%$apply_name%"];
-    }
-    $type = isset($this->post['type']) && $this->post['type'] !== "" ? trim($this->post['type']) : "";
-    if ($type !== "") {
-       // $where['a.type'] = $type;
-        $where[]=['a.type',"=",$type];
-    }
-    $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !== "" ? intval($this->post['apply_id']) : "";
-    if ($apply_id!== "") {
-       // $where['a.apply_id'] = $apply_id;
-        $where[]=['a.apply_id',"=",$apply_id];
-    }
-    $status= isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
-    if ($status !== "") {
-       // $where['a.status '] = $status;
-        $where[]=['a.status',"=",$status];
-    }
-    $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
-    if ($companyNo !== "") {
-        $condition[]=["a.companyNo ","=",$companyNo ];
-    }
+
+    public function list()
+    {
+        $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 = [['a.is_del', "=", 0], ['b.is_del', "=", 0]];
+        $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
+        if ($start != "") {
+            //  $where["a.addtime"]=Db::raw(">= '{$start}'");
+            $where[] = ['a.addtime', ">=", $start];
+        }
+        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
+        if ($end != "") {
+            //  $where["a.addtime"] = Db::raw("<= '{$end}'");
+            $where[] = ['a.addtime', "<=", $end];
+        }
+        $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? trim($this->post['check_code']) : "";
+        if ($check_code !== "") {
+            // $where['a.check_code'] = Db::raw("like '%$check_code%'");
+            $where[] = ['a.check_code', "like", "%$check_code%"];
+        }
+        $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
+        if ($wsm_code !== "") {
+            //  $where['a.wsm_code'] =  Db::raw("like '%$wsm_code%'");
+            $where[] = ['a.wsm_code', "like", "%$wsm_code%"];
+        }
+        $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name']) : "";
+        if ($apply_name !== "") {
+            //   $where['a.apply_name'] = $apply_name;
+            $where[] = ['a.apply_name', "like", "%$apply_name%"];
+        }
+        $type = isset($this->post['type']) && $this->post['type'] !== "" ? trim($this->post['type']) : "";
+        if ($type !== "") {
+            // $where['a.type'] = $type;
+            $where[] = ['a.type', "=", $type];
+        }
+        $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !== "" ? intval($this->post['apply_id']) : "";
+        if ($apply_id !== "") {
+            // $where['a.apply_id'] = $apply_id;
+            $where[] = ['a.apply_id', "=", $apply_id];
+        }
+        $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
+        if ($status !== "") {
+            // $where['a.status '] = $status;
+            $where[] = ['a.status', "=", $status];
+        }
+        $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
+        if ($companyNo !== "") {
+            $condition[] = ["a.companyNo ", "=", $companyNo];
+        }
 
 //    $role = $this->checkDataShare();
 //    if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['a.apply_id', 'in', $role[DataGroupModel::$type_全部]];
         $role = $this->checkDataShare();
-        $hand = resign_hand_user($this->uid,0);
+        $hand = resign_hand_user($this->uid, 0);
         if (!empty($role[DataGroupModel::$type_全部])) {
-        	$arr= array_unique(array_merge($hand,$role[DataGroupModel::$type_全部]));
-			$where[] = ['a.apply_id', 'in',$arr];
+            $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
+            $where[] = ['a.apply_id', 'in', $arr];
         }
 
-    $count = Db::name('good_check')
-        ->alias('a')
-        ->join("warehouse_info b","a.wsm_code = b.wsm_code","left")
-        ->join("supplier v","v.code=b.supplierNo","left")
-        ->where($where)
-        ->count();
-    $total = ceil($count / $size);
-    $page = $page <= $total ? $page : $total;
-    $list = Db::name('good_check')
-        ->alias('a')
-        ->join("warehouse_info b","a.wsm_code = b.wsm_code","left")
-        ->join("supplier v","v.code=b.supplierNo","left")
-        ->field("a.status,a.apply_id,a.apply_name,a.type,a.addtime,a.wsm_code,a.check_code,b.name,a.id,v.name as 'caname',v.code")
-        ->where($where)
-        ->page($page,$size)
-        ->order("a.id desc")
-        ->select()
-        ->toArray();
-    $data=[];
-    foreach ($list as $key=>$value){
-        $value['rename'] ='';
-        if($value['apply_id']!=0){
-            $depart = Db::name("depart_user")->alias("a")->leftJoin("company_item b","a.itemid = b.id")->where(['a.uid'=>$value['apply_id'],'a.is_del'=>0])
-                ->column('b.name');
-           // var_dump(Db::name("depart_user")->getLastSql());
-            $value['rename'] =implode(",",$depart);
-        }
-        //是否具有编辑权限
-        $value['is_allow_update'] = 0;
-        if (in_array($this->roleid, [1, 33]) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
-        $data[] = $value;
-    }
-    return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
+        if($relaComNo!="") $where[]=['a.companyNo','=', $relaComNo];
 
-	    }
+        $count = Db::name('good_check')
+            ->alias('a')
+            ->join("warehouse_info b", "a.wsm_code = b.wsm_code", "left")
+            ->join("supplier v", "v.code=b.supplierNo", "left")
+            ->where($where)
+            ->count();
+        $total = ceil($count / $size);
+        $page = $page <= $total ? $page : $total;
+        $list = Db::name('good_check')
+            ->alias('a')
+            ->join("warehouse_info b", "a.wsm_code = b.wsm_code", "left")
+            ->join("supplier v", "v.code=b.supplierNo", "left")
+            ->field("a.status,a.apply_id,a.apply_name,a.type,a.addtime,a.wsm_code,a.check_code,b.name,a.id,v.name as 'caname',v.code")
+            ->where($where)
+            ->page($page, $size)
+            ->order("a.id desc")
+            ->select()
+            ->toArray();
+        $data = [];
+        foreach ($list as $key => $value) {
+            $value['rename'] = '';
+            if ($value['apply_id'] != 0) {
+                $depart = Db::name("depart_user")->alias("a")->leftJoin("company_item b", "a.itemid = b.id")->where(['a.uid' => $value['apply_id'], 'a.is_del' => 0])
+                    ->column('b.name');
+                // var_dump(Db::name("depart_user")->getLastSql());
+                $value['rename'] = implode(",", $depart);
+            }
+            //是否具有编辑权限
+            $value['is_allow_update'] = 0;
+            if (in_array($this->roleid, [1, 33]) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
+            $data[] = $value;
+        }
+        return app_show(0, "获取成功", ['count' => $count, 'list' => $data]);
+
+    }
 	public function goodlist(){
 	    $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";

+ 5 - 0
app/admin/controller/Good.php

@@ -121,6 +121,9 @@ class Good extends Base
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["b.createrid", 'in', get_company_item_user_by_name($company_name)];
 
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] != "" ? trim($this->post['relaComNo']) : "";
+        if ($relaComNo != "") $where[] = ['a.companyNo|a.supplierNo', '=', $relaComNo];
+
 //        if(!empty($role['platform']) ){
 //            $where[]=["b.platform_code","in",$role['platform']];
 //        }
@@ -1157,6 +1160,7 @@ class Good extends Base
             'page' => 1,
             'size' => 15,
             'company_name'=>'',
+            'relaComNo'=>'',
         ], 'post', 'trim');
 
         $where = [["gl.is_del", "=", 0], ['gp.exam_status', '=', 6]];//exam_status==6已上线
@@ -1177,6 +1181,7 @@ class Good extends Base
         if (!empty($param['platform_code'])) $where[] = ['gp.platform_code', 'like', '%' . $param['platform_code'], '%'];
         if (!empty($param['company_name'])) $where[] = ['gb.createrid', 'in', get_company_item_user_by_name($param['company_name'])];
 //        if (!empty($param['supplierNo'])) $where[] = ['supplierNo', 'like', '%'.$param['supplierNo'],'%'];
+        if ($param['relaComNo'] != '') $where[] = ['gb.companyNo|gb.supplierNo', '=', $param['relaComNo']];
 
         //5.获取结果
         $count = Db::name('good_ladder')

+ 1 - 2
app/admin/controller/GoodOfflineLog.php

@@ -13,8 +13,7 @@ class GoodOfflineLog extends Base
     public function getList()
     {
 
-        $param = $this->request->only(['start_date' => '', "spuCode"=>'',"good_name"=>'','end_date' => '', 'creater' => '',
-         'page' => 1,'size' => 15], 'post', 'trim');
+        $param = $this->request->only(['start_date' => '', "spuCode"=>'',"good_name"=>'','end_date' => '', 'creater' => '', 'page' => 1,'size' => 15], 'post', 'trim');
 
         $where = [];
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['addtime', 'between', [$param['start_date'], $param['end_date']]];

+ 3 - 0
app/admin/controller/Goodup.php

@@ -148,6 +148,9 @@ class Goodup extends Base
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["gb.createrid", 'in', get_company_item_user_by_name($company_name)];
 
+        $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
+        if($relaComNo!="") $where[]=['gb.companyNo|gb.supplierNo','=', $relaComNo];
+
         $count = Db::name('good_basic')
             ->alias('gb')
             ->where($where)

+ 2 - 1
app/admin/controller/OrderImport.php

@@ -86,7 +86,8 @@ class OrderImport extends Base
             'orderCode' => '',
             'page' => 1,
             'size' => 15,
-            'company_name' => ''
+            'company_name' => '',
+            'relaComNo' => '',
         ], 'post', 'trim');
 
         $where = [['c.is_del', '=', OIFCModel::$is_del_normal]];

+ 9 - 8
app/admin/controller/Report.php

@@ -233,9 +233,10 @@ class Report extends Base
             ->alias('a')
             ->field('DATE_FORMAT(a.addtime,"%Y-%m-%d") addtime,cii.name,count(a.id) total')
             ->leftJoin('consult_order b', 'b.zxNo=a.zxNo')
-            ->leftJoin('company_item cii', 'cii.id=b.depart')
+            ->leftJoin('depart_user c', 'c.uid=b.saleid AND c.is_del=0')
+            ->leftJoin('company_item cii', 'cii.id=c.itemid')
             ->where($where)
-            ->group('addtime,b.depart')
+            ->group('addtime,cii.id')
             ->order('addtime')
             ->count();
 
@@ -243,9 +244,10 @@ class Report extends Base
             ->alias('a')
             ->field('DATE_FORMAT(a.addtime,"%Y-%m-%d") addtime,cii.name,count(a.id) total')
             ->leftJoin('consult_order b', 'b.zxNo=a.zxNo')
-            ->leftJoin('company_item cii', 'cii.id=b.depart')
+            ->leftJoin('depart_user c', 'c.uid=b.saleid AND c.is_del=0')
+            ->leftJoin('company_item cii', 'cii.id=c.itemid')
             ->where($where)
-            ->group('addtime,b.depart')
+            ->group('addtime,cii.id')
             ->order('addtime', 'desc')
             ->page($param['page'], $param['size'])
             ->select()
@@ -835,7 +837,7 @@ class Report extends Base
 
         if (!$val_params->check($param)) return error_show(1004, $val_params->getError());
 
-        $where = [['po.is_del', '=', 0],["po.order_type","<>",1]];
+        $where = [['po.is_del', '=', 0], ["po.order_type", "<>", 1]];
 
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['po.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
         if ($param['status'] != '') $where[] = ['po.status', '=', $param['status']];
@@ -1215,7 +1217,7 @@ class Report extends Base
             ->leftJoin('purchease_order po', 'po.cgdNo=on.cgdNo')
             ->leftJoin('good_basic gb', 'gb.spuCode=s.good_code AND gb.is_del=0')
             ->leftJoin('result_info ri', 'ri.result_code=s.error_code AND ri.is_del=0')
-            ->leftJoin('supplier sp','sp.code=gb.supplierNo')
+            ->leftJoin('supplier sp', 'sp.code=gb.supplierNo')
             ->count('s.id');
 
         $list = Db::name('sale_return')
@@ -1227,7 +1229,7 @@ class Report extends Base
             ->leftJoin('purchease_order po', 'po.cgdNo=on.cgdNo')
             ->leftJoin('good_basic gb', 'gb.spuCode=s.good_code AND gb.is_del=0')
             ->leftJoin('result_info ri', 'ri.result_code=s.error_code AND ri.is_del=0')
-            ->leftJoin('supplier sp','sp.code=gb.supplierNo')
+            ->leftJoin('supplier sp', 'sp.code=gb.supplierNo')
             ->page($param['page'], $param['size'])
             ->order('s.addtime desc')
             ->cursor();
@@ -2277,6 +2279,5 @@ class Report extends Base
 
     }
 
-   
 
 }

+ 1 - 0
app/admin/controller/User.php

@@ -62,6 +62,7 @@ class User extends Base
     public function list(){
         $param = $this->request->only(['nickname' => '', 'username' => '', 'status' => '', 'page' => 1, 'size' => 10, 'uid' => '', 'nuid' => '','companyNo'=>''], 'post', 'trim');
 
+        $param['level'] = 1;//只筛选超管用户
         $userCommon = new CommonUser();
         $rs = $userCommon->GetUserlist($param);
 

+ 17 - 21
app/admin/controller/UserCompany.php

@@ -25,15 +25,12 @@ class UserCompany extends Base
 
                 $tmp = Db::name('user_role')
                     ->alias('a')
-                    ->field('b.role_name,b.level,c.name item_name')
+                    ->field('b.role_name')
                     ->leftJoin('role b', 'b.id=a.roleid')
-                    ->leftJoin('company_item c', 'c.id=a.itemid and c.companyNo=a.companyNo')
-                    ->where(['a.uid' => $item['account_id'], 'is_del' => 0, 'a.companyNo' => $item['companyCode']])
+                    ->where(['a.uid' => $item['account_id'], 'a.is_del' => 0, 'a.companyNo' => $item['companyCode']])
                     ->findOrEmpty();
 
                 $item['role_name'] = $tmp['role_name'] ?? '';
-                $item['level'] = $tmp['level'] ?? '';
-                $item['item_name'] = $tmp['item_name'] ?? '';
             }
         }
 
@@ -54,19 +51,19 @@ class UserCompany extends Base
 
         if (!$val->check($param)) return json_show(1004, $val->getError());
 
-        $role = Db::name('role')
-            ->field('id')
-            ->where('id', $param['roleid'])
-            ->where('level', '<>', 1)
-            ->findOrEmpty();
-
-        if (empty($role)) return json_show(1004, '角色不存在或等级不符合要求');
+//        $role = Db::name('role')
+//            ->field('id')
+//            ->where('id', $param['roleid'])
+//            ->where('level', '<>', 1)
+//            ->findOrEmpty();
+//
+//        if (empty($role)) return json_show(1004, '角色不存在或等级不符合要求');
 
-        $item = Db::name('company_item')
-            ->field('id')
-            ->where(['id' => $param['itemid'], 'companyNo' => $param['companyNo']])
-            ->findOrEmpty();
-        if (empty($item)) return json_show(1004, '该公司部门不存在');
+//        $item = Db::name('company_item')
+//            ->field('id')
+//            ->where(['id' => $param['itemid'], 'companyNo' => $param['companyNo']])
+//            ->findOrEmpty();
+//        if (empty($item)) return json_show(1004, '该公司部门不存在');
 
 //        $tmp = Db::name('user_role')
 //            ->field('id')
@@ -128,15 +125,14 @@ class UserCompany extends Base
 
             $tmp = Db::name('user_role')
                 ->alias('a')
-                ->field('b.role_name,b.level,c.name item_name')
+                ->field('b.role_name')
                 ->leftJoin('role b', 'b.id=a.roleid')
-                ->leftJoin('company_item c', 'c.id=a.itemid and c.companyNo=a.companyNo')
+//                ->leftJoin('company_item c', 'c.id=a.itemid and c.companyNo=a.companyNo')
                 ->where(['a.uid' => $rs['data']['account_id'], 'is_del' => 0, 'a.companyNo' => $rs['data']['companyCode']])
                 ->findOrEmpty();
 
             $rs['data']['role_name'] = $tmp['role_name'] ?? '';
-            $rs['data']['level'] = $tmp['level'] ?? '';
-            $rs['data']['item_name'] = $tmp['item_name'] ?? '';
+//            $rs['data']['item_name'] = $tmp['item_name'] ?? '';
         }
         return json_show($rs['code'], $rs['message'], $rs['data']);
     }