Browse Source

其他变更业务的签名继承

Tony Kang 1 year ago
parent
commit
76baf43cc8

+ 11 - 2
app/controller/change_controller.js

@@ -2202,7 +2202,10 @@ module.exports = app => {
                     throw '变更立项书编号不能为空';
                 }
 
+                // 在生成新变更立项后,需要copy前一个变更立项报表的签名信息
+                const lastChange = await ctx.service.changeProject.getLastChange(tenderId);
                 const change = await ctx.service.changeProject.add(tenderId, ctx.session.sessionUser.accountId, data.code, data.name);
+                await ctx.service.roleRptRel.createRoleRelationshipFromOtherBz(tenderId, '-302', change.id, lastChange ? lastChange.id : null);
 
                 ctx.body = { err: 0, msg: '', data: change };
             } catch (err) {
@@ -2984,7 +2987,7 @@ module.exports = app => {
         }
 
         /**
-         * 新增变更立项 (Post)
+         * 新增变更申请 (Post)
          *
          * @param {Object} ctx - egg全局变量
          * @return {void}
@@ -3000,7 +3003,10 @@ module.exports = app => {
                     throw '变更申请编号不能为空';
                 }
 
+                // 在生成新变更申请后,需要copy前一个变更申请报表的签名信息
+                const lastChange = await ctx.service.changeApply.getLastChange(tenderId);
                 const change = await ctx.service.changeApply.add(tenderId, ctx.session.sessionUser.accountId, data.code, data.project_code, data.name);
+                await ctx.service.roleRptRel.createRoleRelationshipFromOtherBz(tenderId, '-303', change.id, lastChange ? lastChange.id : null);
 
                 ctx.body = { err: 0, msg: '', data: change };
             } catch (err) {
@@ -3757,7 +3763,7 @@ module.exports = app => {
         }
 
         /**
-         * 新增变更立项 (Post)
+         * 新增变更方案 (Post)
          *
          * @param {Object} ctx - egg全局变量
          * @return {void}
@@ -3773,7 +3779,10 @@ module.exports = app => {
                     throw '变更方案编号不能为空';
                 }
 
+                // 在生成新变更方案后,需要copy前一个变更方案报表的签名信息
+                const lastChange = await ctx.service.changePlan.getLastChange(tenderId);
                 const change = await ctx.service.changePlan.add(tenderId, ctx.session.sessionUser.accountId, data.code, data.apply_code, data.name);
+                await ctx.service.roleRptRel.createRoleRelationshipFromOtherBz(tenderId, '-301', change.id, lastChange ? lastChange.id : null);
 
                 ctx.body = { err: 0, msg: '', data: change };
             } catch (err) {

+ 8 - 0
app/service/change_apply.js

@@ -186,6 +186,14 @@ module.exports = app => {
             return list;
         }
 
+        // 获取最后一个变更申请
+        async getLastChange(tenderId) {
+            const sql = 'select * from ?? where tid = ? order by in_time desc LIMIT 1';
+            const sqlParam = [this.tableName, tenderId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result;
+        }
+
         /**
          * 获取变更令个数
          * @param {int} tenderId - 标段id

+ 8 - 0
app/service/change_plan.js

@@ -207,6 +207,14 @@ module.exports = app => {
             return list;
         }
 
+        // 获取最后一个变更方案
+        async getLastChange(tenderId) {
+            const sql = 'select * from ?? where tid = ? order by in_time desc LIMIT 1';
+            const sqlParam = [this.tableName, tenderId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result;
+        }
+
         /**
          * 获取变更令个数
          * @param {int} tenderId - 标段id

+ 8 - 0
app/service/change_project.js

@@ -190,6 +190,14 @@ module.exports = app => {
             return list;
         }
 
+        // 获取最后一个变更立项
+        async getLastChange(tenderId) {
+            const sql = 'select * from ?? where tid = ? order by in_time desc LIMIT 1';
+            const sqlParam = [this.tableName, tenderId];
+            const result = await this.db.queryOne(sql, sqlParam);
+            return result;
+        }
+
         /**
          * 获取变更令个数
          * @param {int} tenderId - 标段id