diff --git a/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php index 4393f9a3c..980757fd9 100644 --- a/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php +++ b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php @@ -16,9 +16,12 @@ namespace app\adminapi\lists\supervision_work; use app\adminapi\lists\BaseAdminDataLists; +use app\common\model\supervision_work\SupervisionMaterialEntry; use app\common\model\supervision_work\SupervisionMaterialEntryDetail; +use app\common\model\supervision_work\SupervisionMaterialParallelTesting; use app\common\model\supervision_work\SupervisionMaterialParallelTestingDetail; use app\common\lists\ListsSearchInterface; +use app\common\model\supervision_work\SupervisionProblem; /** @@ -60,12 +63,18 @@ class SupervisionMaterialParallelTestingDetailLists extends BaseAdminDataLists i ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ - $material_entry_detail = SupervisionMaterialEntryDetail::field('name,brand,model,contract_brand,entry_number')->where('id',$data['material_entry_detail_id'])->findOrEmpty(); + $material_parallel_testing = SupervisionMaterialParallelTesting::field('inspection_date')->where('id',$data['material_parallel_testing_id'])->findOrEmpty(); + $material_entry_detail = SupervisionMaterialEntryDetail::field('material_entry_id,name,brand,model,contract_brand,entry_number')->where('id',$data['material_entry_detail_id'])->findOrEmpty(); + $material_entry = SupervisionMaterialEntry::field('enter_time')->where('id',$material_entry_detail['material_entry_id'])->findOrEmpty(); $data['name'] = $material_entry_detail['name']; $data['brand'] = $material_entry_detail['brand']; $data['model'] = $material_entry_detail['model']; - $data['contract_brand'] = $material_entry_detail->contract_brand_text; + $data['contract_brand_text'] = $material_entry_detail->contract_brand_text; $data['entry_number'] = $material_entry_detail['entry_number']; + $data['enter_time'] = $material_entry['enter_time']; + $data['inspection_date'] = $material_parallel_testing['inspection_date']; + $data['problem_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',7)->count(); + $data['reply_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',7)->where('is_rectification',1)->count(); }) ->toArray(); } diff --git a/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php index 4b2e716c7..208f5b083 100644 --- a/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php +++ b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php @@ -19,11 +19,8 @@ use app\adminapi\lists\BaseAdminDataLists; use app\common\model\supervision_project\SupervisionParticipatingUnits; use app\common\model\supervision_project\SupervisionProject; use app\common\model\supervision_work\SupervisionMaterialEntry; -use app\common\model\supervision_work\SupervisionMaterialEntryDetail; use app\common\model\supervision_work\SupervisionMaterialParallelTesting; use app\common\lists\ListsSearchInterface; -use app\common\model\supervision_work\SupervisionMaterialParallelTestingDetail; -use app\common\model\supervision_work\SupervisionProblem; /** @@ -43,7 +40,10 @@ class SupervisionMaterialParallelTestingLists extends BaseAdminDataLists impleme */ public function setSearch(): array { - return []; + return [ + '=' => ['project_id', 'material_entry_id'], + '%like%' => ['code', 'inspector'], + ]; } @@ -58,41 +58,18 @@ class SupervisionMaterialParallelTestingLists extends BaseAdminDataLists impleme */ public function lists(): array { - $params = $this->request->get(); - $where = []; - if(isset($params['code']) && $params['code'] != ''){ - $witness_sampling_ids1 = SupervisionMaterialParallelTesting::where('code','like','%'.$params['code'].'%')->column('id'); - $where[] = ['material_parallel_testing_id','in',$witness_sampling_ids1]; - } - if(isset($params['project_id']) && $params['project_id'] != ''){ - $witness_sampling_ids2 = SupervisionMaterialParallelTesting::where('project_id','=',$params['project_id'])->column('id'); - $where[] = ['material_parallel_testing_id','in',$witness_sampling_ids2]; - } - if(isset($params['name']) && $params['name'] != ''){ - $material_entry_detail_ids = SupervisionMaterialEntryDetail::where('name','like','%'.$params['name'].'%')->column('id'); - $where[] = ['material_entry_detail_id','in',$material_entry_detail_ids]; - } - return SupervisionMaterialParallelTestingDetail::withoutField('check_code,check_time,check_user,check_remark,check_annex,update_time,delete_time')->where($where) + return SupervisionMaterialParallelTesting::withoutField('create_user,create_time,update_time,delete_time')->where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ - $material_parallel_testing = SupervisionMaterialParallelTesting::field('project_id,material_entry_id,code,inspector,inspection_date')->where('id',$data['material_parallel_testing_id'])->findOrEmpty(); - $project = SupervisionProject::field('project_name')->where('id',$material_parallel_testing['project_id'])->findOrEmpty(); - $material_entry = SupervisionMaterialEntry::field('company_id')->where('id',$material_parallel_testing['material_entry_id'])->findOrEmpty(); + $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); + $material_entry = SupervisionMaterialEntry::field('code,theme,company_id,enter_time')->where('id',$data['material_entry_id'])->findOrEmpty(); $company = SupervisionParticipatingUnits::field('unit_name')->where('id',$material_entry['company_id'])->findOrEmpty(); - $material_entry_detail = SupervisionMaterialEntryDetail::field('name,model,entry_number')->where('id',$data['material_entry_detail_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $data['company_name'] = $company['unit_name']; - $data['code'] = $material_parallel_testing['code']; - $data['inspector'] = $material_parallel_testing['inspector']; - $data['inspection_date'] = $material_parallel_testing['inspection_date']; - $data['name'] = $material_entry_detail['name']; - $data['model'] = $material_entry_detail['model']; - $data['entry_number'] = $material_entry_detail['entry_number']; - $data['check_result_text'] = $data->check_result_text; - $data['problem_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',7)->count(); - $data['reply_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',7)->where('is_rectification',1)->count(); - + $data['material_entry_code'] = $material_entry['code']; + $data['theme'] = $material_entry['theme']; + $data['enter_time'] = $material_entry['enter_time']; }) ->toArray(); } @@ -106,21 +83,7 @@ class SupervisionMaterialParallelTestingLists extends BaseAdminDataLists impleme */ public function count(): int { - $params = $this->request->get(); - $where = []; - if(isset($params['code']) && $params['code'] != ''){ - $witness_sampling_ids1 = SupervisionMaterialParallelTesting::where('code','like','%'.$params['code'].'%')->column('id'); - $where[] = ['material_parallel_testing_id','in',$witness_sampling_ids1]; - } - if(isset($params['project_id']) && $params['project_id'] != ''){ - $witness_sampling_ids2 = SupervisionMaterialParallelTesting::where('project_id','=',$params['project_id'])->column('id'); - $where[] = ['material_parallel_testing_id','in',$witness_sampling_ids2]; - } - if(isset($params['name']) && $params['name'] != ''){ - $material_entry_detail_ids = SupervisionMaterialEntryDetail::where('name','like','%'.$params['name'].'%')->column('id'); - $where[] = ['material_entry_detail_id','in',$material_entry_detail_ids]; - } - return SupervisionMaterialParallelTestingDetail::where($where)->count(); + return SupervisionMaterialParallelTesting::where($this->searchWhere)->count(); } } \ No newline at end of file diff --git a/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingDetailLogic.php b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingDetailLogic.php index 64a96f35d..bab3fed58 100644 --- a/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingDetailLogic.php +++ b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingDetailLogic.php @@ -156,7 +156,7 @@ class SupervisionMaterialParallelTestingDetailLogic extends BaseLogic $data['name'] = $material_entry_detail['name']; $data['brand'] = $material_entry_detail['brand']; $data['model'] = $material_entry_detail['model']; - $data['contract_brand'] = $material_entry_detail->contract_brand_text; + $data['contract_brand_text'] = $material_entry_detail->contract_brand_text; $data['entry_number'] = $material_entry_detail['entry_number']; return $data->toArray(); } diff --git a/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php index 41eda9d4d..6cbeb723f 100644 --- a/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php +++ b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php @@ -151,11 +151,13 @@ class SupervisionMaterialParallelTestingLogic extends BaseLogic { $data = SupervisionMaterialParallelTesting::withoutField('update_time,delete_time')->findOrEmpty($params['id']); $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); - $material_entry = SupervisionMaterialEntry::field('company_id')->where('id',$data['material_entry_id'])->findOrEmpty(); + $material_entry = SupervisionMaterialEntry::field('theme,company_id,enter_time')->where('id',$data['material_entry_id'])->findOrEmpty(); $company = SupervisionParticipatingUnits::field('unit_name')->where('id',$material_entry['company_id'])->findOrEmpty(); $create_user = Admin::field('name')->where('id',$data['create_user'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $data['company_name'] = $company['unit_name']; + $data['material_entry_name'] = $material_entry['theme']; + $data['enter_time'] = $material_entry['enter_time']; $data['create_user_name'] = $create_user['name']; return $data->toArray(); } diff --git a/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php b/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php index c5f2b087e..2585d9611 100644 --- a/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php +++ b/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php @@ -156,7 +156,7 @@ class SupervisionWitnessSamplingDetailLogic extends BaseLogic $data['name'] = $material_entry_detail['name']; $data['brand'] = $material_entry_detail['brand']; $data['model'] = $material_entry_detail['model']; - $data['contract_brand'] = $material_entry_detail->contract_brand_text; + $data['contract_brand_text'] = $material_entry_detail->contract_brand_text; $data['entry_number'] = $material_entry_detail['entry_number']; $data['check_result_text'] = $data->check_result_text; return $data->toArray();