wugg 2 years ago
parent
commit
9e1b787114
3 changed files with 55 additions and 27 deletions
  1. 29 11
      app/admin/controller/Consult.php
  2. 17 16
      app/admin/controller/Keepbrand.php
  3. 9 0
      app/admin/controller/Sale.php

+ 29 - 11
app/admin/controller/Consult.php

@@ -98,7 +98,9 @@ class Consult extends Base
 
         $all_createrid = array_column($list,'createrid');
         $item = get_company_name_by_uid($all_createrid);
-
+		 $userCommon = new \app\admin\common\User();
+		 $tmp = $userCommon->handle('getCodeAndName', ['code' =>array_column($list,"khNo")]);
+        $kh = $tmp['data']??[];
         $data=[];
         foreach ($list as $value){
             $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
@@ -107,8 +109,8 @@ class Consult extends Base
             $value['brand_name']= isset($brand['brand_name']) && $brand['brand_name']!='' ? $brand['brand_name']:"";
             $value['khname']="";
             if($value['khNo']!==""){
-                $kh=Db::name("customer_info")->where(['companyNo'=>$value['khNo']])->find();
-                $value['khname']= isset($kh['companyName'])?$kh['companyName']:"";
+//                $kh=Db::name("customer_info")->where(['companyNo'=>$value['khNo']])->find();
+                $value['khname']=$kh[$value['khNo']]??"";
             }
             $value['metal_name']=isset($value['metal_id'])&& $value['metal_id']!=0?$this->noble[$value['metal_id']]:"";
             $value['company_name'] = $item[$value['createrid']]??'';
@@ -364,11 +366,13 @@ class Consult extends Base
         $zxinfo['unit_name']="";
         $zxinfo['metal_name']=isset($zxinfo['metal_id'])&& $zxinfo['metal_id']!=0?$this->noble[$zxinfo['metal_id']]:"";
         $zxinfo['specinfo']=json_decode($zxinfo['specinfo'],true);
-
+		$zxinfo['khname']= '';
+		$kccode=[];
         if($zxorder['khNo']!==""){
-            $kh=Db::name("customer_info")->where(['companyNo'=>$zxorder['khNo']])->find();
-            $zxinfo['khname']= isset($kh['companyName'])?$kh['companyName']:"";
+//            $kh=Db::name("customer_info")->where(['companyNo'=>$zxorder['khNo']])->find();
+//            $zxinfo['khname']= isset($kh['companyName'])?$kh['companyName']:"";
             $zxinfo['khNo']= $zxorder['khNo'];
+            $kccode[]=$zxorder['khNo'];
         }
         if($zxinfo['unit']!==""){
             $unit=Db::name("unit")->where(['id'=>$zxinfo['unit']])->find();
@@ -378,14 +382,19 @@ class Consult extends Base
             $unit=Db::name("brand")->where(['id'=>$zxinfo['brand_id']])->find();
             $zxinfo['brand']= isset($unit['brand_name'])?$unit['brand_name']:"";
         }
+        $zxinfo['company']= '';
         if($zxorder['companyNo']!==""){
 //            $kh=Db::name("business")->where(['companyNo'=>$zxorder['companyNo']])->find();
 //            $zxinfo['company']= isset($kh['company'])?$kh['company']:"";
-
+            $kccode[]=$zxorder['companyNo'];
+        }
+        if(!empty($kccode)){
             $userCommon = new \app\admin\common\User();
-            $tmp = $userCommon->handle('getCodeAndName', ['code' => $zxorder['companyNo']]);
+            $tmp = $userCommon->handle('getCodeAndName', ['code' =>$kccode]);
             $zxinfo['company'] = $tmp['data'][$zxorder['companyNo']] ?? '';
+            $zxinfo['khname'] = $tmp['data'][$zxorder['khNo']] ?? '';
         }
+
         if($zxorder['is_project']==1 && $zxorder['projectNo']!==""){
             $project = Db::name("project")->where(["projectNo"=>$zxorder['projectNo'],"is_del"=>0])->find();
             $zxinfo['project_name']=isset($project['project_name'])?$project['project_name']:"";
@@ -847,9 +856,12 @@ class Consult extends Base
 //            ->field('id,person,personid')
 //            ->where('code',$supplierNo)
 //            ->findOrEmpty();
-	    $user= new \app\admin\common\User();
-        $supplier =$user->handle("sInfo",["code"=>$supplierNo]);
-
+	    $userCommon= new \app\admin\common\User();
+        $supplier_temp =$userCommon->handle("hqInfo",["code"=>$supplierNo]);
+        if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"供应商信息未找到");
+		$supplierArr=$supplier_temp['data']??[];
+		$supplier=$supplierArr['child']??[];
+		if($supplierArr['relation_code']==$zx['companyNo']) return error_show(1004,"业务公司与供应商信息一致");
         $data=[
             "bidNo"=>$bidNo,
             "infoNo"=>$infoNo,
@@ -1176,6 +1188,12 @@ class Consult extends Base
                     $mark_fee + $cert_fee + $nake_fee) / (1 - $budget);
             $total_fee = $demo_fee/$zxinfo['num']+$delivery_fee+$open_fee/$zxinfo['num'] + $cost_fee * $noble_weight + $pakge_fee + $mark_fee+$cert_fee +$nake_fee;
         }
