Browse Source

数据检查,检查计量单元,数量是否为0

MaiXinRong 3 years ago
parent
commit
1e9727c6eb
3 changed files with 20 additions and 0 deletions
  1. 1 0
      app/public/js/ledger.js
  2. 18 0
      app/public/js/ledger_check.js
  3. 1 0
      app/public/js/revise.js

+ 1 - 0
app/public/js/ledger.js

@@ -42,6 +42,7 @@ const checkOption = {
         fields: ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'],
     },
     zero: { enable: 1 },
+    zeroPos: { enable: 1 },
     tp: {
         enable: 1,
         fields: [

+ 18 - 0
app/public/js/ledger_check.js

@@ -14,6 +14,7 @@ const ledgerCheckType = {
     empty_code: {value: 2, text: '项目节、清单编号同时为空', fun: 'checkCodeEmpty', },
     calc: {value: 3, text: '清单数量不等于计量单元之和', fun: 'checkCalc', },
     zero: {value: 4, text: '清单数量或单价为0', fun: 'checkZero', },
+    zeroPos: {value: 12, text: '计量单元数量为0', fun: 'checkZeroPos', },
     tp: {value: 5, text: '清单金额≠数量×单价', fun: 'checkTp', },
     over: {value: 6, text: '超计', fun: 'checkOver', },
     same_code: {value: 7, text: '重复项目节', fun: 'checkSameCode', },
@@ -91,6 +92,23 @@ const ledgerCheckUtil = {
         }
         return error;
     },
+    checkZeroPos: function (ledgerTree, ledgerPos, decimal, option) {
+        const error = [];
+        for (const node of ledgerTree.nodes) {
+            if (node.children && node.children.length > 0) continue;
+
+            const nodePos = ledgerPos.getLedgerPos(node.id);
+            if (!nodePos || nodePos.length === 0) continue;
+
+            for (const np of nodePos) {
+                if (checkZero(np.sgfh_qty) && checkZero(np.qtcl_qty) && checkZero(np.sjcl_qty) && checkZero(np.quantity)) {
+                    error.push(node);
+                    break;
+                }
+            }
+        }
+        return error;
+    },
     checkTp: function (ledgerTree, ledgerPos, decimal, option) {
         const error = [];
         for (const node of ledgerTree.nodes) {

+ 1 - 0
app/public/js/revise.js

@@ -36,6 +36,7 @@ const checkOption = {
         fields: ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'],
     },
     zero: { enable: 1 },
+    zeroPos: { enable: 1 },
     tp: {
         enable: 1,
         fields: [