BuildPlan
This commit is contained in:
parent
0d1956476c
commit
4fc161559c
108
app/adminapi/controller/build/BuildPlanController.php
Normal file
108
app/adminapi/controller/build/BuildPlanController.php
Normal 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\build;
|
||||||
|
|
||||||
|
|
||||||
|
use app\adminapi\controller\BaseAdminController;
|
||||||
|
use app\adminapi\lists\build\BuildPlanLists;
|
||||||
|
use app\adminapi\logic\build\BuildPlanLogic;
|
||||||
|
use app\adminapi\validate\build\BuildPlanValidate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工计划控制器
|
||||||
|
* Class BuildPlanController
|
||||||
|
* @package app\adminapi\controller\build
|
||||||
|
*/
|
||||||
|
class BuildPlanController extends BaseAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取施工计划列表
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
return $this->dataLists(new BuildPlanLists());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加施工计划
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$params = (new BuildPlanValidate())->post()->goCheck('add');
|
||||||
|
$result = BuildPlanLogic::add($params);
|
||||||
|
if (true === $result) {
|
||||||
|
return $this->success('添加成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(BuildPlanLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑施工计划
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$params = (new BuildPlanValidate())->post()->goCheck('edit');
|
||||||
|
$result = BuildPlanLogic::edit($params);
|
||||||
|
if (true === $result) {
|
||||||
|
return $this->success('编辑成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(BuildPlanLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除施工计划
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$params = (new BuildPlanValidate())->post()->goCheck('delete');
|
||||||
|
BuildPlanLogic::delete($params);
|
||||||
|
return $this->success('删除成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取施工计划详情
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function detail()
|
||||||
|
{
|
||||||
|
$params = (new BuildPlanValidate())->goCheck('detail');
|
||||||
|
$result = BuildPlanLogic::detail($params);
|
||||||
|
return $this->data($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -20,6 +20,10 @@ use app\adminapi\controller\BaseAdminController;
|
|||||||
use app\adminapi\lists\project\ProjectMemberLists;
|
use app\adminapi\lists\project\ProjectMemberLists;
|
||||||
use app\adminapi\logic\project\ProjectMemberLogic;
|
use app\adminapi\logic\project\ProjectMemberLogic;
|
||||||
use app\adminapi\validate\project\ProjectMemberValidate;
|
use app\adminapi\validate\project\ProjectMemberValidate;
|
||||||
|
use app\common\model\auth\Admin;
|
||||||
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectMember;
|
||||||
|
use app\common\model\project\ProjectRoleSet;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,5 +108,39 @@ class ProjectMemberController extends BaseAdminController
|
|||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取某个项目下的所有成员
|
||||||
|
public function listToProject(): \think\response\Json
|
||||||
|
{
|
||||||
|
$params = $this->request->get(['project_id','page_size','page_no']);
|
||||||
|
if(empty($params['project_id'])){
|
||||||
|
return $this->fail('参数错误');
|
||||||
|
}
|
||||||
|
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
||||||
|
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
||||||
|
$data = ProjectMember::where('project_id',$params['project_id'])
|
||||||
|
->field(['id', 'project_id', 'project_role_id', 'admin_id', 'working_unit_price', 'remark'])
|
||||||
|
->page($pageNo, $pageSize)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function($item){
|
||||||
|
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||||
|
$role = ProjectRoleSet::field('name')->where('id',$item['project_role_id'])->findOrEmpty();
|
||||||
|
$admin = Admin::field('name')->where('id',$item['admin_id'])->findOrEmpty();
|
||||||
|
$item['project_name'] = $project['name'];
|
||||||
|
$item['project_code'] = $project['project_code'];
|
||||||
|
$item['project_role_name'] = $role['name'];
|
||||||
|
$item['admin_name'] = $admin['name'];
|
||||||
|
return $item;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
$count = ProjectMember::field(['id', 'project_id', 'project_role_id', 'admin_id', 'working_unit_price', 'remark'])->where('project_id',$params['project_id'])->count();
|
||||||
|
$result = [
|
||||||
|
'count' => $count,
|
||||||
|
'page_no' => $pageNo,
|
||||||
|
'page_size' => $pageSize,
|
||||||
|
'lists' => $data
|
||||||
|
];
|
||||||
|
return $this->success('请求成功',$result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
98
app/adminapi/lists/build/BuildPlanLists.php
Normal file
98
app/adminapi/lists/build/BuildPlanLists.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?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\build;
|
||||||
|
|
||||||
|
|
||||||
|
use app\adminapi\lists\BaseAdminDataLists;
|
||||||
|
use app\common\model\auth\Admin;
|
||||||
|
use app\common\model\build\BuildDivision;
|
||||||
|
use app\common\model\build\BuildPlan;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\build\BuildProcessSettings;
|
||||||
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectMember;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工计划列表
|
||||||
|
* Class BuildPlanLists
|
||||||
|
* @package app\adminapi\listsbuild
|
||||||
|
*/
|
||||||
|
class BuildPlanLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['zy_code', 'plan_start_date', 'plan_end_date', 'work_user'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取施工计划列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
return BuildPlan::where($this->searchWhere)
|
||||||
|
->field(['id', 'project_id', 'process_id', 'project_member_id', 'zy_code', 'plan_start_date', 'plan_end_date', 'work_user', 'work_content', 'workload', 'unit', 'price', 'amount'])
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function($item){
|
||||||
|
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||||
|
$process = BuildProcessSettings::field('division_id,process_step_no,process_step,quality_control_points,file')->where('id',$item['process_id'])->findOrEmpty();
|
||||||
|
$division = BuildDivision::field('subentry_engineering,subentry_engineering_code')->where('id',$process['division_id'])->findOrEmpty();
|
||||||
|
$projectMember = ProjectMember::field('admin_id')->where('id',$item['project_member_id'])->findOrEmpty();
|
||||||
|
$admin = Admin::field('name')->where('id',$projectMember['admin_id'])->findOrEmpty();
|
||||||
|
$item['project_name'] = $project['name'];
|
||||||
|
$item['project_code'] = $project['project_code'];
|
||||||
|
$item['subentry_engineering'] = $division['subentry_engineering'];
|
||||||
|
$item['subentry_engineering_code'] = $division['subentry_engineering_code'];
|
||||||
|
$item['process_step_no'] = $process['process_step_no'];
|
||||||
|
$item['process_step'] = $process['process_step'];
|
||||||
|
$item['quality_control_points'] = $process['quality_control_points'];
|
||||||
|
$item['file'] = $process['file'];
|
||||||
|
$item['project_member_name'] = $admin['name'];
|
||||||
|
return $item;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取施工计划数量
|
||||||
|
* @return int
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return BuildPlan::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
146
app/adminapi/logic/build/BuildPlanLogic.php
Normal file
146
app/adminapi/logic/build/BuildPlanLogic.php
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<?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\build;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\auth\Admin;
|
||||||
|
use app\common\model\build\BuildDivision;
|
||||||
|
use app\common\model\build\BuildPlan;
|
||||||
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\model\build\BuildProcessSettings;
|
||||||
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectMember;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工计划逻辑
|
||||||
|
* Class BuildPlanLogic
|
||||||
|
* @package app\adminapi\logic\build
|
||||||
|
*/
|
||||||
|
class BuildPlanLogic extends BaseLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加施工计划
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public static function add(array $params): bool
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
BuildPlan::create([
|
||||||
|
'project_id' => $params['project_id'],
|
||||||
|
'process_id' => $params['process_id'],
|
||||||
|
'project_member_id' => $params['project_member_id'],
|
||||||
|
'zy_code' => zy_code(),
|
||||||
|
'plan_start_date' => strtotime($params['plan_start_date']),
|
||||||
|
'plan_end_date' => strtotime($params['plan_end_date']),
|
||||||
|
'work_user' => $params['work_user'],
|
||||||
|
'work_content' => $params['work_content'],
|
||||||
|
'workload' => $params['workload'],
|
||||||
|
'unit' => $params['unit'],
|
||||||
|
'price' => $params['price'],
|
||||||
|
'amount' => $params['amount'],
|
||||||
|
]);
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
self::setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑施工计划
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public static function edit(array $params): bool
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
BuildPlan::where('id', $params['id'])->update([
|
||||||
|
'project_id' => $params['project_id'],
|
||||||
|
'process_id' => $params['process_id'],
|
||||||
|
'project_member_id' => $params['project_member_id'],
|
||||||
|
'plan_start_date' => strtotime($params['plan_start_date']),
|
||||||
|
'plan_end_date' => strtotime($params['plan_end_date']),
|
||||||
|
'work_user' => $params['work_user'],
|
||||||
|
'work_content' => $params['work_content'],
|
||||||
|
'workload' => $params['workload'],
|
||||||
|
'unit' => $params['unit'],
|
||||||
|
'price' => $params['price'],
|
||||||
|
'amount' => $params['amount'],
|
||||||
|
]);
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
self::setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除施工计划
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public static function delete(array $params): bool
|
||||||
|
{
|
||||||
|
return BuildPlan::destroy($params['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取施工计划详情
|
||||||
|
* @param $params
|
||||||
|
* @return array
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public static function detail($params): array
|
||||||
|
{
|
||||||
|
$data = BuildPlan::findOrEmpty($params['id'])->toArray();
|
||||||
|
if(empty($data)) return [];
|
||||||
|
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||||
|
$process = BuildProcessSettings::field('division_id,process_step_no,process_step,quality_control_points,file')->where('id',$data['process_id'])->findOrEmpty();
|
||||||
|
$division = BuildDivision::field('subentry_engineering,subentry_engineering_code')->where('id',$process['division_id'])->findOrEmpty();
|
||||||
|
$projectMember = ProjectMember::field('admin_id')->where('id',$data['project_member_id'])->findOrEmpty();
|
||||||
|
$admin = Admin::field('name')->where('id',$projectMember['admin_id'])->findOrEmpty();
|
||||||
|
$data['project_name'] = $project['name'];
|
||||||
|
$data['project_code'] = $project['project_code'];
|
||||||
|
$data['subentry_engineering'] = $division['subentry_engineering'];
|
||||||
|
$data['subentry_engineering_code'] = $division['subentry_engineering_code'];
|
||||||
|
$data['process_step_no'] = $process['process_step_no'];
|
||||||
|
$data['process_step'] = $process['process_step'];
|
||||||
|
$data['quality_control_points'] = $process['quality_control_points'];
|
||||||
|
$data['file'] = $process['file'];
|
||||||
|
$data['project_member_name'] = $admin['name'];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
165
app/adminapi/validate/build/BuildPlanValidate.php
Normal file
165
app/adminapi/validate/build/BuildPlanValidate.php
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?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\build;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\build\BuildProcessSettings;
|
||||||
|
use app\common\model\project\Project;
|
||||||
|
use app\common\model\project\ProjectMember;
|
||||||
|
use app\common\validate\BaseValidate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工计划验证器
|
||||||
|
* Class BuildPlanValidate
|
||||||
|
* @package app\adminapi\validate\build
|
||||||
|
*/
|
||||||
|
class BuildPlanValidate extends BaseValidate
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置校验规则
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $rule = [
|
||||||
|
'id' => 'require',
|
||||||
|
'project_id' => 'require|checkProject',
|
||||||
|
'process_id' => 'require|checkProcess',
|
||||||
|
'project_member_id' => 'require|checkMember',
|
||||||
|
'plan_start_date' => 'require|dateFormat:Y-m-d',
|
||||||
|
'plan_end_date' => 'require|dateFormat:Y-m-d',
|
||||||
|
'workload' => 'require|integer|egt:0',
|
||||||
|
'unit' => 'require',
|
||||||
|
'price' => 'require|float|egt:0',
|
||||||
|
'amount' => 'require|float|egt:0',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $message = [
|
||||||
|
'id.require' => '缺少必要参数',
|
||||||
|
'project_id.require' => '请选择项目',
|
||||||
|
'process_id.require' => '请选择工序步骤',
|
||||||
|
'project_member_id.require' => '请选择班组长',
|
||||||
|
'plan_start_date.require' => '请选择计划开始日期',
|
||||||
|
'plan_start_date.dateFormat' => '计划开始日期格式错误',
|
||||||
|
'plan_end_date.require' => '请选择计划结束日期',
|
||||||
|
'plan_end_date.dateFormat' => '计划结束日期格式错误',
|
||||||
|
'workload.require' => '请填写作业量',
|
||||||
|
'workload.integer' => '作业量值必须是整数',
|
||||||
|
'workload.egt' => '作业量值必须大于等于0',
|
||||||
|
'unit.require' => '请填写单位',
|
||||||
|
'price.require' => '请填写单价',
|
||||||
|
'price.float' => '单价值必须是数字',
|
||||||
|
'price.egt' => '单价值必须大于等于0',
|
||||||
|
'amount.require' => '请填写金额',
|
||||||
|
'amount.float' => '金额值必须是数字',
|
||||||
|
'amount.egt' => '金额值必须大于等于0',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数描述
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $field = [
|
||||||
|
'id' => 'id',
|
||||||
|
'project_id' => '项目id',
|
||||||
|
'process_id' => '工序id',
|
||||||
|
'project_member_id' => '项目成员id',
|
||||||
|
'zy_code' => '作业编码',
|
||||||
|
'plan_start_date' => '计划开始日期',
|
||||||
|
'plan_end_date' => '计划结束日期',
|
||||||
|
'workload' => '作业量',
|
||||||
|
'unit' => '单位',
|
||||||
|
'price' => '单价',
|
||||||
|
'amount' => '金额',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加场景
|
||||||
|
* @return BuildPlanValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function sceneAdd()
|
||||||
|
{
|
||||||
|
return $this->remove('id',true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑场景
|
||||||
|
* @return BuildPlanValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function sceneEdit()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除场景
|
||||||
|
* @return BuildPlanValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function sceneDelete()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 详情场景
|
||||||
|
* @return BuildPlanValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/12/22 11:04
|
||||||
|
*/
|
||||||
|
public function sceneDetail()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkProject($value): bool|string
|
||||||
|
{
|
||||||
|
$data = Project::where('id',$value)->findOrEmpty();
|
||||||
|
if($data->isEmpty()){
|
||||||
|
return '项目不存在';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkProcess($value): bool|string
|
||||||
|
{
|
||||||
|
$data = BuildProcessSettings::where('id',$value)->findOrEmpty();
|
||||||
|
if($data->isEmpty()){
|
||||||
|
return '工序步骤不存在';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkMember($value,$rule,$data): bool|string
|
||||||
|
{
|
||||||
|
$member = ProjectMember::where('id',$value)->findOrEmpty();
|
||||||
|
if($member->isEmpty()){
|
||||||
|
return '班组长不存在';
|
||||||
|
}
|
||||||
|
if($member['project_id'] != $data['project_id']){
|
||||||
|
return '班组长无效';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -338,3 +338,8 @@ function document_code(): string
|
|||||||
{
|
{
|
||||||
return 'D'.date('Ymd',time()).'-'.mt_rand(100000, 999999);
|
return 'D'.date('Ymd',time()).'-'.mt_rand(100000, 999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function zy_code(): string
|
||||||
|
{
|
||||||
|
return 'ZY'.date('Ymd',time()).'-'.mt_rand(100000, 999999);
|
||||||
|
}
|
||||||
|
42
app/common/model/build/BuildPlan.php
Normal file
42
app/common/model/build/BuildPlan.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?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\build;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工计划模型
|
||||||
|
* Class BuildPlan
|
||||||
|
* @package app\common\model\build
|
||||||
|
*/
|
||||||
|
class BuildPlan extends BaseModel
|
||||||
|
{
|
||||||
|
use SoftDelete;
|
||||||
|
protected $name = 'build_plan';
|
||||||
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
public function getPlanStartDateAttr($value): string
|
||||||
|
{
|
||||||
|
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPlanEndDateAttr($value): string
|
||||||
|
{
|
||||||
|
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user