Przeglądaj źródła

修复小数位bug

laiguoran 2 lat temu
rodzic
commit
5a9b44e778
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      app/service/material_bills.js

+ 3 - 3
app/service/material_bills.js

@@ -622,7 +622,7 @@ module.exports = app => {
                         };
                         if (newDecimalQty !== this.ctx.material.decimal.qty) {
                             // 通过管理重新算出quantity并保留小数位
-                            const sql = 'SELECT SUM(`gather_qty`*`quantity`) as quantity FROM ' + this.tableName + ' WHERE `mid`=? AND `mb_id`=? AND `ms_id`=? AND `is_join`=1';
+                            const sql = 'SELECT SUM(`gather_qty`*`quantity`) as quantity FROM ' + this.ctx.service.materialList.tableName + ' WHERE `mid`=? AND `mb_id`=? AND `ms_id`=? AND `is_join`=1';
                             const sqlParam = [this.ctx.material.id, mb.id, ms.id];
                             const mb_quantity = await transaction.queryOne(sql, sqlParam);
                             const newQuantity = this.ctx.helper.round(mb_quantity.quantity, newDecimalQty);
@@ -650,7 +650,7 @@ module.exports = app => {
                         const newbasic_price = this.ctx.helper.round(mb.basic_price, newDecimalUp);
                         updateData.basic_price = newbasic_price;
                     }
-                    const sql = 'SELECT SUM(`m_tp`) as total_price, SUM(IF(`m_tax_tp` is null, `m_tp`, `m_tax_tp`)) as tax_total_price FROM ' + this.tableName + ' WHERE `tid` = ? AND `mid` = ? AND `mb_id` = ? AND `is_summary` = 1';
+                    const sql = 'SELECT SUM(`m_tp`) as total_price, SUM(IF(`m_tax_tp` is null, `m_tp`, `m_tax_tp`)) as tax_total_price FROM ' + this.ctx.service.materialStageBills.tableName + ' WHERE `tid` = ? AND `mid` = ? AND `mb_id` = ? AND `is_summary` = 1';
                     const sqlParam = [this.ctx.tender.id, this.ctx.material.id, mb.id];
                     const tp = await transaction.queryOne(sql, sqlParam);
                     updateData.m_tp = this.ctx.helper.round(tp.total_price, newDecimalTp);
@@ -690,7 +690,7 @@ module.exports = app => {
                     }
                     if (newDecimalQty !== this.ctx.material.decimal.qty) {
                         // 通过管理重新算出quantity并保留小数位
-                        const sql = 'SELECT SUM(`gather_qty`*`quantity`) as quantity FROM ' + this.tableName + ' WHERE `mid`=? AND `mb_id`=? AND `is_join`=1';
+                        const sql = 'SELECT SUM(`gather_qty`*`quantity`) as quantity FROM ' + this.ctx.service.materialList.tableName + ' WHERE `mid`=? AND `mb_id`=? AND `is_join`=1';
                         const sqlParam = [this.ctx.material.id, mb.id];
                         const mb_quantity = await transaction.queryOne(sql, sqlParam);
                         const newQuantity = this.ctx.helper.round(mb_quantity.quantity, newDecimalQty);