update approve
This commit is contained in:
parent
8baaeb0607
commit
37b79f5e2a
@ -52,7 +52,7 @@ class MaterialPurchaseRequestController extends BaseAdminController
|
||||
public function add()
|
||||
{
|
||||
$params = (new MaterialPurchaseRequestValidate())->post()->goCheck('add');
|
||||
$result = MaterialPurchaseRequestLogic::add($params);
|
||||
$result = MaterialPurchaseRequestLogic::add($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class ProjectExpenseReimbursementController extends BaseAdminController
|
||||
public function add()
|
||||
{
|
||||
$params = (new ProjectExpenseReimbursementValidate())->post()->goCheck('add');
|
||||
$result = ProjectExpenseReimbursementLogic::add($params);
|
||||
$result = ProjectExpenseReimbursementLogic::add($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class ProjectLoanApplyController extends BaseAdminController
|
||||
public function add()
|
||||
{
|
||||
$params = (new ProjectLoanApplyValidate())->post()->goCheck('add');
|
||||
$result = ProjectLoanApplyLogic::add($params);
|
||||
$result = ProjectLoanApplyLogic::add($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class ProjectTravelReimbursementController extends BaseAdminController
|
||||
public function add()
|
||||
{
|
||||
$params = (new ProjectTravelReimbursementValidate())->post()->goCheck('add');
|
||||
$result = ProjectTravelReimbursementLogic::add($params);
|
||||
$result = ProjectTravelReimbursementLogic::add($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class ProjectTripApplyController extends BaseAdminController
|
||||
public function add()
|
||||
{
|
||||
$params = (new ProjectTripApplyValidate())->post()->goCheck('add');
|
||||
$result = ProjectTripApplyLogic::add($params);
|
||||
$result = ProjectTripApplyLogic::add($params,$this->adminId);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
|
@ -41,9 +41,8 @@ class MaterialPurchaseRequestLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2024/01/09 13:47
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
$detail =$params['purchase_request_detail'];// json_decode($params['purchase_request_detail'],true);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$MaterialPurchaseRequestRes = MaterialPurchaseRequest::create([
|
||||
@ -56,7 +55,7 @@ class MaterialPurchaseRequestLogic extends BaseLogic
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
]);
|
||||
foreach ($detail as $item)
|
||||
foreach ($params['purchase_request_detail'] as $item)
|
||||
{
|
||||
MaterialPurchaseRequestDetail::create([
|
||||
'project_material_budget_detail_id' => $item['project_material_budget_detail_id'],
|
||||
@ -72,6 +71,16 @@ class MaterialPurchaseRequestLogic extends BaseLogic
|
||||
ProjectMaterialBudgetDetail::where('id',$item['project_material_budget_detail_id'])->update(['is_residual'=>1,'update_time'=>time()]);
|
||||
}
|
||||
}
|
||||
//添加审批信息
|
||||
addApprove(
|
||||
'采购申请',
|
||||
$MaterialPurchaseRequestRes->id,
|
||||
'app\common\model\material\MaterialPurchaseRequest',
|
||||
'app\adminapi\logic\material\MaterialPurchaseRequestLogic',
|
||||
$params['approve_detail']['flow_type'],
|
||||
$params['approve_detail']['flow_path'],
|
||||
$admin_id
|
||||
);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -42,7 +42,7 @@ class ProjectCostAdjustmentLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectCostAdjustment::create([
|
||||
$res = ProjectCostAdjustment::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'adjust_date' => strtotime($params['adjust_date']),
|
||||
'adjust_amount' => $params['adjust_amount'],
|
||||
@ -51,6 +51,16 @@ class ProjectCostAdjustmentLogic extends BaseLogic
|
||||
'add_user' => $admin_id,
|
||||
'update_user' => $admin_id,
|
||||
]);
|
||||
//添加审批信息
|
||||
addApprove(
|
||||
'成本调整',
|
||||
$res->id,
|
||||
'app\common\model\project\ProjectCostAdjustment',
|
||||
'app\adminapi\logic\project\ProjectCostAdjustmentLogic',
|
||||
$params['approve_detail']['flow_type'],
|
||||
$params['approve_detail']['flow_path'],
|
||||
$admin_id
|
||||
);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -42,7 +42,7 @@ class ProjectExpenseReimbursementLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2024/01/19 13:44
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
//获取税率
|
||||
$tax_rate = DictData::where('type_value','tax_rate')->column('name','value');
|
||||
@ -84,6 +84,16 @@ class ProjectExpenseReimbursementLogic extends BaseLogic
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
//添加审批信息
|
||||
addApprove(
|
||||
'费用报销',
|
||||
$res->id,
|
||||
'app\common\model\project\ProjectExpenseReimbursement',
|
||||
'app\adminapi\logic\project\ProjectExpenseReimbursementLogic',
|
||||
$params['approve_detail']['flow_type'],
|
||||
$params['approve_detail']['flow_path'],
|
||||
$admin_id
|
||||
);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -38,11 +38,11 @@ class ProjectLoanApplyLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 11:05
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectLoanApply::create([
|
||||
$res = ProjectLoanApply::create([
|
||||
'loan_apply_code' => data_unique_code('项目借款'),
|
||||
'project_id' => $params['project_id'],
|
||||
'apply_user' => $params['apply_user'],
|
||||
@ -55,6 +55,16 @@ class ProjectLoanApplyLogic extends BaseLogic
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'bank_account_id' => $params['bank_account_id'],
|
||||
]);
|
||||
//添加审批信息
|
||||
addApprove(
|
||||
'借款申请',
|
||||
$res->id,
|
||||
'app\common\model\project\ProjectLoanApply',
|
||||
'app\adminapi\logic\project\ProjectLoanApplyLogic',
|
||||
$params['approve_detail']['flow_type'],
|
||||
$params['approve_detail']['flow_path'],
|
||||
$admin_id
|
||||
);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -45,7 +45,7 @@ class ProjectTravelReimbursementLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2024/01/18 13:57
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
$trip_apply = ProjectTripApply::field('project_id')->where('id',$params['trip_apply_id'])->findOrEmpty();
|
||||
//获取税率
|
||||
@ -94,6 +94,16 @@ class ProjectTravelReimbursementLogic extends BaseLogic
|
||||
'remark' => $item['remark'] ?? '',
|
||||
]);
|
||||
}
|
||||
//添加审批信息
|
||||
addApprove(
|
||||
'差旅报销',
|
||||
$res->id,
|
||||
'app\common\model\project\ProjectTravelReimbursement',
|
||||
'app\adminapi\logic\project\ProjectTravelReimbursementLogic',
|
||||
$params['approve_detail']['flow_type'],
|
||||
$params['approve_detail']['flow_path'],
|
||||
$admin_id
|
||||
);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -39,11 +39,11 @@ class ProjectTripApplyLogic extends BaseLogic
|
||||
* @author likeadmin
|
||||
* @date 2024/01/17 09:22
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
public static function add(array $params,$admin_id): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
ProjectTripApply::create([
|
||||
$res = ProjectTripApply::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'trip_apply_code' => data_unique_code('项目出差'),
|
||||
'origin_address' => $params['origin_address'],
|
||||
@ -56,6 +56,16 @@ class ProjectTripApplyLogic extends BaseLogic
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
]);
|
||||
//添加审批信息
|
||||
addApprove(
|
||||
'出差申请',
|
||||
$res->id,
|
||||
'app\common\model\project\ProjectTripApply',
|
||||
'app\adminapi\logic\project\ProjectTripApplyLogic',
|
||||
$params['approve_detail']['flow_type'],
|
||||
$params['approve_detail']['flow_path'],
|
||||
$admin_id
|
||||
);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
@ -43,7 +43,8 @@ class MaterialPurchaseRequestValidate extends BaseValidate
|
||||
'apply_date' => 'require|dateFormat:Y-m-d',
|
||||
'arrival_date' => 'require|dateFormat:Y-m-d',
|
||||
'annex' => 'checkAnnex',
|
||||
'purchase_request_detail' => 'require|checkPurchaseRequestDetail'
|
||||
'purchase_request_detail' => 'require|checkPurchaseRequestDetail',
|
||||
'approve_detail' => 'require|checkApproveDetail',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
@ -56,6 +57,7 @@ class MaterialPurchaseRequestValidate extends BaseValidate
|
||||
'arrival_date.require' => '请选择希望到货日期',
|
||||
'arrival_date.dateFormat' => '希望到货日期数据格式错误',
|
||||
'purchase_request_detail.require' => '申购明细内容不能为空',
|
||||
'approve_detail.require' => '审批流程不能为空'
|
||||
];
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ class ProjectCostAdjustmentValidate extends BaseValidate
|
||||
'adjust_date' => 'require|dateFormat:Y-m-d',
|
||||
'adjust_amount' => 'require|float|gt:0',
|
||||
'annex' => 'checkAnnex',
|
||||
'approve_detail' => 'require|checkApproveDetail',
|
||||
];
|
||||
|
||||
|
||||
@ -49,6 +50,7 @@ class ProjectCostAdjustmentValidate extends BaseValidate
|
||||
'project_id' => '项目id',
|
||||
'adjust_date' => '调整日期',
|
||||
'adjust_amount' => '调整金额',
|
||||
'approve_detail' => '审批流程'
|
||||
];
|
||||
|
||||
|
||||
|
@ -52,6 +52,7 @@ class ProjectExpenseReimbursementValidate extends BaseValidate
|
||||
'bank_account_id' => 'require|checkBankAccount',
|
||||
'reimbursement_detail' => 'require|checkReimbursementDetail',
|
||||
'invoice_detail' => 'require|checkInvoiceDetail',
|
||||
'approve_detail' => 'require|checkApproveDetail',
|
||||
];
|
||||
|
||||
|
||||
@ -73,6 +74,7 @@ class ProjectExpenseReimbursementValidate extends BaseValidate
|
||||
'bank_account_id' => '付款银行账户id',
|
||||
'reimbursement_detail' => '报销明细',
|
||||
'invoice_detail' => '发票明细',
|
||||
'approve_detail' => '审批流程'
|
||||
];
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ class ProjectLoanApplyValidate extends BaseValidate
|
||||
'payee_account' => 'require',
|
||||
'annex' => 'checkAnnex',
|
||||
'bank_account_id' => 'require|checkBankAccount',
|
||||
'approve_detail' => 'require|checkApproveDetail',
|
||||
];
|
||||
|
||||
|
||||
@ -60,6 +61,7 @@ class ProjectLoanApplyValidate extends BaseValidate
|
||||
'payee_bank' => '收款银行',
|
||||
'payee_account' => '收款账号',
|
||||
'bank_account_id' => '付款银行账户id',
|
||||
'approve_detail' => '审批流程'
|
||||
];
|
||||
|
||||
|
||||
|
@ -52,6 +52,7 @@ class ProjectTravelReimbursementValidate extends BaseValidate
|
||||
'bank_account_id' => 'require|checkBankAccount',
|
||||
'reimbursement_detail' => 'require|checkReimbursementDetail',
|
||||
'invoice_detail' => 'require|checkInvoiceDetail',
|
||||
'approve_detail' => 'require|checkApproveDetail',
|
||||
];
|
||||
|
||||
|
||||
@ -73,6 +74,7 @@ class ProjectTravelReimbursementValidate extends BaseValidate
|
||||
'bank_account_id' => '付款银行账户id',
|
||||
'reimbursement_detail' => '报销明细',
|
||||
'invoice_detail' => '发票明细',
|
||||
'approve_detail' => '审批流程'
|
||||
];
|
||||
|
||||
|
||||
|
@ -40,7 +40,8 @@ class ProjectTripApplyValidate extends BaseValidate
|
||||
'traffic' => 'require|checkTraffic',
|
||||
'start_date' => 'require|dateFormat:Y-m-d',
|
||||
'end_date' => 'require|dateFormat:Y-m-d|checkEndDate',
|
||||
'annex' => 'checkAnnex'
|
||||
'annex' => 'checkAnnex',
|
||||
'approve_detail' => 'require|checkApproveDetail',
|
||||
];
|
||||
|
||||
|
||||
@ -56,6 +57,7 @@ class ProjectTripApplyValidate extends BaseValidate
|
||||
'traffic' => '交通工具',
|
||||
'start_date' => '出差时间',
|
||||
'end_date' => '结束时间',
|
||||
'approve_detail' => '审批流程'
|
||||
];
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user