浏览代码

预计变更数量,调整计算

MaiXinRong 5 年之前
父节点
当前提交
e29925b1b1
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 3 1
      app/lib/bills_pos_convert.js
  2. 3 1
      app/public/js/stage.js

+ 3 - 1
app/lib/bills_pos_convert.js

@@ -97,7 +97,9 @@ class BillsPosConvert {
         node.pre_gather_qty = this.ctx.helper.add(node.pre_gather_qty, data.pre_gather_qty);
 
         node.real_qty = this.ctx.helper.add(node.real_qty, data.real_qty);
-        node.estimate_qty = this.ctx.helper.sub(this.ctx.helper.sub(node.real_qty, node.quantity), node.end_qc_qty);
+        node.estimate_qty = this.ctx.helper.checkZero(node.real_qty)
+            ? this.ctx.helper.sub(this.ctx.helper.sub(node.real_qty, node.quantity), node.end_qc_qty)
+            : null;
     }
     _loadBillsCalcFields(node, data) {
         node.quantity = this.ctx.helper.add(node.quantity, data.quantity);

+ 3 - 1
app/public/js/stage.js

@@ -179,7 +179,9 @@ $(document).ready(() => {
         pos.end_gather_qty = ZhCalc.add(pos.pre_gather_qty, pos.gather_qty);
         pos.sum = ZhCalc.add(pos.end_qc_qty, pos.quantity);
         pos.end_gather_percent = ZhCalc.mul(ZhCalc.div(pos.end_gather_qty, pos.sum), 100, 2);
-        pos.estimate_qty = ZhCalc.sub(ZhCalc.sub(pos.real_qty, pos.quantity), pos.end_qc_qty);
+        pos.estimate_qty = !checkZero(pos.real_qty)
+            ? ZhCalc.sub(ZhCalc.sub(pos.real_qty, pos.quantity), pos.end_qc_qty)
+            : null;
     };
     const stagePos = new StagePosData(stagePosSetting);