Parcourir la source

金额概况,缓存调整

MaiXinRong il y a 5 ans
Parent
commit
8121f0d1f5
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      app/service/stage.js

+ 7 - 3
app/service/stage.js

@@ -209,18 +209,23 @@ module.exports = app => {
 
         async checkStageGatherData(stage) {
             // 最新一期计量(未审批完成),当前操作人的期详细数据,应实时计算
-            if (stage.status !== auditConst.status.checked && stage.check_calc) {
+            if (stage.status !== auditConst.status.checked) {
                 const curAuditor = await this.ctx.service.stageAudit.getCurAuditor(stage.id, stage.times);
                 const isActive = curAuditor ? curAuditor.aid === this.ctx.session.sessionUser.accountId : stage.user_id === this.ctx.session.sessionUser.accountId;
                 stage.curTimes = stage.status === auditConst.status.checkNo ? stage.times - 1 : stage.times;
                 stage.curOrder = curAuditor ? curAuditor.order : 0;
-                if (isActive) {
+                if (isActive && stage.check_calc) {
                     const tpData = await this.ctx.service.stageBills.getSumTotalPrice(stage);
                     stage.contract_tp = tpData.contract_tp;
                     stage.qc_tp = tpData.qc_tp;
                     const tp = await this.ctx.service.stagePay.getSpecialTotalPrice(stage);
                     stage.yf_tp = tp.yf;
                     stage.sf_tp = tp.sf;
+                    await this.update({
+                        check_calc: false,
+                        contract_tp: stage.contract_tp, qc_tp: stage.qc_tp,
+                        yf_tp: stage.yf_tp, sf_tp: stage.sf_tp
+                    }, {id: stage.id});
                 } else if (stage.tp_history) {
                     const his = this.ctx.helper._.find(stage.tp_history, {times: stage.curTimes, order: stage.curOrder});
                     if (his) {
@@ -229,7 +234,6 @@ module.exports = app => {
                         stage.yf_tp = his.yf_tp;
                         stage.sf_tp = his.sf_tp;
                         stage.tp = this.ctx.helper.add(stage.contract_tp, stage.qc_tp);
-                        stage.end_tp = this.ctx.helper.add(stage.pre_tp, stage.tp);
                     }
                 }
             }