Sfoglia il codice sorgente

重新审批问题

MaiXinRong 1 anno fa
parent
commit
fff547e54b
1 ha cambiato i file con 7 aggiunte e 6 eliminazioni
  1. 7 6
      app/service/stage_audit.js

+ 7 - 6
app/service/stage_audit.js

@@ -896,11 +896,12 @@ module.exports = app => {
          * @return {Promise<void>}
          */
         async checkAgain(stageId, times = 1) {
+            const accountId = this.ctx.session.sessionUser.accountId;
             const time = new Date();
             // 整理当前流程审核人状态更新
             const auditors = await this.getAllDataByCondition({
                 where: { sid: stageId, times },
-                orders: [['order', 'desc']],
+                orders: [['order', 'asc']],
             });
             const maxOrder = auditors[auditors.length - 1].order;
             const audits = auditors.filter(x => { return x.order === maxOrder});
@@ -913,7 +914,7 @@ module.exports = app => {
             try {
                 // 当前审批人2次添加至流程中
                 const checkAgainAuditors = [], checkingAuditors = [];
-                audit.forEach(x => {
+                audits.forEach(x => {
                     checkAgainAuditors.push({
                         tid: x.tid, sid: x.sid, aid: x.aid,
                         times: x.times, order: x.order + 1,
@@ -922,7 +923,7 @@ module.exports = app => {
                         audit_type: x.audit_type, audit_order: x.audit_order,
                     });
                 });
-                audit.forEach(x => {
+                audits.forEach(x => {
                     checkingAuditors.push({
                         tid: x.tid, sid: x.sid, aid: x.aid,
                         times: x.times, order: x.order + 2,
@@ -935,8 +936,8 @@ module.exports = app => {
                 await transaction.insert(this.tableName, checkingAuditors);
 
                 // 复制一份最新数据给下一人
-                await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 1, transaction);
-                await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 2, transaction);
+                await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, selfAudit.order + 1, transaction);
+                await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, selfAudit.order + 2, transaction);
                 await this.ctx.service.stageJgcl.updateHistory4CheckAgain(this.ctx.stage, transaction);
                 await this.ctx.service.stageBonus.updateHistory4CheckAgain(this.ctx.stage, transaction);
                 await this.ctx.service.stageOther.updateHistory4CheckAgain(this.ctx.stage, transaction);
@@ -964,7 +965,7 @@ module.exports = app => {
                 await this.ctx.service.revisePrice.cancelPriceUsed(this.ctx.stage, transaction);
                 // 重算所有单价变更
                 const priceCalc = new RevisePrice(this.ctx);
-                const pcTp = await priceCalc.stageCheckAgainPriceChange(this.ctx.stage, audit.order + 2, transaction);
+                const pcTp = await priceCalc.stageCheckAgainPriceChange(this.ctx.stage, selfAudit.order + 2, transaction);
                 await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, checkingAuditors, checkAgainAuditors, null, stageTp, pcTp);
 
                 // 添加短信通知-需要审批提醒功能