Ver código fonte

开始计量以后,修改小数位数,不允许重算台账修订

MaiXinRong 4 anos atrás
pai
commit
58da9be6dd
1 arquivos alterados com 14 adições e 3 exclusões
  1. 14 3
      app/service/tender_info.js

+ 14 - 3
app/service/tender_info.js

@@ -211,6 +211,8 @@ module.exports = app => {
         }
 
         async _reCalcLedger(tenderId, billsService, newDecimal, oldDecimal) {
+            if (!billsService) return [];
+
             const changeBills = [];
             const calcUp = newDecimal.up < oldDecimal.up, calcTp = newDecimal.tp !== oldDecimal.tp;
             if (calcUp || calcTp) {
@@ -293,9 +295,18 @@ module.exports = app => {
                 }
             }
 
-            const billsService = this.ctx.tender.data.status === auditConst.ledger.status.checked
-                ? this.ctx.service.ledger
-                : this.ctx.service.reviseBills;
+            let billsService = null;
+            if (this.ctx.tender.data.status === auditConst.ledger.status.checked) {
+                const stageCount = this.ctx.service.stage.count({tid: tenderId});
+                if (stageCount === 0) {
+                    const revise = await ctx.service.ledgerRevise.getLastestRevise(tenderId);
+                    if (revise.status === auditConst.revise.status.uncheck || revise.status === auditConst.revise.status.checkNo) {
+                        billsService = this.ctx.service.reviseBills;
+                    }
+                }
+            } else {
+                billsService = this.ctx.service.ledger;
+            }
             const changeBills = await this._reCalcLedger(tenderId, billsService, newDecimal, oldDecimal);
             const [changeSj, changeSb, changeSo] = await this._reCalcStageExtra(tenderId, newDecimal, oldDecimal);
             if (changeBills.length > 0 ||