소스 검색

修复新建期bug

ellisran 1 년 전
부모
커밋
c5b9808523
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      app/service/material_bills.js

+ 3 - 3
app/service/material_bills.js

@@ -607,8 +607,8 @@ module.exports = app => {
         async calcQuantityByMB(transaction, mid, mb, materialCalculator, decimal, pre_is_stage_self, qty_source) {
             const [newmsg_spread, newm_spread] = await this.getSpread(mb, null, decimal.up);
             if (mb.t_type === materialConst.t_type[0].value) {
-                const newQuantity = await this.ctx.service.materialList.getMbQuantity(transaction, mid, qty_source, decimal.qty, mb.id);
-                const newTp = this.ctx.helper.round(this.ctx.helper.mul(newQuantity, newm_spread), decimal.tp);
+                const newQuantity = await this.ctx.service.materialList.getMbQuantity(transaction, mid, qty_source, decimal.qty, mb.id, 0);
+                const newTp = this.ctx.helper.round(this.ctx.helper.mul(this.ctx.helper.round(newQuantity, decimal.qty), newm_spread), decimal.tp);
                 const updateData = {
                     id: mb.id,
                     quantity: newQuantity,
@@ -623,7 +623,7 @@ module.exports = app => {
                     tax_pre_tp: mb.m_tax_tp !== null ? this.ctx.helper.add(mb.tax_pre_tp, mb.m_tax_tp) : mb.tax_pre_tp,
                 };
                 await transaction.update(this.tableName, updateData);
-                const m_tp = mb.is_summary === 1 ? await this.ctx.helper.round(this.ctx.helper.mul(mb_quantity.quantity, newm_spread), decimal.tp) : 0;
+                const m_tp = mb.is_summary === 1 ? await this.ctx.helper.round(this.ctx.helper.mul(newQuantity, newm_spread), decimal.tp) : 0;
                 const m_tax_tp = this.ctx.helper.round(this.ctx.helper.mul(m_tp, (1 + this.ctx.helper.div(mb.m_tax, 100))), decimal.tp);
                 return [m_tp, m_tax_tp];
             } else if (mb.t_type === materialConst.t_type[1].value) {