Explorar el Código

成本分析,非第一期时,台账节点汇总明细计算问题

MaiXinRong hace 3 meses
padre
commit
83400a0c20
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      app/service/cost_stage_analysis.js

+ 5 - 1
app/service/cost_stage_analysis.js

@@ -277,6 +277,9 @@ module.exports = app => {
                     }
                     this.ctx.service.calcTmpl.calcByTemplate(ln, ln, ln, stage.calcTemplate.calc_expr);
                 } else {
+                    for (const prop of costFields.sumFields) {
+                        ln[prop] = 0;
+                    }
                     for (const [i, d] of node.detail.entries()) {
                         const ld = {
                             id: this.uuid.v4(), tender_id: stage.tid, stage_id: stage.id,
@@ -295,11 +298,12 @@ module.exports = app => {
                             ld[prop] = preDetailSource ? preDetailSource[prop] || 0 : 0;
                         }
                         this.ctx.service.calcTmpl.calcByTemplate(ld, ld, ld, stage.calcTemplate.calc_expr);
-                        for (const prop of costFields.selfCalcFields) {
+                        for (const prop of costFields.sumFields) {
                             ln[prop] = this.ctx.helper.add(ln[prop], ld[prop]);
                         }
                         insertDetailData.push(ld);
                     }
+                    this.ctx.service.calcTmpl.calcByTemplate(ln, ln, ln, stage.calcTemplate.calc_expr);
                 }
             }