zhanglinxin 1 年之前
父节点
当前提交
7d652af808

+ 4 - 0
application/api/controller/Approveinfo.php

@@ -408,6 +408,10 @@ class Approveinfo extends Base
      *     @Apidoc\Returned("dept_id", type="string", desc="部门ID"),
      *     @Apidoc\Returned("name", type="string", desc="部门名称"),
      * )
+     * @Apidoc\Returned("contract", type="array", desc="关联的合同呈批申请 module=1",
+     *     @Apidoc\Returned("id", type="integer", desc="ID"),
+     *     @Apidoc\Returned("reason", type="string", desc="合同编号"),
+     * )
      * @Apidoc\Returned("apply_goods", type="array", desc="申购商品列表 module=1 && type=1",
      *     @Apidoc\Returned("id", type="integer", desc="申购商品ID"),
      *     @Apidoc\Returned("info_id", type="integer", desc="申请ID"),

+ 5 - 0
application/api/controller/Dingtalk.php

@@ -7,6 +7,11 @@ use app\common\model\User;
 use app\common\service\DingtalkService;
 use hg\apidoc\annotation as Apidoc;
 
+/**
+ * @Apidoc\Title("Dingtalk")
+ * @Apidoc\Group("api")
+ * @Apidoc\Sort("5")
+ */
 class Dingtalk extends Base
 {
 

+ 21 - 2
application/common/service/ApproveInfoService.php

@@ -52,7 +52,7 @@ class ApproveInfoService
             $department = $apply_user['department'];
         }
 
-        // 编辑
+        // 重新发起
         if ($id > 0) {
             $info = ApproveInfo::field('is_deleted', true)
                 ->where('module', $module)
@@ -71,6 +71,18 @@ class ApproveInfoService
             if ($info->status != CommonConstant::STATUS_4) {
                 except('非审批驳回状态无法操作');
             }
+        } else{
+            // 合同呈批申请 判断申购申请单
+            if ($module==CommonConstant::MODULE_9 && $params['apply_id'] > 0) {
+                $apply = ApproveInfo::field('id')
+                    ->where('module', CommonConstant::MODULE_1)
+                    ->where('status', CommonConstant::STATUS_3)
+                    ->where('is_deleted', CommonConstant::IS_DELETED_0)
+                    ->find($id);
+                if (!$apply) {
+                    except('申购申请单不存在或已删除');
+                }
+            }
         }
 
         $order_no = get_order_sn($user['id']);
@@ -114,7 +126,6 @@ class ApproveInfoService
                 // 添加审批申请
                 $info = ApproveInfo::create($data);
                 $info_id = $info->id;
-//                $info_id = 0;
 
                 // 添加对应模块
                 $module_data = self::create_module($module, $params, $info_id, [], 'create');
@@ -794,9 +805,17 @@ class ApproveInfoService
                 $department_data = Department::field('dept_id,name')
                     ->where('dept_id', 'in', $info['department'])
                     ->select();
+                // 关联的合同呈批申请
+                $contract = ApproveInfo::field('id,reason')
+                    ->where('module', CommonConstant::MODULE_9)
+                    ->where('status', CommonConstant::STATUS_3)
+                    ->where('is_deleted', CommonConstant::IS_DELETED_0)
+                    ->where('apply_id',$id)
+                    ->select();
                 $info['create_user'] = $create_user;
                 $info['apply_user'] = $apply_user;
                 $info['department_data'] = $department_data;
+                $info['contract'] = $contract;
             }
         } else {
             // 信息