wugg 2 years ago
parent
commit
287b3071a5
3 changed files with 26 additions and 17 deletions
  1. 26 1
      app/admin/controller/Payment.php
  2. 0 2
      app/admin/middleware/checkRela.php
  3. 0 14
      app/common.php

+ 26 - 1
app/admin/controller/Payment.php

@@ -1013,7 +1013,10 @@ class Payment extends BaseController
         if($payinfo==false){
               return error_show(1004,"对账单数据未找到");
         }
-
+		$result=$this->checkSupplier($payinfo['supplierNo']);
+        if($result['code']!=0){
+        	 return error_show($result['code'],$result['message']);
+        }
         if($payinfo['status']!=2){
             return error_show(1004,"对账单数据未完成审核");
         }
@@ -1610,6 +1613,10 @@ class Payment extends BaseController
 		if($valide->check($param)==false)return error_show(1004,$valide->getError());
 		$hpinfo  =Db::name("pay_invoice")->where([["hpNo","=",$param['hpNo']],["is_del","=",0]])->findOrEmpty();
 		if(empty($hpinfo)) return error_show(1004,"回票信息未找到");
+		$result=$this->checkSupplier($hpinfo['supplierNo']);
+        if($result['code']!=0){
+        	 return error_show($result['code'],$result['message']);
+        }
 		if($hpinfo['status']!=4)return error_show(1004,"回票信息流程未完成");
 		$isR=Db::name("pay_return")->where(["orderCode"=>$param['hpNo'],"status"=>[1,2],"is_del"=>0])->findOrEmpty();
 		if(!empty($isR))return error_show(1004,"回票信息退票流程已存在");
@@ -1753,6 +1760,10 @@ class Payment extends BaseController
 		if($valide->check($param)==false)return error_show(1004,$valide->getError());
 		$hpinfo  =Db::name("pay_payment")->where([["dzNo","=",$param['dzNo']],["is_del","=",0]])->findOrEmpty();
 		if(empty($hpinfo)) return error_show(1004,"付款信息未找到");
+		$result=$this->checkSupplier($hpinfo['supplierNo']);
+        if($result['code']!=0){
+        	 return error_show($result['code'],$result['message']);
+        }
 		if(!in_array($hpinfo['status'],[3,4]))return error_show(1004,"付款信息流程未完成");
 		$isR=Db::name("pay_return")->where(["orderCode"=>$param['dzNo'],"status"=>[1,2],"is_del"=>0])->findOrEmpty();
 		if(!empty($isR))return error_show(1004,"付款信息退款流程已存在");
@@ -2007,4 +2018,18 @@ class Payment extends BaseController
 		excelExport("{$param['payNo']}对账采购单详情",array_keys($cgdlist[0]),$cgdlist);
 	}
 
+	/**校验供应商下面是否有操作账户
+	* @param $supplierNo 供应商账户
+	 * @return array
+	 */
+	private function checkSupplier($supplierNo){
+		        $companyinfo = UserHandle("/userCompanyBasicList", ["companyNo" =>$supplierNo]);
+                if ($companyinfo['code'] != 0) return ["code"=>$companyinfo['code'],"message"=> $companyinfo['message']];
+                if (!empty($companyinfo['data']) && $companyinfo['data']['count'] > 0) {
+                    return ["code"=>1004,"message"=> "供应商公司存在操作账户,请用供应商账户操作"];
+                }
+                else{
+                	  return ["code"=>0,"message"=> "业务账户可操作"];
+                }
+	}
 }

+ 0 - 2
app/admin/middleware/checkRela.php

@@ -30,8 +30,6 @@ class checkRela
                 if ($relaComNo == '') return error_show(1004, "关联公司不能为空");
                 $companyinfo = UserHandle("/hqInfo", ["code" => $relaComNo]);
                 if ($companyinfo['code'] != 0) return error_show($companyinfo['code'], $companyinfo['message']);
-
-
                 if (!empty($companyinfo['data']) && $companyinfo['data']['relation_code'] != "") {
                     return error_show(1004, "业务公司存在供应商账户,请用供应商账户操作");
                 }

+ 0 - 14
app/common.php

@@ -122,20 +122,6 @@ function GetUserlist($condition){
     return json_decode($response,true);
 }
 
-///**
-// * @param $token
-// * @param $condition
-// * @return mixed
-// */
-//function GetAccountall($token, $condition){
-//    $host = Config::get("app");
-//
-//    $url = $host["api_host"]."/Api/userall";
-//    $condition['token']=$token;
-//    $response=curl_request($url,$condition);
-//
-//    return json_decode($response,true);
-//}
 
 function GetList($condition){
     $host = Config::get("app");