diff --git a/app/adminapi/controller/supervision_work/SupervisionMaterialParallelTestingController.php b/app/adminapi/controller/supervision_work/SupervisionMaterialParallelTestingController.php new file mode 100644 index 000000000..325e221d9 --- /dev/null +++ b/app/adminapi/controller/supervision_work/SupervisionMaterialParallelTestingController.php @@ -0,0 +1,108 @@ +dataLists(new SupervisionMaterialParallelTestingLists()); + } + + + /** + * @notes 添加工程监理--材料平行检验 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function add() + { + $params = (new SupervisionMaterialParallelTestingValidate())->post()->goCheck('add'); + $result = SupervisionMaterialParallelTestingLogic::add($params,$this->adminId); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(SupervisionMaterialParallelTestingLogic::getError()); + } + + + /** + * @notes 编辑工程监理--材料平行检验 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function edit() + { + $params = (new SupervisionMaterialParallelTestingValidate())->post()->goCheck('edit'); + $result = SupervisionMaterialParallelTestingLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(SupervisionMaterialParallelTestingLogic::getError()); + } + + + /** + * @notes 删除工程监理--材料平行检验 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function delete() + { + $params = (new SupervisionMaterialParallelTestingValidate())->post()->goCheck('delete'); + SupervisionMaterialParallelTestingLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取工程监理--材料平行检验详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function detail() + { + $params = (new SupervisionMaterialParallelTestingValidate())->goCheck('detail'); + $result = SupervisionMaterialParallelTestingLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/controller/supervision_work/SupervisionMaterialParallelTestingDetailController.php b/app/adminapi/controller/supervision_work/SupervisionMaterialParallelTestingDetailController.php new file mode 100644 index 000000000..adaa67376 --- /dev/null +++ b/app/adminapi/controller/supervision_work/SupervisionMaterialParallelTestingDetailController.php @@ -0,0 +1,124 @@ +dataLists(new SupervisionMaterialParallelTestingDetailLists()); + } + + + /** + * @notes 添加工程监理--材料平行检验明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function add() + { + $params = (new SupervisionMaterialParallelTestingDetailValidate())->post()->goCheck('add'); + $result = SupervisionMaterialParallelTestingDetailLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(SupervisionMaterialParallelTestingDetailLogic::getError()); + } + + + /** + * @notes 编辑工程监理--材料平行检验明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function edit() + { + $params = (new SupervisionMaterialParallelTestingDetailValidate())->post()->goCheck('edit'); + $result = SupervisionMaterialParallelTestingDetailLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(SupervisionMaterialParallelTestingDetailLogic::getError()); + } + + /** + * @notes 检验工程监理--见证取样明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function check() + { + $params = (new SupervisionMaterialParallelTestingDetailValidate())->post()->goCheck('check'); + $result = SupervisionMaterialParallelTestingDetailLogic::check($params,$this->adminId); + if (true === $result) { + return $this->success('检验成功', [], 1, 1); + } + return $this->fail(SupervisionMaterialParallelTestingDetailLogic::getError()); + } + + + /** + * @notes 删除工程监理--材料平行检验明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function delete() + { + $params = (new SupervisionMaterialParallelTestingDetailValidate())->post()->goCheck('delete'); + SupervisionMaterialParallelTestingDetailLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取工程监理--材料平行检验明细详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function detail() + { + $params = (new SupervisionMaterialParallelTestingDetailValidate())->goCheck('detail'); + $result = SupervisionMaterialParallelTestingDetailLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/controller/supervision_work/SupervisionTestBlocksSpecimensController.php b/app/adminapi/controller/supervision_work/SupervisionTestBlocksSpecimensController.php new file mode 100644 index 000000000..96ac972b3 --- /dev/null +++ b/app/adminapi/controller/supervision_work/SupervisionTestBlocksSpecimensController.php @@ -0,0 +1,108 @@ +dataLists(new SupervisionTestBlocksSpecimensLists()); + } + + + /** + * @notes 添加工程监理--试块试件见证 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function add() + { + $params = (new SupervisionTestBlocksSpecimensValidate())->post()->goCheck('add'); + $result = SupervisionTestBlocksSpecimensLogic::add($params,$this->adminId); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(SupervisionTestBlocksSpecimensLogic::getError()); + } + + + /** + * @notes 编辑工程监理--试块试件见证 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function edit() + { + $params = (new SupervisionTestBlocksSpecimensValidate())->post()->goCheck('edit'); + $result = SupervisionTestBlocksSpecimensLogic::edit($params,$this->adminId); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(SupervisionTestBlocksSpecimensLogic::getError()); + } + + + /** + * @notes 删除工程监理--试块试件见证 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function delete() + { + $params = (new SupervisionTestBlocksSpecimensValidate())->post()->goCheck('delete'); + SupervisionTestBlocksSpecimensLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取工程监理--试块试件见证详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function detail() + { + $params = (new SupervisionTestBlocksSpecimensValidate())->goCheck('detail'); + $result = SupervisionTestBlocksSpecimensLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/controller/supervision_work/SupervisionWitnessSamplingController.php b/app/adminapi/controller/supervision_work/SupervisionWitnessSamplingController.php new file mode 100644 index 000000000..43a87352e --- /dev/null +++ b/app/adminapi/controller/supervision_work/SupervisionWitnessSamplingController.php @@ -0,0 +1,108 @@ +dataLists(new SupervisionWitnessSamplingLists()); + } + + + /** + * @notes 添加工程监理--见证取样 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function add() + { + $params = (new SupervisionWitnessSamplingValidate())->post()->goCheck('add'); + $result = SupervisionWitnessSamplingLogic::add($params,$this->adminId); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(SupervisionWitnessSamplingLogic::getError()); + } + + + /** + * @notes 编辑工程监理--见证取样 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function edit() + { + $params = (new SupervisionWitnessSamplingValidate())->post()->goCheck('edit'); + $result = SupervisionWitnessSamplingLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(SupervisionWitnessSamplingLogic::getError()); + } + + + /** + * @notes 删除工程监理--见证取样 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function delete() + { + $params = (new SupervisionWitnessSamplingValidate())->post()->goCheck('delete'); + SupervisionWitnessSamplingLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取工程监理--见证取样详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function detail() + { + $params = (new SupervisionWitnessSamplingValidate())->goCheck('detail'); + $result = SupervisionWitnessSamplingLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/controller/supervision_work/SupervisionWitnessSamplingDetailController.php b/app/adminapi/controller/supervision_work/SupervisionWitnessSamplingDetailController.php new file mode 100644 index 000000000..3040d3d03 --- /dev/null +++ b/app/adminapi/controller/supervision_work/SupervisionWitnessSamplingDetailController.php @@ -0,0 +1,124 @@ +dataLists(new SupervisionWitnessSamplingDetailLists()); + } + + + /** + * @notes 添加工程监理--见证取样明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function add() + { + $params = (new SupervisionWitnessSamplingDetailValidate())->post()->goCheck('add'); + $result = SupervisionWitnessSamplingDetailLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(SupervisionWitnessSamplingDetailLogic::getError()); + } + + + /** + * @notes 编辑工程监理--见证取样明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function edit() + { + $params = (new SupervisionWitnessSamplingDetailValidate())->post()->goCheck('edit'); + $result = SupervisionWitnessSamplingDetailLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(SupervisionWitnessSamplingDetailLogic::getError()); + } + + /** + * @notes 检验工程监理--见证取样明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function check() + { + $params = (new SupervisionWitnessSamplingDetailValidate())->post()->goCheck('check'); + $result = SupervisionWitnessSamplingDetailLogic::check($params,$this->adminId); + if (true === $result) { + return $this->success('检验成功', [], 1, 1); + } + return $this->fail(SupervisionWitnessSamplingDetailLogic::getError()); + } + + + /** + * @notes 删除工程监理--见证取样明细 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function delete() + { + $params = (new SupervisionWitnessSamplingDetailValidate())->post()->goCheck('delete'); + SupervisionWitnessSamplingDetailLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取工程监理--见证取样明细详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function detail() + { + $params = (new SupervisionWitnessSamplingDetailValidate())->goCheck('detail'); + $result = SupervisionWitnessSamplingDetailLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php new file mode 100644 index 000000000..4393f9a3c --- /dev/null +++ b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingDetailLists.php @@ -0,0 +1,85 @@ + ['material_parallel_testing_id', 'material_entry_detail_id', 'check_result'], + '%like%' => ['check_code', 'check_user'], + ]; + } + + + /** + * @notes 获取工程监理--材料平行检验明细列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function lists(): array + { + return SupervisionMaterialParallelTestingDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere) + ->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(); + $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['entry_number'] = $material_entry_detail['entry_number']; + }) + ->toArray(); + } + + + /** + * @notes 获取工程监理--材料平行检验明细数量 + * @return int + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function count(): int + { + return SupervisionMaterialParallelTestingDetail::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php new file mode 100644 index 000000000..4b2e716c7 --- /dev/null +++ b/app/adminapi/lists/supervision_work/SupervisionMaterialParallelTestingLists.php @@ -0,0 +1,126 @@ +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) + ->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(); + $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(); + + }) + ->toArray(); + } + + + /** + * @notes 获取工程监理--材料平行检验数量 + * @return int + * @author likeadmin + * @date 2024/02/29 15:00 + */ + 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(); + } + +} \ No newline at end of file diff --git a/app/adminapi/lists/supervision_work/SupervisionTestBlocksSpecimensLists.php b/app/adminapi/lists/supervision_work/SupervisionTestBlocksSpecimensLists.php new file mode 100644 index 000000000..55473ae65 --- /dev/null +++ b/app/adminapi/lists/supervision_work/SupervisionTestBlocksSpecimensLists.php @@ -0,0 +1,91 @@ + ['project_id', 'test_result'], + '%like%' => ['test_type', 'code', 'witness', 'test_site'], + ]; + } + + + /** + * @notes 获取工程监理--试块试件见证列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function lists(): array + { + return SupervisionTestBlocksSpecimens::withoutField('update_time,delete_time')->where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function($data){ + $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); + $company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['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['create_user_name'] = $create_user['name']; + $data['test_result_text'] = $data->test_result_text; + $data['problem_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',6)->count(); + $data['reply_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',6)->where('is_rectification',1)->count(); + }) + ->toArray(); + } + + + /** + * @notes 获取工程监理--试块试件见证数量 + * @return int + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function count(): int + { + return SupervisionTestBlocksSpecimens::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/adminapi/lists/supervision_work/SupervisionWitnessSamplingDetailLists.php b/app/adminapi/lists/supervision_work/SupervisionWitnessSamplingDetailLists.php new file mode 100644 index 000000000..8c8505905 --- /dev/null +++ b/app/adminapi/lists/supervision_work/SupervisionWitnessSamplingDetailLists.php @@ -0,0 +1,85 @@ + ['witness_sampling_id', 'material_entry_detail_id', 'check_result'], + '%like%' => ['check_code', 'check_user'], + ]; + } + + + /** + * @notes 获取工程监理--见证取样明细列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function lists(): array + { + return SupervisionWitnessSamplingDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere) + ->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(); + $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['entry_number'] = $material_entry_detail['entry_number']; + }) + ->toArray(); + } + + + /** + * @notes 获取工程监理--见证取样明细数量 + * @return int + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function count(): int + { + return SupervisionWitnessSamplingDetail::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/adminapi/lists/supervision_work/SupervisionWitnessSamplingLists.php b/app/adminapi/lists/supervision_work/SupervisionWitnessSamplingLists.php new file mode 100644 index 000000000..2a67fc1e1 --- /dev/null +++ b/app/adminapi/lists/supervision_work/SupervisionWitnessSamplingLists.php @@ -0,0 +1,126 @@ +request->get(); + $where = []; + if(isset($params['code']) && $params['code'] != ''){ + $witness_sampling_ids1 = SupervisionWitnessSampling::where('code','like','%'.$params['code'].'%')->column('id'); + $where[] = ['witness_sampling_id','in',$witness_sampling_ids1]; + } + if(isset($params['project_id']) && $params['project_id'] != ''){ + $witness_sampling_ids2 = SupervisionWitnessSampling::where('project_id','=',$params['project_id'])->column('id'); + $where[] = ['witness_sampling_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 SupervisionWitnessSamplingDetail::withoutField('check_code,check_time,check_user,check_remark,check_annex,create_time,update_time,delete_time')->where($where) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function($data){ + $witness_sampling = SupervisionWitnessSampling::field('project_id,material_entry_id,code,sampling_date,witness')->where('id',$data['witness_sampling_id'])->findOrEmpty(); + $project = SupervisionProject::field('project_name')->where('id',$witness_sampling['project_id'])->findOrEmpty(); + $material_entry = SupervisionMaterialEntry::field('company_id,enter_time')->where('id',$witness_sampling['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'] = $witness_sampling['code']; + $data['enter_time'] = $material_entry['enter_time']; + $data['sampling_date'] = $witness_sampling['sampling_date']; + $data['witness'] = $witness_sampling['witness']; + $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',5)->count(); + $data['reply_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',5)->where('is_rectification',1)->count(); + }) + ->toArray(); + } + + + /** + * @notes 获取工程监理--见证取样数量 + * @return int + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function count(): int + { + $params = $this->request->get(); + $where = []; + if(isset($params['code']) && $params['code'] != ''){ + $witness_sampling_ids1 = SupervisionWitnessSampling::where('code','like','%'.$params['code'].'%')->column('id'); + $where[] = ['witness_sampling_id','in',$witness_sampling_ids1]; + } + if(isset($params['project_id']) && $params['project_id'] != ''){ + $witness_sampling_ids2 = SupervisionWitnessSampling::where('project_id','=',$params['project_id'])->column('id'); + $where[] = ['witness_sampling_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 SupervisionWitnessSamplingDetail::where($where)->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 new file mode 100644 index 000000000..64a96f35d --- /dev/null +++ b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingDetailLogic.php @@ -0,0 +1,163 @@ + $params['material_parallel_testing_id'], + 'material_entry_detail_id' => $params['material_entry_detail_id'], + 'num' => $params['num'], + ]); + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑工程监理--材料平行检验明细 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + SupervisionMaterialParallelTestingDetail::where('id', $params['id'])->update([ + 'material_parallel_testing_id' => $params['material_parallel_testing_id'], + 'material_entry_detail_id' => $params['material_entry_detail_id'], + 'num' => $params['num'], + 'update_time' => time() + ]); + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + /** + * @notes 检验工程监理--见证取样明细 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function check(array $params,$admin_id): bool + { + Db::startTrans(); + try { + SupervisionMaterialParallelTestingDetail::where('id', $params['id'])->update([ + 'check_code' => $params['check_code'], + 'check_result' => $params['check_result'], + 'check_time' => !empty($params['check_time']) ? strtotime($params['check_time']) : 0, + 'check_user' => $params['check_user'], + 'check_remark' => $params['check_remark'], + 'check_annex' => $params['check_annex'] ? json_encode($params['check_annex']) : null, + ]); + if(!empty($params['check_problem'])){ + foreach($params['check_problem'] as $v){ + SupervisionProblem::create([ + 'data_id' => $params['id'], + 'data_type' => 7, + 'problem_cate' => $v['problem_cate'], + 'problem_description' => $v['problem_description'], + 'problem_name' => $v['problem_name'], + 'create_user' => $admin_id, + ]); + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除工程监理--材料平行检验明细 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public static function delete(array $params): bool + { + $check_problem = SupervisionProblem::where('data_id',$params['id'])->where('data_type',7)->findOrEmpty(); + if(!$check_problem->isEmpty()){ + self::setError('该内容下存在验收问题数据,请先删除验收问题数据'); + return false; + } + return SupervisionMaterialParallelTestingDetail::destroy($params['id']); + } + + + /** + * @notes 获取工程监理--材料平行检验明细详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public static function detail($params): array + { + $data = SupervisionMaterialParallelTestingDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); + $material_entry_detail = SupervisionMaterialEntryDetail::field('name,brand,model,contract_brand,entry_number')->where('id',$data['material_entry_detail_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['entry_number'] = $material_entry_detail['entry_number']; + return $data->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php new file mode 100644 index 000000000..41eda9d4d --- /dev/null +++ b/app/adminapi/logic/supervision_work/SupervisionMaterialParallelTestingLogic.php @@ -0,0 +1,162 @@ + $params['project_id'], + 'material_entry_id' => $params['material_entry_id'], + 'code' => data_unique_code('CLPXJY'), + 'inspector' => $params['inspector'], + 'inspection_date' => !empty($params['inspection_date']) ? strtotime($params['inspection_date']) : 0, + 'remark' => $params['remark'], + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'create_user' => $admin_id + ]); + if(!empty($params['detail'])){ + foreach($params['detail'] as $v){ + SupervisionMaterialParallelTestingDetail::create([ + 'material_parallel_testing_id' => $res->id, + 'material_entry_detail_id' => $v['material_entry_detail_id'], + 'num' => $v['num'] + ]); + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑工程监理--材料平行检验 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + SupervisionMaterialParallelTesting::where('id', $params['id'])->update([ + 'project_id' => $params['project_id'], + 'material_entry_id' => $params['material_entry_id'], + 'inspector' => $params['inspector'], + 'inspection_date' => !empty($params['inspection_date']) ? strtotime($params['inspection_date']) : 0, + 'remark' => $params['remark'], + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'update_time' => time() + ]); + if(!empty($params['detail'])){ + foreach($params['detail'] as $v){ + if(!empty($v['id'])){ + SupervisionMaterialParallelTestingDetail::where('id',$v['id'])->update([ + 'material_parallel_testing_id' => $params['id'], + 'material_entry_detail_id' => $v['material_entry_detail_id'], + 'num' => $v['num'], + 'update_time' => time() + ]); + }else{ + SupervisionMaterialParallelTestingDetail::create([ + 'material_parallel_testing_id' => $params['id'], + 'material_entry_detail_id' => $v['material_entry_detail_id'], + 'num' => $v['num'] + ]); + } + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除工程监理--材料平行检验 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public static function delete(array $params): bool + { + $detail = SupervisionMaterialParallelTestingDetail::where('material_parallel_testing_id',$params['id'])->findOrEmpty(); + if(!$detail->isEmpty()){ + self::setError('当前数据下存在材料信息内容,请先删除材料信息内容'); + return false; + } + return SupervisionMaterialParallelTesting::destroy($params['id']); + } + + + /** + * @notes 获取工程监理--材料平行检验详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public static function detail($params): array + { + $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(); + $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['create_user_name'] = $create_user['name']; + return $data->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/logic/supervision_work/SupervisionTestBlocksSpecimensLogic.php b/app/adminapi/logic/supervision_work/SupervisionTestBlocksSpecimensLogic.php new file mode 100644 index 000000000..98e93a5b7 --- /dev/null +++ b/app/adminapi/logic/supervision_work/SupervisionTestBlocksSpecimensLogic.php @@ -0,0 +1,176 @@ + $params['project_id'], + 'test_type' => $params['test_type'], + 'code' => data_unique_code('SKSJJZ'), + 'witness' => $params['witness'], + 'test_site' => $params['test_site'], + 'company_id' => $params['company_id'], + 'start_date' => !empty($params['start_date']) ? strtotime($params['start_date']) : 0, + 'end_date' => !empty($params['end_date']) ? strtotime($params['end_date']) : 0, + 'test_result' => $params['test_result'], + 'remark' => $params['remark'], + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'create_user' => $admin_id + ]); + if(!empty($params['problem'])){ + foreach($params['problem'] as $v){ + SupervisionProblem::create([ + 'data_id' => $res->id, + 'data_type' => 6, + 'problem_cate' => $v['problem_cate'], + 'problem_description' => $v['problem_description'], + 'problem_name' => $v['problem_name'], + 'create_user' => $admin_id, + ]); + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑工程监理--试块试件见证 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public static function edit(array $params,$admin_id): bool + { + Db::startTrans(); + try { + SupervisionTestBlocksSpecimens::where('id', $params['id'])->update([ + 'project_id' => $params['project_id'], + 'test_type' => $params['test_type'], + 'witness' => $params['witness'], + 'test_site' => $params['test_site'], + 'company_id' => $params['company_id'], + 'start_date' => !empty($params['start_date']) ? strtotime($params['start_date']) : 0, + 'end_date' => !empty($params['end_date']) ? strtotime($params['end_date']) : 0, + 'test_result' => $params['test_result'], + 'remark' => $params['remark'], + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + ]); + if(!empty($params['problem'])){ + foreach($params['problem'] as $v){ + if(!empty($v['id'])){ + SupervisionProblem::where('id',$v['id'])->update([ + 'data_id' => $params['id'], + 'data_type' => 6, + 'problem_cate' => $v['problem_cate'], + 'problem_description' => $v['problem_description'], + 'problem_name' => $v['problem_name'], + 'update_time' => time(), + ]); + }else{ + SupervisionProblem::create([ + 'data_id' => $params['id'], + 'data_type' => 6, + 'problem_cate' => $v['problem_cate'], + 'problem_description' => $v['problem_description'], + 'problem_name' => $v['problem_name'], + 'create_user' => $admin_id, + ]); + } + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除工程监理--试块试件见证 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public static function delete(array $params): bool + { + $problem = SupervisionProblem::where('data_id',$params['id'])->where('data_type',6)->findOrEmpty(); + if(!$problem->isEmpty()){ + self::setError('该内容下存在试块试件见证问题数据,请先删除试块试件见证问题数据'); + return false; + } + return SupervisionTestBlocksSpecimens::destroy($params['id']); + } + + + /** + * @notes 获取工程监理--试块试件见证详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public static function detail($params): array + { + $data = SupervisionTestBlocksSpecimens::withoutField('update_time,delete_time')->findOrEmpty($params['id']); + $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); + $company = SupervisionParticipatingUnits::field('unit_name')->where('id',$data['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['create_user_name'] = $create_user['name']; + $data['test_result_text'] = $data->test_result_text; + return $data->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php b/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php new file mode 100644 index 000000000..43e8417d8 --- /dev/null +++ b/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingDetailLogic.php @@ -0,0 +1,163 @@ + $params['witness_sampling_id'], + 'material_entry_detail_id' => $params['material_entry_detail_id'], + 'num' => $params['num'], + ]); + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑工程监理--见证取样明细 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + SupervisionWitnessSamplingDetail::where('id', $params['id'])->update([ + 'witness_sampling_id' => $params['witness_sampling_id'], + 'material_entry_detail_id' => $params['material_entry_detail_id'], + 'num' => $params['num'], + 'update_time' => time() + ]); + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + /** + * @notes 检验工程监理--见证取样明细 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function check(array $params,$admin_id): bool + { + Db::startTrans(); + try { + SupervisionWitnessSamplingDetail::where('id', $params['id'])->update([ + 'check_code' => $params['check_code'], + 'check_result' => $params['check_result'], + 'check_time' => !empty($params['check_time']) ? strtotime($params['check_time']) : 0, + 'check_user' => $params['check_user'], + 'check_remark' => $params['check_remark'], + 'check_annex' => $params['check_annex'] ? json_encode($params['check_annex']) : null, + ]); + if(!empty($params['check_problem'])){ + foreach($params['check_problem'] as $v){ + SupervisionProblem::create([ + 'data_id' => $params['id'], + 'data_type' => 5, + 'problem_cate' => $v['problem_cate'], + 'problem_description' => $v['problem_description'], + 'problem_name' => $v['problem_name'], + 'create_user' => $admin_id, + ]); + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除工程监理--见证取样明细 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function delete(array $params): bool + { + $check_problem = SupervisionProblem::where('data_id',$params['id'])->where('data_type',5)->findOrEmpty(); + if(!$check_problem->isEmpty()){ + self::setError('该内容下存在验收问题数据,请先删除验收问题数据'); + return false; + } + return SupervisionWitnessSamplingDetail::destroy($params['id']); + } + + + /** + * @notes 获取工程监理--见证取样明细详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function detail($params): array + { + $data = SupervisionWitnessSamplingDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); + $material_entry_detail = SupervisionMaterialEntryDetail::field('name,brand,model,contract_brand,entry_number')->where('id',$data['material_entry_detail_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['entry_number'] = $material_entry_detail['entry_number']; + return $data->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingLogic.php b/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingLogic.php new file mode 100644 index 000000000..710f99aca --- /dev/null +++ b/app/adminapi/logic/supervision_work/SupervisionWitnessSamplingLogic.php @@ -0,0 +1,164 @@ + $params['project_id'], + 'material_entry_id' => $params['material_entry_id'], + 'code' => data_unique_code('CLJZ'), + 'sampling_date' => !empty($params['sampling_date']) ? strtotime($params['sampling_date']) : 0, + 'witness' => $params['witness'], + 'sampler' => $params['sampler'], + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'create_user' => $admin_id + ]); + if(!empty($params['sampling_detail'])){ + foreach($params['sampling_detail'] as $v){ + SupervisionWitnessSamplingDetail::create([ + 'witness_sampling_id' => $res->id, + 'material_entry_detail_id' => $v['material_entry_detail_id'], + 'num' => $v['num'] + ]); + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑工程监理--见证取样 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + SupervisionWitnessSampling::where('id', $params['id'])->update([ + 'project_id' => $params['project_id'], + 'material_entry_id' => $params['material_entry_id'], + 'sampling_date' => !empty($params['sampling_date']) ? strtotime($params['sampling_date']) : 0, + 'witness' => $params['witness'], + 'sampler' => $params['sampler'], + 'annex' => $params['annex'] ? json_encode($params['annex']) : null, + 'update_time' => time() + ]); + if(!empty($params['sampling_detail'])){ + foreach($params['sampling_detail'] as $v){ + if(!empty($v['id'])){ + SupervisionWitnessSamplingDetail::where('id',$v['id'])->update([ + 'witness_sampling_id' => $params['id'], + 'material_entry_detail_id' => $v['material_entry_detail_id'], + 'num' => $v['num'], + 'update_time' => time() + ]); + }else{ + SupervisionWitnessSamplingDetail::create([ + 'witness_sampling_id' => $params['id'], + 'material_entry_detail_id' => $v['material_entry_detail_id'], + 'num' => $v['num'] + ]); + } + + } + } + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除工程监理--见证取样 + * @param array $params + * @return bool + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function delete(array $params): bool + { + $witness_sampling_detail = SupervisionWitnessSamplingDetail::where('witness_sampling_id',$params['id'])->findOrEmpty(); + if(!$witness_sampling_detail->isEmpty()){ + self::setError('当前数据下存在材料信息内容,请先删除材料信息内容'); + return false; + } + return SupervisionWitnessSampling::destroy($params['id']); + } + + + /** + * @notes 获取工程监理--见证取样详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public static function detail($params): array + { + $data = SupervisionWitnessSampling::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,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['enter_time'] = $material_entry['enter_time']; + $data['create_user_name'] = $create_user['name']; + return $data->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/validate/supervision_work/SupervisionMaterialParallelTestingDetailValidate.php b/app/adminapi/validate/supervision_work/SupervisionMaterialParallelTestingDetailValidate.php new file mode 100644 index 000000000..3175d3cdf --- /dev/null +++ b/app/adminapi/validate/supervision_work/SupervisionMaterialParallelTestingDetailValidate.php @@ -0,0 +1,186 @@ + 'require|checkData', + 'material_parallel_testing_id' => 'require|checkMaterialParallelTesting', + 'material_entry_detail_id' => 'require|checkMaterialEntryDetail', + 'num' => 'require|float', + 'check_code' => 'require', + 'check_result' => 'require|in:1,2', + 'check_time' => 'require|dateFormat:Y-m-d', + 'check_user' => 'require', + 'check_annex' => 'checkAnnex', + 'check_problem' => 'checkProblem' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'material_parallel_testing_id' => '材料平行检验id', + 'material_entry_detail_id' => '材料进场明细id', + 'num' => '检验数量', + 'check_code' => '报告编号', + 'check_result' => '检验结果', + 'check_time' => '获得日期', + 'check_user' => '操作人', + 'check_remark' => '备注', + ]; + + + /** + * @notes 添加场景 + * @return SupervisionMaterialParallelTestingDetailValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneAdd() + { + return $this->only(['material_parallel_testing_id','material_entry_detail_id','num']); + } + + + /** + * @notes 编辑场景 + * @return SupervisionMaterialParallelTestingDetailValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneEdit() + { + return $this->only(['id','material_parallel_testing_id','material_entry_detail_id','num']); + } + + /** + * @notes 检验场景 + * @return SupervisionMaterialParallelTestingDetailValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneCheck() + { + return $this->only(['id','check_code','check_result','check_time','check_user','check_remark','check_annex','check_problem']); + } + + + /** + * @notes 删除场景 + * @return SupervisionMaterialParallelTestingDetailValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return SupervisionMaterialParallelTestingDetailValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = SupervisionMaterialParallelTestingDetail::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + + public function checkMaterialParallelTesting($value): bool|string + { + $data = SupervisionMaterialParallelTesting::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '材料平行检验信息不存在'; + } + return true; + } + + public function checkMaterialEntryDetail($value,$rule,$params): bool|string + { + $witness_sampling = SupervisionMaterialParallelTesting::where('id',$params['material_parallel_testing_id'])->findOrEmpty(); + $data = SupervisionMaterialEntryDetail::where('id',$value)->where('material_entry_id',$witness_sampling['material_entry_id'])->findOrEmpty(); + if($data->isEmpty()){ + return '材料信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if(!empty($value) && $value != '' && !is_array($value)){ + return '附件格式错误'; + } + return true; + } + + public function checkProblem($value): bool|string + { + if(!isset($value) || $value == '') return true; + if(!is_array($value)) return '检验问题数据格式错误'; + foreach($value as $k=>$v){ + if(!empty($v['id'])){ + $data = SupervisionProblem::where('id',$v['id'])->findOrEmpty(); + if($data->isEmpty()){ + return '检验问题列表第'.($k+1).'行数据不存在'; + } + } + if(empty($v['problem_cate'])){ + return '检验问题列表第'.($k+1).'行问题分类为空'; + }else{ + $dict = DictData::where('type_value','problem_cate')->column('value'); + if(!in_array($v['problem_cate'],$dict)) return '检验问题列表第'.($k+1).'行问题分类数据值无效'; + } + if(empty($v['problem_description'])) return '检验问题列表第'.($k+1).'行问题说明为空'; + if(empty($v['problem_name'])) return '检验问题列表第'.($k+1).'行问题名称为空'; + } + return true; + } + +} \ No newline at end of file diff --git a/app/adminapi/validate/supervision_work/SupervisionMaterialParallelTestingValidate.php b/app/adminapi/validate/supervision_work/SupervisionMaterialParallelTestingValidate.php new file mode 100644 index 000000000..3ea3d569d --- /dev/null +++ b/app/adminapi/validate/supervision_work/SupervisionMaterialParallelTestingValidate.php @@ -0,0 +1,171 @@ + 'require|checkData', + 'project_id' => 'require|checkProject', + 'material_entry_id' => 'require|checkMaterialEntry', + 'inspector' => 'require', + 'inspection_date' => 'require|dateFormat:Y-m-d', + 'annex' => 'checkAnnex', + 'detail' => 'checkDetail' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'material_entry_id' => '来源单据', + 'code' => '编号', + 'inspector' => '送检人', + 'inspection_date' => '送检日期', + 'remark' => '备注', + 'create_user' => '创建人', + ]; + + + /** + * @notes 添加场景 + * @return SupervisionMaterialParallelTestingValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneAdd() + { + return $this->remove('id',true); + } + + + /** + * @notes 编辑场景 + * @return SupervisionMaterialParallelTestingValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneEdit() + {} + + + /** + * @notes 删除场景 + * @return SupervisionMaterialParallelTestingValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return SupervisionMaterialParallelTestingValidate + * @author likeadmin + * @date 2024/02/29 15:00 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = SupervisionMaterialParallelTesting::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = SupervisionProject::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '项目信息不存在'; + } + return true; + } + + public function checkMaterialEntry($value,$rule,$params): bool|string + { + $data = SupervisionMaterialEntry::where('id',$value)->where('project_id',$params['project_id'])->findOrEmpty(); + if($data->isEmpty()){ + return '来源单据信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if(!empty($value) && $value != '' && !is_array($value)){ + return '附件格式错误'; + } + return true; + } + + public function checkDetail($value,$rule,$params): bool|string + { + if(!isset($value) || $value == '') return true; + if(!is_array($value)) return '材料信息数据格式错误'; + foreach($value as $k=>$v) { + if (!empty($v['id'])) { + $data = SupervisionMaterialParallelTestingDetail::where('id', $v['id'])->findOrEmpty(); + if ($data->isEmpty()) { + return '材料信息列表第' . ($k + 1) . '行数据不存在'; + } + } + if (empty($v['material_entry_detail_id'])){ + return '材料信息列表第' . ($k + 1) . '行材料名称为空'; + }else{ + $material = SupervisionMaterialEntryDetail::where('id',$v['material_entry_detail_id'])->where('material_entry_id',$params['material_entry_id'])->findOrEmpty(); + if($material->isEmpty()) return '材料信息列表第' . ($k + 1) . '行材料数据不存在'; + } + if (empty($v['num'])){ + return '材料信息列表第' . ($k + 1) . '行取样数量为空'; + }else{ + if(!is_numeric($v['num'])) return '材料信息列表第' . ($k + 1) . '行取样数量必须是数字'; + } + } + return true; + } + +} \ No newline at end of file diff --git a/app/adminapi/validate/supervision_work/SupervisionTestBlocksSpecimensValidate.php b/app/adminapi/validate/supervision_work/SupervisionTestBlocksSpecimensValidate.php new file mode 100644 index 000000000..1ad8f2fec --- /dev/null +++ b/app/adminapi/validate/supervision_work/SupervisionTestBlocksSpecimensValidate.php @@ -0,0 +1,173 @@ + 'require|checkData', + 'project_id' => 'require|checkProject', + 'witness' => 'require', + 'company_id' => 'checkCompany', + 'start_date' => 'require|dateFormat:Y-m-d', + 'end_date' => 'require|dateFormat:Y-m-d', + 'test_result' => 'require|in:0,1', + 'annex' => 'checkAnnex', + 'problem' => 'checkProblem' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'test_type' => '试验类型', + 'code' => '编号', + 'witness' => '见证人', + 'test_site' => '试验部位', + 'company_id' => '单位名称', + 'start_date' => '开始日期', + 'end_date' => '结束日期', + 'test_result' => '试验结果 0-符合标准 1-不符合标准', + 'remark' => '备注', + 'create_user' => '创建人', + ]; + + + /** + * @notes 添加场景 + * @return SupervisionTestBlocksSpecimensValidate + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function sceneAdd() + { + return $this->remove('id',true); + } + + + /** + * @notes 编辑场景 + * @return SupervisionTestBlocksSpecimensValidate + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function sceneEdit() + {} + + + /** + * @notes 删除场景 + * @return SupervisionTestBlocksSpecimensValidate + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return SupervisionTestBlocksSpecimensValidate + * @author likeadmin + * @date 2024/02/29 14:02 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value){ + $data = SupervisionTestBlocksSpecimens::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = SupervisionProject::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '项目信息不存在'; + } + return true; + } + + public function checkCompany($value,$rule,$params): bool|string + { + $data = SupervisionParticipatingUnits::where('id',$value)->where('project_id',$params['project_id'])->findOrEmpty(); + if($data->isEmpty()){ + return '单位信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if(!empty($value) && $value != '' && !is_array($value)){ + return '附件格式错误'; + } + return true; + } + + public function checkProblem($value): bool|string + { + if(!isset($value) || $value == '') return true; + if(!is_array($value)) return '试块试件见证问题数据格式错误'; + foreach($value as $k=>$v){ + if(!empty($v['id'])){ + $data = SupervisionProblem::where('id',$v['id'])->findOrEmpty(); + if($data->isEmpty()){ + return '试块试件见证问题列表第'.($k+1).'行数据不存在'; + } + } + if(empty($v['problem_cate'])){ + return '试块试件见证问题列表第'.($k+1).'行问题分类为空'; + }else{ + $dict = DictData::where('type_value','problem_cate')->column('value'); + if(!in_array($v['problem_cate'],$dict)) return '试块试件见证问题列表第'.($k+1).'行问题分类数据值无效'; + } + if(empty($v['problem_description'])) return '试块试件见证问题列表第'.($k+1).'行问题说明为空'; + if(empty($v['problem_name'])) return '试块试件见证问题列表第'.($k+1).'行问题名称为空'; + } + return true; + } + +} \ No newline at end of file diff --git a/app/adminapi/validate/supervision_work/SupervisionWitnessSamplingDetailValidate.php b/app/adminapi/validate/supervision_work/SupervisionWitnessSamplingDetailValidate.php new file mode 100644 index 000000000..f849568ab --- /dev/null +++ b/app/adminapi/validate/supervision_work/SupervisionWitnessSamplingDetailValidate.php @@ -0,0 +1,186 @@ + 'require|checkData', + 'witness_sampling_id' => 'require|checkWitnessSampling', + 'material_entry_detail_id' => 'require|checkMaterialEntryDetail', + 'num' => 'require|float', + 'check_code' => 'require', + 'check_result' => 'require|in:1,2', + 'check_time' => 'require|dateFormat:Y-m-d', + 'check_user' => 'require', + 'check_annex' => 'checkAnnex', + 'check_problem' => 'checkProblem' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'witness_sampling_id' => '见证取样id', + 'material_entry_detail_id' => '材料进场明细id', + 'num' => '取样数量', + 'check_code' => '报告编号', + 'check_result' => '检验结果', + 'check_time' => '获得日期', + 'check_user' => '操作人', + 'check_remark' => '备注', + ]; + + + /** + * @notes 添加场景 + * @return SupervisionWitnessSamplingDetailValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneAdd() + { + return $this->only(['witness_sampling_id','material_entry_detail_id','num']); + } + + + /** + * @notes 编辑场景 + * @return SupervisionWitnessSamplingDetailValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneEdit() + { + return $this->only(['id','witness_sampling_id','material_entry_detail_id','num']); + } + + /** + * @notes 检验场景 + * @return SupervisionWitnessSamplingDetailValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneCheck() + { + return $this->only(['id','check_code','check_result','check_time','check_user','check_remark','check_annex','check_problem']); + } + + + /** + * @notes 删除场景 + * @return SupervisionWitnessSamplingDetailValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return SupervisionWitnessSamplingDetailValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = SupervisionWitnessSamplingDetail::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + + public function checkWitnessSampling($value): bool|string + { + $data = SupervisionWitnessSampling::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '见证取样信息不存在'; + } + return true; + } + + public function checkMaterialEntryDetail($value,$rule,$params): bool|string + { + $witness_sampling = SupervisionWitnessSampling::where('id',$params['witness_sampling_id'])->findOrEmpty(); + $data = SupervisionMaterialEntryDetail::where('id',$value)->where('material_entry_id',$witness_sampling['material_entry_id'])->findOrEmpty(); + if($data->isEmpty()){ + return '材料信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if(!empty($value) && $value != '' && !is_array($value)){ + return '附件格式错误'; + } + return true; + } + + public function checkProblem($value): bool|string + { + if(!isset($value) || $value == '') return true; + if(!is_array($value)) return '检验问题数据格式错误'; + foreach($value as $k=>$v){ + if(!empty($v['id'])){ + $data = SupervisionProblem::where('id',$v['id'])->findOrEmpty(); + if($data->isEmpty()){ + return '检验问题列表第'.($k+1).'行数据不存在'; + } + } + if(empty($v['problem_cate'])){ + return '检验问题列表第'.($k+1).'行问题分类为空'; + }else{ + $dict = DictData::where('type_value','problem_cate')->column('value'); + if(!in_array($v['problem_cate'],$dict)) return '检验问题列表第'.($k+1).'行问题分类数据值无效'; + } + if(empty($v['problem_description'])) return '检验问题列表第'.($k+1).'行问题说明为空'; + if(empty($v['problem_name'])) return '检验问题列表第'.($k+1).'行问题名称为空'; + } + return true; + } + +} \ No newline at end of file diff --git a/app/adminapi/validate/supervision_work/SupervisionWitnessSamplingValidate.php b/app/adminapi/validate/supervision_work/SupervisionWitnessSamplingValidate.php new file mode 100644 index 000000000..7a1d47d18 --- /dev/null +++ b/app/adminapi/validate/supervision_work/SupervisionWitnessSamplingValidate.php @@ -0,0 +1,171 @@ + 'require|checkData', + 'project_id' => 'require|checkProject', + 'material_entry_id' => 'require|checkMaterialEntry', + 'sampling_date' => 'require|dateFormat:Y-m-d', + 'sampler' => 'require', + 'annex' => 'checkAnnex', + 'sampling_detail' => 'checkSamplingDetail' + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'project_id' => '项目id', + 'material_entry_id' => '来源单据', + 'code' => '编号', + 'sampling_date' => '取样日期', + 'witness' => '见证人', + 'sampler' => '取样人', + 'create_user' => '创建人', + ]; + + + /** + * @notes 添加场景 + * @return SupervisionWitnessSamplingValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneAdd() + { + return $this->remove('id',true); + } + + + /** + * @notes 编辑场景 + * @return SupervisionWitnessSamplingValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneEdit() + {} + + + /** + * @notes 删除场景 + * @return SupervisionWitnessSamplingValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return SupervisionWitnessSamplingValidate + * @author likeadmin + * @date 2024/02/29 09:22 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + + public function checkData($value): bool|string + { + $data = SupervisionWitnessSampling::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '数据不存在'; + } + return true; + } + + public function checkProject($value): bool|string + { + $data = SupervisionProject::where('id',$value)->findOrEmpty(); + if($data->isEmpty()){ + return '项目信息不存在'; + } + return true; + } + + public function checkMaterialEntry($value,$rule,$params): bool|string + { + $data = SupervisionMaterialEntry::where('id',$value)->where('project_id',$params['project_id'])->findOrEmpty(); + if($data->isEmpty()){ + return '来源单据信息不存在'; + } + return true; + } + + public function checkAnnex($value): bool|string + { + if(!empty($value) && $value != '' && !is_array($value)){ + return '附件格式错误'; + } + return true; + } + + public function checkSamplingDetail($value,$rule,$params): bool|string + { + if(!isset($value) || $value == '') return true; + if(!is_array($value)) return '材料信息数据格式错误'; + foreach($value as $k=>$v) { + if (!empty($v['id'])) { + $data = SupervisionWitnessSamplingDetail::where('id', $v['id'])->findOrEmpty(); + if ($data->isEmpty()) { + return '材料信息列表第' . ($k + 1) . '行数据不存在'; + } + } + if (empty($v['material_entry_detail_id'])){ + return '材料信息列表第' . ($k + 1) . '行材料名称为空'; + }else{ + $material = SupervisionMaterialEntryDetail::where('id',$v['material_entry_detail_id'])->where('material_entry_id',$params['material_entry_id'])->findOrEmpty(); + if($material->isEmpty()) return '材料信息列表第' . ($k + 1) . '行材料数据不存在'; + } + if (empty($v['num'])){ + return '材料信息列表第' . ($k + 1) . '行取样数量为空'; + }else{ + if(!is_numeric($v['num'])) return '材料信息列表第' . ($k + 1) . '行取样数量必须是数字'; + } + } + return true; + } + +} \ No newline at end of file diff --git a/app/common/model/supervision_work/SupervisionMaterialParallelTesting.php b/app/common/model/supervision_work/SupervisionMaterialParallelTesting.php new file mode 100644 index 000000000..89b8fbf02 --- /dev/null +++ b/app/common/model/supervision_work/SupervisionMaterialParallelTesting.php @@ -0,0 +1,41 @@ +'未检验', 1=>'符合标准', 2=>'不符合标准']; + return $arr[$data['check_result']]; + } + + public function getCheckTimeAttr($value): string + { + return !empty($value) ? date('Y-m-d') : ''; + } + + public function getCheckAnnexAttr($value) + { + return !empty($value) ? json_decode($value,true) : ''; + } +} \ No newline at end of file diff --git a/app/common/model/supervision_work/SupervisionProblem.php b/app/common/model/supervision_work/SupervisionProblem.php index b453d063d..0f2715738 100644 --- a/app/common/model/supervision_work/SupervisionProblem.php +++ b/app/common/model/supervision_work/SupervisionProblem.php @@ -34,7 +34,7 @@ class SupervisionProblem extends BaseModel public function getDataTypeTextAttr($value,$data): string { //1-巡视 2-旁站 3-验收 4-设备进场 5-见证取样 6-材料平行检验 7-实体平行检验 - $arr = [1=>'巡视', 2=>'旁站', 3=>'验收', 4=>'设备进场', 5=>'见证取样', 6=>'材料平行检验', 7=>'实体平行检验']; + $arr = [1=>'巡视', 2=>'旁站', 3=>'验收', 4=>'设备进场', 5=>'见证取样', 6=>'试块试件见证', 7=>'材料平行检验', 8=>'实体平行检验']; return $arr[$data['data_type']]; } diff --git a/app/common/model/supervision_work/SupervisionTestBlocksSpecimens.php b/app/common/model/supervision_work/SupervisionTestBlocksSpecimens.php new file mode 100644 index 000000000..523e48816 --- /dev/null +++ b/app/common/model/supervision_work/SupervisionTestBlocksSpecimens.php @@ -0,0 +1,52 @@ +'符合标准', 1=>'不符合标准']; + return $arr[$data['test_result']]; + } + + public function getStartDateAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } + + public function getEndDateAttr($value): string + { + return !empty($value) ? date('Y-m-d', $value) : ''; + } +} \ No newline at end of file diff --git a/app/common/model/supervision_work/SupervisionWitnessSampling.php b/app/common/model/supervision_work/SupervisionWitnessSampling.php new file mode 100644 index 000000000..e7969d23b --- /dev/null +++ b/app/common/model/supervision_work/SupervisionWitnessSampling.php @@ -0,0 +1,41 @@ +'未检验', 1=>'符合标准', 2=>'不符合标准']; + return $arr[$data['check_result']]; + } + + public function getCheckTimeAttr($value): string + { + return !empty($value) ? date('Y-m-d') : ''; + } + + public function getCheckAnnexAttr($value) + { + return !empty($value) ? json_decode($value,true) : ''; + } +} \ No newline at end of file