...
|
...
|
@@ -447,24 +447,14 @@ class CommonController extends RestBaseController |
|
|
$field = 'id c_id,company_name,pid';
|
|
|
$res = $this->getCompany($where,$field);
|
|
|
if($res){
|
|
|
if($res['pid'] != 0){
|
|
|
//甲方企业
|
|
|
//获取该项目的巡检点
|
|
|
$where = ['p_id'=>$project_id];
|
|
|
//日检
|
|
|
$field = 'id,point_name';
|
|
|
$arr = $this->getPoint($where,$field);
|
|
|
$party = 0;
|
|
|
}else{
|
|
|
//乙方企业
|
|
|
$where = ['p_id'=>$project_id];
|
|
|
//日检
|
|
|
$field = 'id,point_name';
|
|
|
$arr = $this->getPoint($where,$field);
|
|
|
$party = 1;
|
|
|
}
|
|
|
//获取今天的巡检信息(共同合作完成)
|
|
|
$where = ['project_id'=>$project_id,'party'=>$party];
|
|
|
|
|
|
$where = ['p_id'=>$project_id];
|
|
|
//日检
|
|
|
$field = 'id,point_name';
|
|
|
$arr = $this->getPoint($where,$field);
|
|
|
|
|
|
//获取今天的巡检信息(甲方巡检,乙方查看;乙方巡检,甲方查看)
|
|
|
$where = ['project_id'=>$project_id];
|
|
|
//日检
|
|
|
$field = 'status,point_id';
|
|
|
$todayIns = $this->getTodayIns($where,$field);
|
...
|
...
|
@@ -488,6 +478,16 @@ class CommonController extends RestBaseController |
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
//查看是否有巡检
|
|
|
public function getInspection($where){
|
|
|
$res = Db::name('inspect')
|
|
|
->where($where)
|
|
|
->whereTime('create_time','today')
|
|
|
->field('id,party')
|
|
|
->find();
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
//获取今天的巡检信息
|
|
|
public function getTodayIns($where,$field){
|
|
|
$res = Db::name('inspect')
|
...
|
...
|
@@ -954,11 +954,11 @@ class CommonController extends RestBaseController |
|
|
}
|
|
|
|
|
|
//获取甲乙方领导巡检列表
|
|
|
public function getInspectReportList($table,$party,$pids,$data){
|
|
|
public function getInspectReportList($table,$pids,$data){
|
|
|
$limit = config('site.limit');
|
|
|
$res = Db::name($table)
|
|
|
->alias('i')
|
|
|
->join('project p','i.project_id = p.id','LEFT')
|
|
|
->where(['i.party'=>$party])
|
|
|
->whereIn('i.project_id',$pids)
|
|
|
->where(function ($query) use ($data) {
|
|
|
//项目id
|
...
|
...
|
@@ -979,7 +979,8 @@ class CommonController extends RestBaseController |
|
|
$query->where('i.create_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
|
|
->field('i.id,i.create_time,i.project_id,p.name project_name')
|
|
|
->page($data['page'],$limit)
|
|
|
->field('i.id,i.party,i.create_time,i.project_id,p.name project_name')
|
|
|
->group("i.project_id,DATE_FORMAT(FROM_UNIXTIME(i.create_time),'%Y-%m-%d')")
|
|
|
->order('i.id desc')
|
|
|
->select()
|
...
|
...
|
@@ -988,11 +989,10 @@ class CommonController extends RestBaseController |
|
|
}
|
|
|
|
|
|
//获取甲乙方巡检列表总页数
|
|
|
public function getInspectReportCount($table,$party,$pids,$data){
|
|
|
public function getInspectReportCount($table,$pids,$data){
|
|
|
$count = Db::name($table)
|
|
|
->alias('i')
|
|
|
->join('project p','i.project_id = p.id','LEFT')
|
|
|
->where(['i.party'=>$party])
|
|
|
->whereIn('i.project_id',$pids)
|
|
|
->where(function ($query) use ($data) {
|
|
|
//项目id
|
...
|
...
|
@@ -1021,6 +1021,7 @@ class CommonController extends RestBaseController |
|
|
|
|
|
//获取乙方领导年检检测列表
|
|
|
public function getTestReportList($table,$pids,$data){
|
|
|
$limit = config('site.limit');
|
|
|
$res = Db::name($table)
|
|
|
->alias('t')
|
|
|
->join('project p','t.project_id = p.id','LEFT')
|
...
|
...
|
@@ -1044,6 +1045,7 @@ class CommonController extends RestBaseController |
|
|
$query->where('t.test_time', '<=', $endTime);
|
|
|
}
|
|
|
})
|
|
|
->page($data['page'],$limit)
|
|
|
->field('t.id,t.test_time,t.project_id,p.name project_name')
|
|
|
->order('t.id desc')
|
|
|
->select()
|
...
|
...
|
@@ -1184,7 +1186,6 @@ class CommonController extends RestBaseController |
|
|
if($user['identity'] == config('site.a_leader')){
|
|
|
//甲方领导
|
|
|
$pIds = $this->getProjectIds($user['company_id']);
|
|
|
|
|
|
}else if($user['identity'] == config('site.a_leaders')){
|
|
|
//甲方总领导
|
|
|
$pIds = $this->getProjectIds($company_id);
|
...
|
...
|
@@ -1979,11 +1980,12 @@ class CommonController extends RestBaseController |
|
|
}
|
|
|
|
|
|
if($flag == 'inspect'){
|
|
|
//日检人员(乙方项目组)
|
|
|
//日检人员
|
|
|
if($res['party'] == 0){
|
|
|
//甲方
|
|
|
//甲方项目组
|
|
|
$arr['inspect_name'] = $this->getUserByProject($res['project_id'],'id,a_sid');
|
|
|
}else{
|
|
|
//乙方项目组
|
|
|
$arr['inspect_name'] = $this->getUserByProjectId($res['project_id'],'id,b_sid',1);
|
|
|
}
|
|
|
}else{
|
...
|
...
|
|