Browse Source

数据检查相关

MaiXinRong 4 years ago
parent
commit
1f5cd9f45e
4 changed files with 9 additions and 6 deletions
  1. 2 2
      app/lib/ledger.js
  2. 3 3
      app/public/js/ledger_check.js
  3. 3 0
      app/public/js/stage.js
  4. 1 1
      app/view/setting/s2b.ejs

+ 2 - 2
app/lib/ledger.js

@@ -587,7 +587,7 @@ class checkData {
             if (ratio === 0) {
                 if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
             } else {
-                const tp = this.ctx.helper.mul(data.total_price, ratio, this.ctx.tender.info.decimal.tp);
+                const tp = this.ctx.helper.mul(data.total_price, this.ctx.helper.div(ratio, 100, 4), this.ctx.tender.info.decimal.tp);
                 const checkTp = this.ctx.helper.add(data.contract_tp, data.pre_contract_tp);
                 if (tp > checkTp) return 1; // 违规
                 if (tp < checkTp) return 2; // 漏计
@@ -604,7 +604,7 @@ class checkData {
                 if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
             } else {
                 const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, unit);
-                const checkQty = this.ctx.helper.mul(data.quantity, ratio, precision.value);
+                const checkQty = this.ctx.helper.mul(data.quantity, this.ctx.helper.div(ratio, 100, 4), precision.value);
                 const qty = this.ctx.helper.add(data.contract_qty, data.pre_contract_qty);
                 if (qty > checkQty) return 1; // 违规
                 if (qty < checkQty) return 2; // 漏计

+ 3 - 3
app/public/js/ledger_check.js

@@ -166,7 +166,7 @@ const ledgerCheckUtil = {
                 if (ratio === 0) {
                     if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
                 } else {
-                    const tp = ZhCalc.mul(data.total_price, ratio, this.ctx.tender.info.decimal.tp);
+                    const tp = ZhCalc.mul(data.total_price, ZhCalc.div(ratio, 100, 4), this.ctx.tender.info.decimal.tp);
                     const checkTp = ZhCalc.add(data.contract_tp, data.pre_contract_tp);
                     if (tp > checkTp) return 1; // 违规
                     if (tp < checkTp) return 2; // 漏计
@@ -183,8 +183,8 @@ const ledgerCheckUtil = {
                     if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
                 } else {
                     const precision = findPrecision(tenderInfo.precision, unit);
-                    const checkQty = ZhCalc.mul(data.quantity, ratio, precision.value);
-                    const qty = ZhCalc.add(data.contract_qty, data.pre_contract_qty);
+                    const checkQty = ZhCalc.mul(data.quantity, ZhCalc.div(ratio, 100, 4), precision.value);
+                    const qty = ZhCalc.add(data.contract_qty, data.pre_contract_qty) || 0;
                     if (qty > checkQty) return 1; // 违规
                     if (qty < checkQty) return 2; // 漏计
                 }

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

@@ -634,9 +634,11 @@ $(document).ready(() => {
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     ledgerSpreadSetting.cols.push(
         {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
+        {title: '档案限制', colSpan: '1', rowSpan: '2', field: 'dagl_limit', hAlign: 0, width: 80, readOnly: true},
     );
     posSpreadSetting.cols.push(
         {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
+        {title: '档案限制', colSpan: '1', rowSpan: '2', field: 'dagl_limit', hAlign: 0, width: 80, readOnly: true},
     );
     // 数量变更列,添加按钮
     const qcCol = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'});
@@ -1924,6 +1926,7 @@ $(document).ready(() => {
         },
         selectionChanged: function (e, info) {
             stagePosSpreadObj.loadExprToInput(info.sheet);
+            console.log(SpreadJsObj.getSelectObject(info.sheet));
         },
         addPegs: function (pegs) {
             if (!pegs || pegs.length <= 0) return;

+ 1 - 1
app/view/setting/s2b.ejs

@@ -54,7 +54,7 @@
                                         <% } else { %>
                                         <td>
                                             <div class="input-group input-group-sm" style="width:90px">
-                                                <input type="number" class="form-control" max="100" min="0" step="2" value="100" value="<%- s.ratio || 100 %>" status="<%- s.value %>" onchange="updateStatusRatio(this);">
+                                                <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 100 %>" status="<%- s.value %>" onchange="updateStatusRatio(this);">
                                                 <div class="input-group-append">
                                                     <span class="input-group-text">%</span>
                                                 </div>