瀏覽代碼

清单精度问题

MaiXinRong 6 年之前
父節點
當前提交
620be6255f
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      app/service/ledger.js

+ 8 - 4
app/service/ledger.js

@@ -1590,17 +1590,21 @@ module.exports = app => {
                         throw '提交数据错误';
                     }
                     let updateData;
+                    if (row.unit) {
+                        if (!row.quantity) { row.quantity = updateNode.quantity; }
+                        if (!row.deal_qty) { row.deal_qty = updateNode.deal_qty; }
+                    }
                     if (this._checkCalcField(row)) {
                         let calcData = JSON.parse(JSON.stringify(row));
-                        const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, updateNode.unit);
-                        this.ctx.helper.checkFieldPrecision(row, qtyFields, precision.value);
-                        if (row.quantity) {
+                        const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, row.unit ? row.unit : updateNode.unit);
+                        this.ctx.helper.checkFieldPrecision(calcData, qtyFields, precision.value);
+                        if (calcData.quantity) {
                             if (row.unit_price) {
                                 calcData.total_price = this._.multiply(row.quantity, row.unit_price);
                             } else {
                                 calcData.total_price = this._.multiply(row.quantity, updateNode.unit_price);
                             }
-                        } else if (row.unit_price) {
+                        } else if (calcData.unit_price) {
                             calcData.total_price = this._.multiply(updateNode.quantity, row.unit_price);
                         }
                         if (row.total_price) {