Переглянути джерело

台账分解、台账修订、变更台账,数据检查新增检查同部位清单

MaiXinRong 11 місяців тому
батько
коміт
07b69e6bad

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

@@ -49,6 +49,7 @@ const checkOption = {
         ],
         ],
     },
     },
     same_code: { enable: 1 },
     same_code: { enable: 1 },
+    same_bills: { enable: 1 },
 };
 };
 
 
 $(document).ready(() => {
 $(document).ready(() => {

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

@@ -56,6 +56,7 @@ const checkOption = {
         ],
         ],
     },
     },
     same_code: { enable: 1 },
     same_code: { enable: 1 },
+    same_bills: { enable: 1 },
 };
 };
 
 
 $(document).ready(function() {
 $(document).ready(function() {

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

@@ -19,6 +19,7 @@ const ledgerCheckType = {
     tp: {value: 5, text: '清单金额≠数量×单价', fun: 'checkTp', },
     tp: {value: 5, text: '清单金额≠数量×单价', fun: 'checkTp', },
     over: {value: 6, text: '超计', fun: 'checkOver', },
     over: {value: 6, text: '超计', fun: 'checkOver', },
     same_code: {value: 7, text: '重复项目节', fun: 'checkSameCode', },
     same_code: {value: 7, text: '重复项目节', fun: 'checkSameCode', },
+    same_bills: {value: 14, text: '重复清单(同部位)', fun: 'checkSameBwBills', },
     limit3f: {
     limit3f: {
         fun: 'check3fLimit', items: [
         fun: 'check3fLimit', items: [
             { value: 8, text: '违规计量(工序报验)', key: 'gxbyOver', type: 'gxby', },
             { value: 8, text: '违规计量(工序报验)', key: 'gxbyOver', type: 'gxby', },
@@ -183,6 +184,33 @@ const ledgerCheckUtil = {
         }
         }
         return error;
         return error;
     },
     },
+    checkSameBwBills: function(ledgerTree, ledgerPos, decimal, option) {
+        const error = [];
+        for (const node of ledgerTree.nodes) {
+            if (!node.children || node.children.length === 0) continue;
+
+            const gatherGcl = [];
+            for (const child of node.children) {
+                if (!child.b_code) continue;
+
+                let gcl = gatherGcl.find(g => {
+                    return g.b_code === child.b_code &&
+                        (g.name || child.name ? g.name === child.name : true) &&
+                        (g.unit || child.unit ? g.unit === child.unit : true) &&
+                        checkZero(ZhCalc.sub(g.unit_price, child.unit_price));
+                });
+                if (!gcl) {
+                    gcl = { source: [], b_code: child.b_code || '', name: child.name || '', unit: child.unit || '', unit_price: child.unit_price || 0 }
+                    gatherGcl.push(gcl);
+                }
+                gcl.source.push(child);
+            }
+            gatherGcl.forEach(g => {
+                if (g.source.length > 1) error.push(...g.source);
+            })
+        }
+        return error;
+    },
     check3fLimit: function (ledgerTree, ledgerPos, decimal, option) {
     check3fLimit: function (ledgerTree, ledgerPos, decimal, option) {
         const error = {};
         const error = {};
         for (const i of ledgerCheckType.limit3f.items) {
         for (const i of ledgerCheckType.limit3f.items) {

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

@@ -48,6 +48,8 @@ const checkOption = {
             {qty: 'deal_qty', tp: 'deal_tp'},
             {qty: 'deal_qty', tp: 'deal_tp'},
         ],
         ],
     },
     },
+    same_code: { enable: 1 },
+    same_bills: { enable: 1 },
 };
 };
 
 
 $(document).ready(() => {
 $(document).ready(() => {