update
This commit is contained in:
parent
a53e8b6ddf
commit
fb70ca2209
@ -22,6 +22,19 @@ class VehicleController extends BaseApiController
|
|||||||
if(empty($params['num'])){
|
if(empty($params['num'])){
|
||||||
return $this->fail('缺少必要参数');
|
return $this->fail('缺少必要参数');
|
||||||
}
|
}
|
||||||
|
//获取该公司已签约的小组服务公司数量
|
||||||
|
$villageCompany = Contract::field('id')->where('party_a',$this->userInfo['company_id'])->where('signing_timer',2)->count();
|
||||||
|
//系统车辆数量
|
||||||
|
$rentCar = VehicleRent::field('id')->where('company_id',$this->userInfo['company_id'])->where('type',0)->count();
|
||||||
|
//申请中的车辆
|
||||||
|
$applyCar = VehicleContract::field('num')->where('company_b_id',$this->userInfo['company_id'])->where('status','in','-1,0,1,2')->sum('num');
|
||||||
|
//自有车辆数量
|
||||||
|
$selfCar = VehicleRent::field('id')->where('company_id',$this->userInfo['company_id'])->where('type',1)->count();
|
||||||
|
//可在租车辆
|
||||||
|
$doubleRentCar = $villageCompany - $rentCar - $applyCar - $selfCar;
|
||||||
|
if($params['num'] > $doubleRentCar ){
|
||||||
|
return $this->fail('数量超过可再租车辆数');
|
||||||
|
}
|
||||||
//查找乙方公司信息
|
//查找乙方公司信息
|
||||||
$party_b = Company::field('id,company_name,organization_code,master_name,master_phone,master_email,company_type')->where('id',$this->userInfo['company_id'])->find();
|
$party_b = Company::field('id,company_name,organization_code,master_name,master_phone,master_email,company_type')->where('id',$this->userInfo['company_id'])->find();
|
||||||
if(empty($party_b)) {
|
if(empty($party_b)) {
|
||||||
@ -302,7 +315,7 @@ class VehicleController extends BaseApiController
|
|||||||
//系统车辆数量
|
//系统车辆数量
|
||||||
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',0)->count();
|
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',0)->count();
|
||||||
//申请中的车辆
|
//申请中的车辆
|
||||||
$applyCar = VehicleContract::field('num')->where('company_b_id',$company['id'])->where('status','in','-1,0,1,2,')->sum('num');
|
$applyCar = VehicleContract::field('num')->where('company_b_id',$company['id'])->where('status','in','-1,0,1,2')->sum('num');
|
||||||
//自有车辆数量
|
//自有车辆数量
|
||||||
$selfCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',1)->count();
|
$selfCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',1)->count();
|
||||||
//可在租车辆
|
//可在租车辆
|
||||||
|
Loading…
x
Reference in New Issue
Block a user