瀏覽代碼

本期应耗数量位数和计算本期金额调整

laiguoran 5 年之前
父節點
當前提交
aea66268a3
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 1 1
      app/controller/material_controller.js
  2. 1 0
      app/service/material_bills.js

+ 1 - 1
app/controller/material_controller.js

@@ -413,7 +413,7 @@ module.exports = app => {
                         // 更新quantity值并重新返回计算本期金额,截止本期金额
                         const updateData = {
                             id: data.id,
-                            quantity: quantity !== 0 ? quantity : null,
+                            quantity: quantity !== 0 ? this.ctx.helper.round(quantity, 3) : null,
                             expr: data.expr,
                         };
                         responseData.data = await ctx.service.materialBills.updateFYQuantity(updateData);

+ 1 - 0
app/service/material_bills.js

@@ -192,6 +192,7 @@ module.exports = app => {
             const transaction = await this.db.beginTransaction();
             try {
                 const mbInfo = await this.getDataById(data.id);
+                data.m_tp = this.ctx.helper.round(this.ctx.helper.mul(data.quantity, mbInfo.m_spread), 2);
                 await transaction.update(this.tableName, data);
                 let m_tp = this.ctx.material.m_tp;
                 if (mbInfo.quantity !== data.quantity) {