浏览代码

bug修复

laiguoran 4 年之前
父节点
当前提交
3d9a3c1f0d
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 2 0
      app/controller/material_controller.js
  2. 1 1
      app/service/material_exponent.js

+ 2 - 0
app/controller/material_controller.js

@@ -404,6 +404,8 @@ module.exports = app => {
                             ctx.material.ex_expr = calc.value.toString() + '*[0-1]';
                         }
                     }
+                    // 并更新至调差表中
+                    await ctx.service.materialExponent.update({ ex_calc: renderData.ex_calc, ex_expr: ctx.material.ex_expr }, { id: ctx.material.id });
                 } else {
                     renderData.ex_calc = JSON.parse(ctx.material.ex_calc);
                 }

+ 1 - 1
app/service/material_exponent.js

@@ -209,7 +209,7 @@ module.exports = app => {
                 }
             }
             expr += '-1]';
-            const ex_tp = this.ctx.helper.mul(basic_calc, this.ctx.helper.sub(this.ctx.helper.add(constant, sumByChange), 1));
+            const ex_tp = this.ctx.helper.round(this.ctx.helper.mul(basic_calc, this.ctx.helper.sub(this.ctx.helper.add(constant, sumByChange), 1)), 2);
             await transaction.update(this.ctx.service.material.tableName, {
                 id: mid ? mid : this.ctx.material.id,
                 ex_tp,