Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
chenbo 2024-02-29 09:44:44 +08:00
commit 918ceee955
20 changed files with 2249 additions and 0 deletions

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionDeviceEntryLists;
use app\adminapi\logic\supervision_work\SupervisionDeviceEntryLogic;
use app\adminapi\validate\supervision_work\SupervisionDeviceEntryValidate;
/**
* 工程监理--设备进场控制器
* Class SupervisionDeviceEntryController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionDeviceEntryController extends BaseAdminController
{
/**
* @notes 获取工程监理--设备进场列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function lists()
{
return $this->dataLists(new SupervisionDeviceEntryLists());
}
/**
* @notes 添加工程监理--设备进场
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function add()
{
$params = (new SupervisionDeviceEntryValidate())->post()->goCheck('add');
$result = SupervisionDeviceEntryLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionDeviceEntryLogic::getError());
}
/**
* @notes 编辑工程监理--设备进场
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function edit()
{
$params = (new SupervisionDeviceEntryValidate())->post()->goCheck('edit');
$result = SupervisionDeviceEntryLogic::edit($params,$this->adminId);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionDeviceEntryLogic::getError());
}
/**
* @notes 删除工程监理--设备进场
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function delete()
{
$params = (new SupervisionDeviceEntryValidate())->post()->goCheck('delete');
SupervisionDeviceEntryLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工程监理--设备进场详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function detail()
{
$params = (new SupervisionDeviceEntryValidate())->goCheck('detail');
$result = SupervisionDeviceEntryLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionDeviceEntryDetailLists;
use app\adminapi\logic\supervision_work\SupervisionDeviceEntryDetailLogic;
use app\adminapi\validate\supervision_work\SupervisionDeviceEntryDetailValidate;
/**
* 工程监理--设备进场明细控制器
* Class SupervisionDeviceEntryDetailController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionDeviceEntryDetailController extends BaseAdminController
{
/**
* @notes 获取工程监理--设备进场明细列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function lists()
{
return $this->dataLists(new SupervisionDeviceEntryDetailLists());
}
/**
* @notes 添加工程监理--设备进场明细
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function add()
{
$params = (new SupervisionDeviceEntryDetailValidate())->post()->goCheck('add');
$result = SupervisionDeviceEntryDetailLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionDeviceEntryDetailLogic::getError());
}
/**
* @notes 编辑工程监理--设备进场明细
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function edit()
{
$params = (new SupervisionDeviceEntryDetailValidate())->post()->goCheck('edit');
$result = SupervisionDeviceEntryDetailLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionDeviceEntryDetailLogic::getError());
}
/**
* @notes 删除工程监理--设备进场明细
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function delete()
{
$params = (new SupervisionDeviceEntryDetailValidate())->post()->goCheck('delete');
SupervisionDeviceEntryDetailLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工程监理--设备进场明细详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function detail()
{
$params = (new SupervisionDeviceEntryDetailValidate())->goCheck('detail');
$result = SupervisionDeviceEntryDetailLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionMaterialEntryLists;
use app\adminapi\logic\supervision_work\SupervisionMaterialEntryLogic;
use app\adminapi\validate\supervision_work\SupervisionMaterialEntryValidate;
/**
* 材料进场控制器
* Class SupervisionMaterialEntryController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionMaterialEntryController extends BaseAdminController
{
/**
* @notes 获取材料进场列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function lists()
{
return $this->dataLists(new SupervisionMaterialEntryLists());
}
/**
* @notes 添加材料进场
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function add()
{
$params = (new SupervisionMaterialEntryValidate())->post()->goCheck('add');
$result = SupervisionMaterialEntryLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionMaterialEntryLogic::getError());
}
/**
* @notes 编辑材料进场
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function edit()
{
$params = (new SupervisionMaterialEntryValidate())->post()->goCheck('edit');
$result = SupervisionMaterialEntryLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionMaterialEntryLogic::getError());
}
/**
* @notes 删除材料进场
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function delete()
{
$params = (new SupervisionMaterialEntryValidate())->post()->goCheck('delete');
SupervisionMaterialEntryLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取材料进场详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function detail()
{
$params = (new SupervisionMaterialEntryValidate())->goCheck('detail');
$result = SupervisionMaterialEntryLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller\supervision_work;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\supervision_work\SupervisionMaterialEntryDetailLists;
use app\adminapi\logic\supervision_work\SupervisionMaterialEntryDetailLogic;
use app\adminapi\validate\supervision_work\SupervisionMaterialEntryDetailValidate;
/**
* 工程监理--材料进场明细控制器
* Class SupervisionMaterialEntryDetailController
* @package app\adminapi\controller\supervision_work
*/
class SupervisionMaterialEntryDetailController extends BaseAdminController
{
/**
* @notes 获取工程监理--材料进场明细列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function lists()
{
return $this->dataLists(new SupervisionMaterialEntryDetailLists());
}
/**
* @notes 添加工程监理--材料进场明细
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function add()
{
$params = (new SupervisionMaterialEntryDetailValidate())->post()->goCheck('add');
$result = SupervisionMaterialEntryDetailLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(SupervisionMaterialEntryDetailLogic::getError());
}
/**
* @notes 编辑工程监理--材料进场明细
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function edit()
{
$params = (new SupervisionMaterialEntryDetailValidate())->post()->goCheck('edit');
$result = SupervisionMaterialEntryDetailLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(SupervisionMaterialEntryDetailLogic::getError());
}
/**
* @notes 删除工程监理--材料进场明细
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function delete()
{
$params = (new SupervisionMaterialEntryDetailValidate())->post()->goCheck('delete');
SupervisionMaterialEntryDetailLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取工程监理--材料进场明细详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function detail()
{
$params = (new SupervisionMaterialEntryDetailValidate())->goCheck('detail');
$result = SupervisionMaterialEntryDetailLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\supervision_work\SupervisionDeviceEntryDetail;
use app\common\lists\ListsSearchInterface;
/**
* 工程监理--设备进场明细列表
* Class SupervisionDeviceEntryDetailLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionDeviceEntryDetailLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function setSearch(): array
{
return [
'=' => ['device_entry_id', 'contract_brand', 'documentation', 'verify'],
'%like%' => ['name', 'brand', 'model'],
];
}
/**
* @notes 获取工程监理--设备进场明细列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function lists(): array
{
return SupervisionDeviceEntryDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['contract_brand_text'] = $data->contract_brand_text;
$data['documentation_text'] = $data->documentation_text;
$data['verify_text'] = $data->verify_text;
})
->toArray();
}
/**
* @notes 获取工程监理--设备进场明细数量
* @return int
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function count(): int
{
return SupervisionDeviceEntryDetail::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,91 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\auth\Admin;
use app\common\model\supervision_project\SupervisionParticipatingUnits;
use app\common\model\supervision_project\SupervisionProject;
use app\common\model\supervision_work\SupervisionDeviceEntry;
use app\common\lists\ListsSearchInterface;
use app\common\model\supervision_work\SupervisionProblem;
/**
* 工程监理--设备进场列表
* Class SupervisionDeviceEntryLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionDeviceEntryLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function setSearch(): array
{
return [
'=' => ['project_id', 'enter_result'],
'%like%' => ['code'],
];
}
/**
* @notes 获取工程监理--设备进场列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function lists(): array
{
return SupervisionDeviceEntry::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['enter_result_text'] = $data->enter_result_text;
$data['problem_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',4)->count();
$data['reply_num'] = SupervisionProblem::field('id')->where('data_id',$data['id'])->where('data_type',4)->where('is_rectification',1)->count();
})
->toArray();
}
/**
* @notes 获取工程监理--设备进场数量
* @return int
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function count(): int
{
return SupervisionDeviceEntry::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
use app\common\lists\ListsSearchInterface;
/**
* 工程监理--材料进场明细列表
* Class SupervisionMaterialEntryDetailLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionMaterialEntryDetailLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function setSearch(): array
{
return [
'=' => ['material_entry_id'],
'%like%' => ['name', 'model'],
];
}
/**
* @notes 获取工程监理--材料进场明细列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function lists(): array
{
return SupervisionMaterialEntryDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$data['contract_brand_text'] = $data->contract_brand_text;
})
->toArray();
}
/**
* @notes 获取工程监理--材料进场明细数量
* @return int
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function count(): int
{
return SupervisionMaterialEntryDetail::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,120 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists\supervision_work;
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\lists\ListsSearchInterface;
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
/**
* 材料进场列表
* Class SupervisionMaterialEntryLists
* @package app\adminapi\listssupervision_work
*/
class SupervisionMaterialEntryLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function setSearch(): array
{
return [
'%like%' => ['name', 'model'],
];
}
/**
* @notes 获取材料进场列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function lists(): array
{
$params = $this->request->get();
$where = [];
if(isset($params['project_id']) && $params['project_id'] != ''){
$material_entry_ids = SupervisionMaterialEntry::where('project_id','=',$params['project_id'])->column('id');
$where[] = ['material_entry_id','in',$material_entry_ids];
}
if(isset($params['theme']) && $params['theme'] != ''){
$material_entry_ids = SupervisionMaterialEntry::where('theme','like','%'.$params['theme'].'%')->column('id');
$where[] = ['material_entry_id','in',$material_entry_ids];
}
if(isset($params['code']) && $params['code'] != ''){
$material_entry_ids = SupervisionMaterialEntry::where('code','like','%'.$params['code'].'%')->column('id');
$where[] = ['material_entry_id','in',$material_entry_ids];
}
return SupervisionMaterialEntryDetail::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
$material_entry = SupervisionMaterialEntry::field('project_id,company_id,code,theme,enter_time,enter_result,parallel_test')->where('id',$data['material_entry_id'])->findOrEmpty();
$project = SupervisionProject::field('project_name')->where('id',$material_entry['project_id'])->findOrEmpty();
$company = SupervisionParticipatingUnits::field('unit_name')->where('id',$material_entry['company_id'])->findOrEmpty();
$data['contract_brand_text'] = $data->contract_brand_text;
$data['code'] = $material_entry['code'];
$data['theme'] = $material_entry['theme'];
$data['enter_result'] = $material_entry->enter_result_text;
$data['parallel_test'] = $material_entry['parallel_test'];
$data['parallel_test_text'] = $material_entry->parallel_test_text;
$data['enter_time'] = $material_entry['enter_time'];
$data['project_name'] = $project['project_name'];
$data['company_name'] = $company['unit_name'];
})
->toArray();
}
/**
* @notes 获取材料进场数量
* @return int
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function count(): int
{
$params = $this->request->get();
$where = [];
if(isset($params['project_id']) && $params['project_id'] != ''){
$material_entry_ids = SupervisionMaterialEntry::where('project_id','=',$params['project_id'])->column('id');
$where[] = ['material_entry_id','in',$material_entry_ids];
}
if(isset($params['theme']) && $params['theme'] != ''){
$material_entry_ids = SupervisionMaterialEntry::where('theme','like','%'.$params['theme'].'%')->column('id');
$where[] = ['material_entry_id','in',$material_entry_ids];
}
if(isset($params['code']) && $params['code'] != ''){
$material_entry_ids = SupervisionMaterialEntry::where('code','like','%'.$params['code'].'%')->column('id');
$where[] = ['material_entry_id','in',$material_entry_ids];
}
return SupervisionMaterialEntryDetail::where($this->searchWhere)->where($where)->count();
}
}

View File

@ -0,0 +1,125 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\supervision_work\SupervisionDeviceEntryDetail;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 工程监理--设备进场明细逻辑
* Class SupervisionDeviceEntryDetailLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionDeviceEntryDetailLogic extends BaseLogic
{
/**
* @notes 添加工程监理--设备进场明细
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/28 16:12
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
SupervisionDeviceEntryDetail::create([
'device_entry_id' => $params['device_entry_id'],
'name' => $params['name'],
'brand' => $params['brand'],
'model' => $params['model'],
'unit' => $params['unit'],
'contract_brand' => $params['contract_brand'],
'entry_number' => $params['entry_number'],
'documentation' => $params['documentation'],
'verify' => $params['verify']
]);
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/28 16:12
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SupervisionDeviceEntryDetail::where('id', $params['id'])->update([
'device_entry_id' => $params['device_entry_id'],
'name' => $params['name'],
'brand' => $params['brand'],
'model' => $params['model'],
'unit' => $params['unit'],
'contract_brand' => $params['contract_brand'],
'entry_number' => $params['entry_number'],
'documentation' => $params['documentation'],
'verify' => $params['verify'],
'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/28 16:12
*/
public static function delete(array $params): bool
{
return SupervisionDeviceEntryDetail::destroy($params['id']);
}
/**
* @notes 获取工程监理--设备进场明细详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/28 16:12
*/
public static function detail($params): array
{
$data = SupervisionDeviceEntryDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$data['contract_brand_text'] = $data->contract_brand_text;
$data['documentation_text'] = $data->documentation_text;
$data['verify_text'] = $data->verify_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,220 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\auth\Admin;
use app\common\model\supervision_project\SupervisionParticipatingUnits;
use app\common\model\supervision_project\SupervisionProject;
use app\common\model\supervision_work\SupervisionDeviceEntry;
use app\common\logic\BaseLogic;
use app\common\model\supervision_work\SupervisionDeviceEntryDetail;
use app\common\model\supervision_work\SupervisionProblem;
use think\facade\Db;
/**
* 工程监理--设备进场逻辑
* Class SupervisionDeviceEntryLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionDeviceEntryLogic extends BaseLogic
{
/**
* @notes 添加工程监理--设备进场
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/28 16:12
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
$res = SupervisionDeviceEntry::create([
'project_id' => $params['project_id'],
'code' => data_unique_code('SBJC'),
'enter_time' => !empty($params['enter_time']) ? strtotime($params['enter_time']) : 0,
'company_id' => $params['company_id'],
'enter_result' => $params['enter_result'],
'co_participant' => $params['co_participant'],
'remark' => $params['remark'],
'create_user' => $admin_id
]);
if(!empty($params['entry_detail'])){
foreach($params['entry_detail'] as $v){
SupervisionDeviceEntryDetail::create([
'device_entry_id' => $res->id,
'name' => $v['name'],
'brand' => $v['brand'],
'model' => $v['model'],
'unit' => $v['unit'],
'contract_brand' => $v['contract_brand'],
'entry_number' => $v['entry_number'],
'documentation' => $v['documentation'],
'verify' => $v['verify']
]);
}
}
if(!empty($params['entry_problem'])){
foreach($params['entry_problem'] as $v){
SupervisionProblem::create([
'data_id' => $res->id,
'data_type' => 4,
'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/28 16:12
*/
public static function edit(array $params,$admin_id): bool
{
Db::startTrans();
try {
SupervisionDeviceEntry::where('id', $params['id'])->update([
'project_id' => $params['project_id'],
'enter_time' => !empty($params['enter_time']) ? strtotime($params['enter_time']) : 0,
'company_id' => $params['company_id'],
'enter_result' => $params['enter_result'],
'co_participant' => $params['co_participant'],
'remark' => $params['remark'],
'update_time' => time()
]);
if(!empty($params['entry_detail'])){
foreach($params['entry_detail'] as $v){
if(!empty($v['id'])){
SupervisionDeviceEntryDetail::where('id',$v['id'])->update([
'device_entry_id' => $params['id'],
'name' => $v['name'],
'brand' => $v['brand'],
'model' => $v['model'],
'unit' => $v['unit'],
'contract_brand' => $v['contract_brand'],
'entry_number' => $v['entry_number'],
'documentation' => $v['documentation'],
'verify' => $v['verify'],
'update_time' => time()
]);
}else{
SupervisionDeviceEntryDetail::create([
'device_entry_id' => $params['id'],
'name' => $v['name'],
'brand' => $v['brand'],
'model' => $v['model'],
'unit' => $v['unit'],
'contract_brand' => $v['contract_brand'],
'entry_number' => $v['entry_number'],
'documentation' => $v['documentation'],
'verify' => $v['verify']
]);
}
}
}
if(!empty($params['entry_problem'])){
foreach($params['entry_problem'] as $v){
if(!empty($v['id'])){
SupervisionProblem::where('id',$v['id'])->update([
'data_id' => $params['id'],
'data_type' => 4,
'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' => 4,
'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/28 16:12
*/
public static function delete(array $params): bool
{
$entry_detail = SupervisionDeviceEntryDetail::where('device_entry_id',$params['id'])->findOrEmpty();
if(!$entry_detail->isEmpty()){
self::setError('该内容下存在设备信息数据,请先删除设备信息数据');
return false;
}
$entry_problem = SupervisionProblem::where('data_id',$params['id'])->where('data_type',4)->findOrEmpty();
if(!$entry_problem->isEmpty()){
self::setError('该内容下存在设备问题数据,请先删除设备问题数据');
return false;
}
return SupervisionDeviceEntry::destroy($params['id']);
}
/**
* @notes 获取工程监理--设备进场详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/28 16:12
*/
public static function detail($params): array
{
$data = SupervisionDeviceEntry::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['enter_result_text'] = $data->enter_result_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* 工程监理--材料进场明细逻辑
* Class SupervisionMaterialEntryDetailLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionMaterialEntryDetailLogic extends BaseLogic
{
/**
* @notes 添加工程监理--材料进场明细
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/28 13:41
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
SupervisionMaterialEntryDetail::create([
'material_entry_id' => $params['material_entry_id'],
'name' => $params['name'],
'brand' => $params['brand'],
'model' => $params['model'],
'unit' => $params['unit'],
'contract_brand' => $params['contract_brand'],
'entry_number' => $params['entry_number']
]);
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/28 13:41
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SupervisionMaterialEntryDetail::where('id', $params['id'])->update([
'material_entry_id' => $params['material_entry_id'],
'name' => $params['name'],
'brand' => $params['brand'],
'model' => $params['model'],
'unit' => $params['unit'],
'contract_brand' => $params['contract_brand'],
'entry_number' => $params['entry_number'],
'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/28 13:41
*/
public static function delete(array $params): bool
{
return SupervisionMaterialEntryDetail::destroy($params['id']);
}
/**
* @notes 获取工程监理--材料进场明细详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/28 13:41
*/
public static function detail($params): array
{
$data = SupervisionMaterialEntryDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']);
$data['contract_brand_text'] = $data->contract_brand_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,172 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic\supervision_work;
use app\common\model\auth\Admin;
use app\common\model\supervision_work\SupervisionMaterialEntry;
use app\common\logic\BaseLogic;
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
use think\facade\Db;
/**
* 材料进场逻辑
* Class SupervisionMaterialEntryLogic
* @package app\adminapi\logic\supervision_work
*/
class SupervisionMaterialEntryLogic extends BaseLogic
{
/**
* @notes 添加材料进场
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/28 13:41
*/
public static function add(array $params,$admin_id): bool
{
Db::startTrans();
try {
$res = SupervisionMaterialEntry::create([
'project_id' => $params['project_id'],
'company_id' => $params['company_id'],
'theme' => $params['theme'],
'code' => data_unique_code('CLJC'),
'enter_time' => !empty($params['enter_time']) ? strtotime($params['enter_time']) : 0,
'co_participant' => $params['co_participant'],
'enter_result' => $params['enter_result'],
'parallel_test' => $params['parallel_test'],
'remark' => $params['remark'],
'create_user' => $admin_id,
]);
if(!empty($params['entry_detail'])){
foreach($params['entry_detail'] as $v) {
SupervisionMaterialEntryDetail::create([
'material_entry_id' => $res->id,
'name' => $v['name'],
'brand' => $v['brand'],
'model' => $v['model'],
'unit' => $v['unit'],
'contract_brand' => $v['contract_brand'],
'entry_number' => $v['entry_number']
]);
}
}
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/28 13:41
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
SupervisionMaterialEntry::where('id', $params['id'])->update([
'project_id' => $params['project_id'],
'company_id' => $params['company_id'],
'theme' => $params['theme'],
'enter_time' => !empty($params['enter_time']) ? strtotime($params['enter_time']) : 0,
'co_participant' => $params['co_participant'],
'enter_result' => $params['enter_result'],
'parallel_test' => $params['parallel_test'],
'remark' => $params['remark'],
'update_time' => time(),
]);
if(!empty($params['entry_detail'])){
foreach($params['entry_detail'] as $v) {
if(!empty($v['id'])){
SupervisionMaterialEntryDetail::where('id',$v['id'])->update([
'material_entry_id' => $params['id'],
'name' => $v['name'],
'brand' => $v['brand'],
'model' => $v['model'],
'unit' => $v['unit'],
'contract_brand' => $v['contract_brand'],
'entry_number' => $v['entry_number'],
'update_time' => time()
]);
}else{
SupervisionMaterialEntryDetail::create([
'material_entry_id' => $params['id'],
'name' => $v['name'],
'brand' => $v['brand'],
'model' => $v['model'],
'unit' => $v['unit'],
'contract_brand' => $v['contract_brand'],
'entry_number' => $v['entry_number']
]);
}
}
}
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/28 13:41
*/
public static function delete(array $params): bool
{
$entry_detail = SupervisionMaterialEntryDetail::where('material_entry_id',$params['id'])->findOrEmpty();
if(!$entry_detail->isEmpty()){
self::setError('当前数据下存在材料信息记录,请先删除材料信息记录');
return false;
}
return SupervisionMaterialEntry::destroy($params['id']);
}
/**
* @notes 获取材料进场详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/28 13:41
*/
public static function detail($params): array
{
$data = SupervisionMaterialEntry::withoutField('update_time,delete_time')->findOrEmpty($params['id']);
$create_user = Admin::field('name')->where('id',$data['create_user'])->findOrEmpty();
$data['create_user_name'] = $create_user['name'];
$data['enter_result_text'] = $data->enter_result_text;
$data['parallel_test_text'] = $data->parallel_test_text;
return $data->toArray();
}
}

View File

@ -0,0 +1,132 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
use app\common\model\supervision_work\SupervisionDeviceEntry;
use app\common\model\supervision_work\SupervisionDeviceEntryDetail;
use app\common\validate\BaseValidate;
/**
* 工程监理--设备进场明细验证器
* Class SupervisionDeviceEntryDetailValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionDeviceEntryDetailValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'device_entry_id' => 'require|checkDeviceEntry',
'name' => 'require',
'brand' => 'require',
'model' => 'require',
'unit' => 'require',
'contract_brand' => 'require|in:0,1',
'entry_number' => 'require|float',
'documentation' => 'require|in:0,1',
'verify' => 'require|in:0,1',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'device_entry_id' => '设备进场id',
'name' => '设备名称',
'brand' => '设备品牌',
'model' => '设备型号',
'unit' => '计数单位',
'contract_brand' => '合同约定品牌',
'entry_number' => '进场数量',
'documentation' => '证明文件是否齐全',
'verify' => '核对是否一致',
];
/**
* @notes 添加场景
* @return SupervisionDeviceEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneAdd()
{
return $this->only(['device_entry_id','name','brand','model','unit','contract_brand','entry_number','documentation','verify']);
}
/**
* @notes 编辑场景
* @return SupervisionDeviceEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneEdit()
{
return $this->only(['id','device_entry_id','name','brand','model','unit','contract_brand','entry_number','documentation','verify']);
}
/**
* @notes 删除场景
* @return SupervisionDeviceEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionDeviceEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionDeviceEntryDetail::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkDeviceEntry($value): bool|string
{
$data = SupervisionDeviceEntry::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '设备进场信息不存在';
}
return true;
}
}

View File

@ -0,0 +1,201 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
use app\common\model\dict\DictData;
use app\common\model\supervision_project\SupervisionParticipatingUnits;
use app\common\model\supervision_project\SupervisionProject;
use app\common\model\supervision_work\SupervisionDeviceEntry;
use app\common\model\supervision_work\SupervisionDeviceEntryDetail;
use app\common\model\supervision_work\SupervisionProblem;
use app\common\validate\BaseValidate;
/**
* 工程监理--设备进场验证器
* Class SupervisionDeviceEntryValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionDeviceEntryValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'project_id' => 'require|checkProject',
'enter_time' => 'require|dateFormat:Y-m-d H:i:s',
'company_id' => 'checkCompany',
'enter_result' => 'require|in:0,1',
'entry_detail' => 'checkEntryDetail',
'entry_problem' => 'checkEntryProblem'
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'project_id' => '项目id',
'code' => '编号',
'enter_time' => '进场时间',
'company_id' => '施工单位',
'enter_result' => '进场结果',
'co_participant' => '共同参与人',
'remark' => '备注',
'create_user' => '操作人',
];
/**
* @notes 添加场景
* @return SupervisionDeviceEntryValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneAdd()
{
return $this->remove('id',true);
}
/**
* @notes 编辑场景
* @return SupervisionDeviceEntryValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneEdit()
{}
/**
* @notes 删除场景
* @return SupervisionDeviceEntryValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionDeviceEntryValidate
* @author likeadmin
* @date 2024/02/28 16:12
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionDeviceEntry::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 checkEntryDetail($value): bool|string
{
if(!isset($value) || $value == '') return true;
if(!is_array($value)) return '设备信息数据格式错误';
foreach($value as $k=>$v){
if(!empty($v['id'])){
$data = SupervisionDeviceEntryDetail::where('id',$v['id'])->findOrEmpty();
if($data->isEmpty()){
return '设备信息列表第'.($k+1).'行数据不存在';
}
}
if(empty($v['name'])) return '设备信息列表第'.($k+1).'行设备名称为空';
if(empty($v['brand'])) return '设备信息列表第'.($k+1).'行设备品牌为空';
if(empty($v['model'])) return '设备信息列表第'.($k+1).'行设备型号为空';
if(empty($v['unit'])) return '设备信息列表第'.($k+1).'行计数单位为空';
if(!isset($v['contract_brand']) || $v['contract_brand'] == ''){
return '设备信息列表第'.($k+1).'行是否合同约定品牌为空';
}else{
if(!in_array($v['contract_brand'],[0,1])) return '设备信息列表第'.($k+1).'行是否合同约定品牌选项数据值无效';
}
if(empty($v['entry_number'])){
return '设备信息列表第'.($k+1).'行进场数量为空';
}else{
if(!is_numeric($v['entry_number'])) return '设备信息列表第'.($k+1).'行进场数量必须是数字';
}
if(!isset($v['documentation']) || $v['documentation'] == ''){
return '设备信息列表第'.($k+1).'行证明文件是否齐全为空';
}else{
if(!in_array($v['documentation'],[0,1])) return '设备信息列表第'.($k+1).'行证明文件是否齐全选项数据值无效';
}
if(!isset($v['verify']) || $v['verify'] == ''){
return '设备信息列表第'.($k+1).'行核对是否一致选项为空';
}else{
if(!in_array($v['verify'],[0,1])) return '设备信息列表第'.($k+1).'行核对是否一致项数据值无效';
}
}
return true;
}
public function checkEntryProblem($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;
}
}

View File

@ -0,0 +1,128 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
use app\common\model\supervision_work\SupervisionMaterialEntry;
use app\common\model\supervision_work\SupervisionMaterialEntryDetail;
use app\common\validate\BaseValidate;
/**
* 工程监理--材料进场明细验证器
* Class SupervisionMaterialEntryDetailValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionMaterialEntryDetailValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'material_entry_id' => 'require|checkMaterialEntry',
'name' => 'require',
'brand' => 'require',
'model' => 'require',
'unit' => 'require',
'contract_brand' => 'require|in:0,1',
'entry_number' => 'require|float',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'material_entry_id' => '材料进场id',
'name' => '材料名称',
'brand' => '材料品牌',
'model' => '材料型号',
'unit' => '计数单位',
'contract_brand' => '合同约定品牌',
'entry_number' => '进场数量',
];
/**
* @notes 添加场景
* @return SupervisionMaterialEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneAdd()
{
return $this->only(['material_entry_id','name','brand','model','unit','contract_brand','entry_number']);
}
/**
* @notes 编辑场景
* @return SupervisionMaterialEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneEdit()
{
return $this->only(['id','material_entry_id','name','brand','model','unit','contract_brand','entry_number']);
}
/**
* @notes 删除场景
* @return SupervisionMaterialEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionMaterialEntryDetailValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionMaterialEntryDetail::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '数据不存在';
}
return true;
}
public function checkMaterialEntry($value): bool|string
{
$data = SupervisionMaterialEntry::where('id',$value)->findOrEmpty();
if($data->isEmpty()){
return '材料进场信息不存在';
}
return true;
}
}

View File

@ -0,0 +1,169 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate\supervision_work;
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\validate\BaseValidate;
/**
* 材料进场验证器
* Class SupervisionMaterialEntryValidate
* @package app\adminapi\validate\supervision_work
*/
class SupervisionMaterialEntryValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require|checkData',
'project_id' => 'require|checkProject',
'company_id' => 'checkCompany',
'theme' => 'require',
'enter_time' => 'require|dateFormat:Y-m-d H:i:s',
'enter_result' => 'require|in:0,1,2',
'parallel_test' => 'require|in:0,1',
'entry_detail' => 'checkEntryDetail',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'project_id' => '项目id',
'company_id' => '采购单位id',
'theme' => '进场主题',
'code' => '编号',
'enter_time' => '进场时间',
'co_participant' => '共同参与人',
'enter_result' => '进场结果',
'parallel_test' => '是否平行检验',
'remark' => '备注',
'create_user' => '创建人',
];
/**
* @notes 添加场景
* @return SupervisionMaterialEntryValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneAdd()
{
return $this->remove('id',true);
}
/**
* @notes 编辑场景
* @return SupervisionMaterialEntryValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneEdit()
{}
/**
* @notes 删除场景
* @return SupervisionMaterialEntryValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return SupervisionMaterialEntryValidate
* @author likeadmin
* @date 2024/02/28 13:41
*/
public function sceneDetail()
{
return $this->only(['id']);
}
public function checkData($value): bool|string
{
$data = SupervisionMaterialEntry::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 checkEntryDetail($value): bool|string
{
if(!isset($value) || $value == '') return true;
if(!is_array($value)) return '材料信息数据格式错误';
foreach($value as $k=>$v){
if(!empty($v['id'])){
$data = SupervisionMaterialEntryDetail::where('id',$v['id'])->findOrEmpty();
if($data->isEmpty()){
return '材料信息列表第'.($k+1).'行数据不存在';
}
}
if(empty($v['name'])) return '材料信息列表第'.($k+1).'行材料名称为空';
if(empty($v['brand'])) return '材料信息列表第'.($k+1).'行材料品牌为空';
if(empty($v['model'])) return '材料信息列表第'.($k+1).'行材料型号为空';
if(empty($v['unit'])) return '材料信息列表第'.($k+1).'行计数单位为空';
if(!isset($v['contract_brand']) || $v['contract_brand'] == ''){
return '材料信息列表第'.($k+1).'行是否合同约定品牌为空';
}else{
if(!in_array($v['contract_brand'],[0,1])) return '材料信息列表第'.($k+1).'行是否合同约定品牌选项数据值无效';
}
if(empty($v['entry_number'])){
return '材料信息列表第'.($k+1).'行进场数量为空';
}else{
if(!is_numeric($v['entry_number'])) return '材料信息列表第'.($k+1).'行进场数量必须是数字';
}
}
return true;
}
}

View File

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工程监理--设备进场模型
* Class SupervisionDeviceEntry
* @package app\common\model\supervision_work
*/
class SupervisionDeviceEntry extends BaseModel
{
use SoftDelete;
protected $name = 'supervision_device_entry';
protected $deleteTime = 'delete_time';
public function getEnterTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i:s',$value) : '';
}
public function getEnterResultTextAttr($value,$data): string
{
$arr = [0=>'进场', 1=>'退场'];
return $arr[$data['enter_result']];
}
}

View File

@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 工程监理--设备进场明细模型
* Class SupervisionDeviceEntryDetail
* @package app\common\model\supervision_work
*/
class SupervisionDeviceEntryDetail extends BaseModel
{
use SoftDelete;
protected $name = 'supervision_device_entry_detail';
protected $deleteTime = 'delete_time';
public function getContractBrandTextAttr($value,$data): string
{
$arr = [0=>'否', 1=>'是'];
return $arr[$data['contract_brand']];
}
public function getDocumentationTextAttr($value,$data): string
{
$arr = [0=>'否', 1=>'是'];
return $arr[$data['documentation']];
}
public function getVerifyTextAttr($value,$data): string
{
$arr = [0=>'否', 1=>'是'];
return $arr[$data['verify']];
}
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 材料进场模型
* Class SupervisionMaterialEntry
* @package app\common\model\supervision_work
*/
class SupervisionMaterialEntry extends BaseModel
{
use SoftDelete;
protected $name = 'supervision_material_entry';
protected $deleteTime = 'delete_time';
public function getEnterTimeAttr($value): string
{
return !empty($value) ? date('Y-m-d H:i:s',$value) : '';
}
public function getEnterResultTextAttr($value,$data): string
{
$arr = [0=>'进场', 1=>'进场后复检', 2=>'退检'];
return $arr[$data['enter_result']];
}
public function getParallelTestTextAttr($value,$data): string
{
$arr = [0=>'否', 1=>'是'];
return $arr[$data['parallel_test']];
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\supervision_work;
use app\common\model\BaseModel;
/**
* 工程监理--材料进场明细模型
* Class SupervisionMaterialEntryDetail
* @package app\common\model\supervision_work
*/
class SupervisionMaterialEntryDetail extends BaseModel
{
protected $name = 'supervision_material_entry_detail';
public function getContractBrandTextAttr($value,$data): string
{
$arr = [0=>'否', 1=>'是'];
return $arr[$data['contract_brand']];
}
}