laiguoran 3 gadi atpakaļ
vecāks
revīzija
cc807dabf8
2 mainītis faili ar 33 papildinājumiem un 2 dzēšanām
  1. 6 2
      app/service/change_audit_list.js
  2. 27 0
      app/service/change_revise_log.js

+ 6 - 2
app/service/change_audit_list.js

@@ -814,7 +814,7 @@ module.exports = app => {
                     await this._findParents(transaction, tid, r, result);
                 }
                 // 插入到计量单元表,并删除变更的计量单元数据, 插入清单表,并删除变更的清单表
-                await this._insertByChangeRevise(transaction, tid, result, result2);
+                await this._insertByChangeRevise(transaction, tid, cid, result, result2);
                 // 更新标段总金额
                 const sumSql = 'SELECT Sum(total_price) As total_price, Sum(deal_tp) As deal_tp' +
                     '  FROM ' + this.ctx.service.ledger.tableName + this.ctx.helper.whereSql({ tender_id: tid });
@@ -837,7 +837,7 @@ module.exports = app => {
             }
         }
 
-        async _insertByChangeRevise(transaction, tid, ledgerList, posList) {
+        async _insertByChangeRevise(transaction, tid, cid, ledgerList, posList) {
             if (ledgerList.length > 0) {
                 const insertLedgerArr = [];
                 for (const l of ledgerList) {
@@ -851,6 +851,8 @@ module.exports = app => {
                     ];
                     insertLedgerArr.push('(' + this.ctx.helper.getInArrStrSqlFilter(insertL) + ')');
                     await transaction.delete(this.ctx.service.changeLedger.tableName, { id: l.id });
+                    // 日志添加
+                    await transaction.insert(this.ctx.service.changeReviseLog.tableName, { tid, cid, lid: l.id, name: l.name, create_time: new Date() });
                 }
                 const bSql = 'Insert Into ' +
                     this.ctx.service.ledger.tableName +
@@ -874,6 +876,8 @@ module.exports = app => {
                     ];
                     insertPosArr.push('(' + this.ctx.helper.getInArrStrSqlFilter(insertp) + ')');
                     await transaction.delete(this.ctx.service.changePos.tableName, { id: p.id });
+                    // 日志添加
+                    await transaction.insert(this.ctx.service.changeReviseLog.tableName, { tid, cid, pid: p.id, name: p.name, create_time: new Date() });
                 }
                 const pSql =
                     'Insert Into ' +

+ 27 - 0
app/service/change_revise_log.js

@@ -0,0 +1,27 @@
+'use strict';
+
+/**
+ * 变更新增部位插入记录表
+ *
+ * @author Mai
+ * @date
+ * @version
+ */
+
+module.exports = app => {
+
+    class ChangePos extends app.BaseService {
+        /**
+         * 构造函数
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        constructor(ctx) {
+            super(ctx);
+            this.tableName = 'change_revise_log';
+        }
+    }
+
+    return ChangePos;
+};