MaiXinRong 3 روز پیش
والد
کامیت
7976a788eb
6فایلهای تغییر یافته به همراه8 افزوده شده و 8 حذف شده
  1. 2 2
      app/lib/bills_pos_convert.js
  2. 1 1
      app/lib/revise_price.js
  3. 1 1
      app/lib/sum_load.js
  4. 1 1
      app/service/stage_bills.js
  5. 1 1
      app/service/stage_change.js
  6. 2 2
      app/service/stage_stash.js

+ 2 - 2
app/lib/bills_pos_convert.js

@@ -87,7 +87,7 @@ class BillsPosConvert {
             let end_contract_qty = data.contract_qty;
             activeQty = this.ctx.helper.add(activeQty, data.pre_qc_minus_qty);
             end_contract_qty = this.ctx.helper.add(end_contract_qty, data.pre_contract_qty);
-            const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), data.total_price, info.decimal.tp);
+            const end_contract_tp = activeQty === 0 ? data.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), data.total_price, info.decimal.tp);
             return this.ctx.helper.sub(end_contract_tp, data.pre_contract_tp);
         } else if (info.calc_type === 'up') {
             if (correct) {
@@ -108,7 +108,7 @@ class BillsPosConvert {
         if (info.calc_type === 'tp') {
             const activeQty = this.ctx.helper.add(data.quantity, data.pre_qc_minus_qty);
             const orgTotalPrice = this.ctx.helper.mul(data.quantity, org_price, info.decimal.tp);
-            return this.ctx.helper.mul(this.ctx.helper.div(data.pre_contract_qty, activeQty), orgTotalPrice, info.decimal.tp);
+            return activeQty === 0 ? orgTotalPrice : this.ctx.helper.mul(this.ctx.helper.div(data.pre_contract_qty, activeQty), orgTotalPrice, info.decimal.tp);
         } else if (info.calc_type === 'up') {
             return this.ctx.helper.mul(org_price, data.pre_contract_qty, info.decimal.tp);
         }

+ 1 - 1
app/lib/revise_price.js

@@ -66,7 +66,7 @@ class revisePriceCalc {
         let end_contract_qty = bills.cur_contract_qty;
         activeQty = this.ctx.helper.add(activeQty, bills.pre_qc_minus_qty);
         end_contract_qty = this.ctx.helper.add(end_contract_qty, bills.pre_contract_qty);
-        const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
+        const end_contract_tp = activeQty === 0 ? bills.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
         return this.ctx.helper.sub(end_contract_tp, bills.pre_contract_tp);
     }
 

+ 1 - 1
app/lib/sum_load.js

@@ -411,7 +411,7 @@ class gatherStageGclTree extends loadGclBaseTree {
             let end_contract_qty = node.contract_qty;
             activeQty = this.ctx.helper.add(activeQty, node.pre_qc_minus_qty);
             end_contract_qty = this.ctx.helper.add(end_contract_qty, node.pre_contract_qty);
-            const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, info.decimal.tp);
+            const end_contract_tp = activeQty ? node.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, info.decimal.tp);
             return this.ctx.helper.sub(end_contract_tp, node.pre_contract_tp);
         } else if (info.calc_type === 'up') {
             if (correct) {

+ 1 - 1
app/service/stage_bills.js

@@ -178,7 +178,7 @@ module.exports = app => {
                 activeQty = this.ctx.helper.add(activeQty, preStageBills.qc_minus_qty);
                 end_contract_qty = this.ctx.helper.add(end_contract_qty, preStageBills.contract_qty);
             }
-            const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
+            const end_contract_tp = activeQty === 0 ? bills.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
             return preStageBills ? this.ctx.helper.sub(end_contract_tp, preStageBills.contract_tp) : end_contract_tp;
         }
         _calcContractTpByCorrect(bills,preStageBills, stageBills, decimal) {

+ 1 - 1
app/service/stage_change.js

@@ -166,7 +166,7 @@ class autoUseChange {
                 activeQty = this.helper.add(activeQty, preSb.qc_minus_qty);
                 end_contract_qty = this.helper.add(end_contract_qty, preSb.contract_qty);
             }
-            const end_contract_tp = this.helper.mul(this.helper.div(end_contract_qty, activeQty), bills.total_price, this.decimal.tp);
+            const end_contract_tp = activeQty ? bills.total_price : this.helper.mul(this.helper.div(end_contract_qty, activeQty), bills.total_price, this.decimal.tp);
             return preSb ? this.helper.sub(end_contract_tp, preSb.contract_tp) : end_contract_tp;
         } else if (info.calc_type === 'up') {
             if (this.correct) {

+ 2 - 2
app/service/stage_stash.js

@@ -72,7 +72,7 @@ class loadStageExcelTree {
                 activeQty = this.ctx.helper.add(activeQty, preSb.qc_minus_qty);
                 end_contract_qty = this.ctx.helper.add(end_contract_qty, preSb.contract_qty);
             }
-            const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, this.decimal.tp);
+            const end_contract_tp = activeQty ? node.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, this.decimal.tp);
             return preSb ? this.ctx.helper.sub(end_contract_tp, preSb.contract_tp) : end_contract_tp;
         } else if (this.info.calc_type === 'up') {
             if (correct) {
@@ -288,7 +288,7 @@ module.exports = app => {
                     let end_contract_qty = stageBills.contract_qty;
                     activeQty = helper.add(activeQty, bills.pre_qc_minus_qty);
                     end_contract_qty = helper.add(end_contract_qty, bills.pre_contract_qty);
-                    const end_contract_tp = helper.mul(helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
+                    const end_contract_tp = activeQty ? bills.total_price : helper.mul(helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
                     return helper.sub(end_contract_tp, bills.pre_contract_tp);
                 } else if (info.calc_type === 'up') {
                     if (correct) {