Преглед на файлове

按比例计量,填写默认公式

MaiXinRong преди 4 години
родител
ревизия
0700ec3822
променени са 2 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 5 3
      app/public/js/stage.js
  2. 1 1
      app/service/stage_pos.js

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

@@ -1092,6 +1092,7 @@ $(document).ready(() => {
         measureByBatch: function (posNames, ratio, apply2sibling) {
             if (posNames.length <= 0) return;
             if (ratio <= 0) return;
+            const fRatio = ZhCalc.div(ratio, 100);
 
             const sheet = slSpread.getActiveSheet();
             const node = SpreadJsObj.getSelectObject(sheet);
@@ -1106,7 +1107,8 @@ $(document).ready(() => {
                     if (posNames.indexOf(p.name) < 0) continue;
                     data.updateData.push({
                         pid: p.id, lid: p.lid,
-                        contract_qty: ZhCalc.mul(p.quantity, ratio)
+                        contract_qty: ZhCalc.mul(p.quantity, fRatio),
+                        contract_expr: `${p.quantity}*${ratio}%`,
                     });
                 }
             }
@@ -1784,7 +1786,7 @@ $(document).ready(() => {
                     const html = [];
                     for (const [i, p] of spSpread.getActiveSheet().zh_data.entries()) {
                         html.push('<tr>');
-                        html.push('<td>', i, '</td>');
+                        html.push('<td>', i+1, '</td>');
                         html.push('<td>', p.name, '</td>');
                         html.push('<td>', p.quantity, '</td>');
                         html.push('<td><input type="checkbox" pos-name="' + p.name + '"></td></td>');
@@ -3715,6 +3717,6 @@ $(document).ready(() => {
             toastr.warning('请勾选需要按计量比例的计量单元');
             return;
         }
-        stageTreeSpreadObj.measureByBatch(posName, ZhCalc.div(ratio, 100), apply2sibling);
+        stageTreeSpreadObj.measureByBatch(posName, ratio, apply2sibling);
     })
 });

+ 1 - 1
app/service/stage_pos.js

@@ -413,7 +413,7 @@ module.exports = app => {
                     if (d.contract_qty !== undefined) {
                         sp.contract_qty = this.ctx.helper.round(d.contract_qty, b.precision.value);
                     }
-                    if (osp.contract_expr) sp.contract_expr = null;
+                    sp.contract_expr = d.contract_expr;
                     updatePosStage.push(sp);
                 } else {
                     const sp = {