+        $userCommon= new \app\admin\common\User();
+        $supplier_temp =$userCommon->handle("hqInfo",["code"=>$supplierNo]);
+        if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"供应商信息未找到");
+		$supplierArr=$supplier_temp['data']??[];
+		$supplier=$supplierArr['child']??[];
+		if($supplierArr['relation_code']==$zx['companyNo']) return error_show(1004,"业务公司与供应商信息一致");
         Db::startTrans();
         try{
             $data=[

+ 17 - 16
app/admin/controller/Keepbrand.php

@@ -61,14 +61,15 @@ class Keepbrand extends Base
                 "updatetime"=>date("Y-m-d H:i:s")
             ];
         if($long===1){
-            $starttime = isset($this->post['starttime']) && $this->post['starttime'] !=="" ?$this->post['starttime']:"";
-            if($starttime==""){
-                return error_show(1005,'参数starttime不能为空');
-            }
-            $endtime= isset($this->post['endtime']) && $this->post['endtime'] !=="" ?$this->post['endtime']:"";
-            if($endtime==""){
-                return error_show(1005,'修改时间不能为空');
-            }
+            $starttime = isset($this->post['starttime']) && $this->post['starttime'] !==""
+            ?$this->post['starttime']:null;
+//            if($starttime==""){
+//                return error_show(1005,'参数starttime不能为空');
+//            }
+            $endtime= isset($this->post['endtime']) && $this->post['endtime'] !=="" ?$this->post['endtime']:null;
+//            if($endtime==""){
+//                return error_show(1005,'修改时间不能为空');
+//            }
             $data['starttime']=$starttime;
             $data['endtime']=$endtime;
         }
@@ -210,14 +211,14 @@ class Keepbrand extends Base
             "updatetime"=>date("Y-m-d H:i:s")
         ];
         if($long===1){
-            $starttime = isset($this->post['starttime']) && $this->post['starttime'] !=="" ?$this->post['starttime']:"";
-            if($starttime==""){
-                return error_show(1005,'参数starttime不能为空');
-            }
-            $endtime= isset($this->post['endtime']) && $this->post['endtime'] !=="" ?$this->post['endtime']:"";
-            if($endtime==""){
-                return error_show(1005,'修改时间不能为空');
-            }
+            $starttime = isset($this->post['starttime']) && $this->post['starttime'] !=="" ?$this->post['starttime']:null;
+//            if($starttime==""){
+//                return error_show(1005,'参数starttime不能为空');
+//            }
+            $endtime= isset($this->post['endtime']) && $this->post['endtime'] !=="" ?$this->post['endtime']:null;
+//            if($endtime==""){
+//                return error_show(1005,'修改时间不能为空');
+//            }
             $data['starttime']=$starttime;
             $data['endtime']=$endtime;
         }

+ 9 - 0
app/admin/controller/Sale.php

@@ -1683,6 +1683,15 @@ class Sale extends Base
             if ($sa == false) {
                 return false;
             }
+
+
+            $goodinfo['status'] = 5;
+            $goodinfo['updatetime'] = date("Y-m-d H:i:s");
+            $saa = Db::name("consult_info")->where(["infoNo"=>$goodinfo['infoNo']])->update(["status"=>5,
+            "updatetime"=>date("Y-m-d H:i:s")]);
+            if ($saa == false) {
+                return false;
+            }
             //修改状态,添加待办
             ActionLog::logAdd($this->post['token'], [
                 "order_code" => $goodinfo['bidNo'],//项目编码