|
@@ -33,13 +33,13 @@ class ApproveInfoService
|
|
|
* @param integer $module 模块类型
|
|
|
* @param array $params
|
|
|
* @param mixed $user 用户信息
|
|
|
+ * @param string $way 方式:create=申请,update=重新发起
|
|
|
**/
|
|
|
- public static function create($id, $module, $params, $user)
|
|
|
+ public static function create($id, $module, $params, $user,$way)
|
|
|
{
|
|
|
$userid = $user['userid'];
|
|
|
$apply_user_id = $userid;
|
|
|
$department = $user['department'];
|
|
|
- $reason = $params['reason'];
|
|
|
|
|
|
// 5=出差申请,6=请假申请,7=用车申请 申请人信息
|
|
|
if (in_array($module, [CommonConstant::MODULE_5, CommonConstant::MODULE_6, CommonConstant::MODULE_7])) {
|
|
@@ -86,9 +86,6 @@ class ApproveInfoService
|
|
|
except('申购申请单不存在或已删除');
|
|
|
}
|
|
|
}
|
|
|
- // 生成合同编号
|
|
|
- $contract_no = CommonService::get_contract_no($params['type']);
|
|
|
- $reason = $contract_no;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -106,7 +103,7 @@ class ApproveInfoService
|
|
|
'cur_num' => 0,
|
|
|
'order_no' => $order_no,
|
|
|
'apply_date' => date("Y-m-d"),
|
|
|
- 'reason' => $reason,
|
|
|
+ 'reason' => $params['reason'],
|
|
|
'type' => $params['type'],
|
|
|
'desc' => $params['desc'],
|
|
|
'start_time' => $module == CommonConstant::MODULE_6 ? $params['start_time'] . ' ' . $params['start_am'] : $params['start_time'],
|
|
@@ -151,6 +148,15 @@ class ApproveInfoService
|
|
|
} catch (Exception $e) {
|
|
|
except('出现错误:' . $e->getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ if($way == CommonConstant::create){
|
|
|
+ if ($module == CommonConstant::MODULE_9) {
|
|
|
+ // 生成合同编号
|
|
|
+ $contract_no = CommonService::get_contract_no($params['type']);
|
|
|
+ $info->save(['reason'=>$contract_no]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1074,7 +1080,7 @@ class ApproveInfoService
|
|
|
public static function make($id, $params, $user, $type)
|
|
|
{
|
|
|
$userid = $user['userid'];
|
|
|
- $info = ApproveInfo::field('id,user_id,module,status')
|
|
|
+ $info = ApproveInfo::field('id,user_id,module,status,reason')
|
|
|
->where('is_deleted', CommonConstant::IS_DELETED_0)
|
|
|
->find($id);
|
|
|
if (!$info) {
|
|
@@ -1100,12 +1106,18 @@ class ApproveInfoService
|
|
|
|
|
|
$info->status = CommonConstant::STATUS_5;
|
|
|
$info->save();
|
|
|
+
|
|
|
+ if ($info->module == CommonConstant::MODULE_9) {
|
|
|
+ // 9=合同呈批 释放合同编号
|
|
|
+ CommonService::set_contract_no($info->reason);
|
|
|
+ }
|
|
|
break;
|
|
|
case 'comment':
|
|
|
if ($info->status != CommonConstant::STATUS_3) {
|
|
|
except('非审批同意状态无法操作');
|
|
|
}
|
|
|
if ($info->module != CommonConstant::MODULE_8) {
|
|
|
+ // 8=维修申请
|
|
|
except(CommonConstant::get_module_list()[CommonConstant::MODULE_8] . '记录不存在或已删除');
|
|
|
}
|
|
|
// TODO 没有判断评价状态
|