Prechádzať zdrojové kódy

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

TonyKang 4 rokov pred
rodič
commit
ae9eb42b51

+ 21 - 20
app/public/js/ledger.js

@@ -34,6 +34,25 @@ function getExprInfo (field) {
 function transExpr(expr) {
     return expr.replace('=', '').replace('%', '/100');
 }
+const checkOption = {
+    sibling: { enable: 1 },
+    empty_code: { enable: 1 },
+    calc: {
+        enable: 1,
+        fields: ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'],
+    },
+    zero: { enable: 1 },
+    tp: {
+        enable: 1,
+        fields: [
+            {qty: 'sgfh_qty', tp: 'sgfh_tp'},
+            {qty: 'sjcl_qty', tp: 'sjcl_tp'},
+            {qty: 'qtcl_qty', tp: 'qtcl_tp'},
+            {qty: 'quantity', tp: 'total_price'},
+            {qty: 'deal_qty', tp: 'deal_tp'},
+        ],
+    }
+};
 
 $(document).ready(function() {
     let stdXmj, stdGcl, dealBills, searchLedger;
@@ -101,7 +120,7 @@ $(document).ready(function() {
         selector: '#check-list',
         relaSpread: ledgerSpread,
         storeKey: 'ledger-check-' + getTenderId(),
-        checkType: ledgerCheckType,
+        checkType: getCheckType(checkOption),
         afterLocated:  function () {
             posOperationObj.loadCurPosData();
         },
@@ -3394,25 +3413,7 @@ $(document).ready(function() {
             ledgerPos: pos,
             checkList: checkList,
             decimal: tenderInfo.decimal,
-            checkOption: {
-                sibling: { enable: 1 },
-                empty_code: { enable: 1 },
-                calc: {
-                    enable: 1,
-                    fields: ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'],
-                },
-                zero: { enable: 1 },
-                tp: {
-                    enable: 1,
-                    fields: [
-                        {qty: 'sgfh_qty', tp: 'sgfh_tp'},
-                        {qty: 'sjcl_qty', tp: 'sjcl_tp'},
-                        {qty: 'qtcl_qty', tp: 'qtcl_tp'},
-                        {qty: 'quantity', tp: 'total_price'},
-                        {qty: 'deal_qty', tp: 'deal_tp'},
-                    ],
-                },
-            }
+            checkOption: checkOption,
         });
         check2Viewing({
             extra: ZhCalc.div(ledgerTree.datas.length + pos.datas.length, 10000, 0),

+ 19 - 2
app/public/js/ledger_check.js

@@ -114,9 +114,17 @@ const ledgerCheckUtil = {
                 }
             }
             if (node.is_tp) {
-                if (node.end_contract_tp > node.total_price) error.push(node);
+                if (option.isTz) {
+                    if (node.end_contract_tp > node.total_price) error.push(node);
+                } else {
+                    if (node.end_contract_tp > node.deal_tp) error.push(node);
+                }
             } else {
-                if (node.end_contract_qty > node.quantity) error.push(node);
+                if (option.isTz) {
+                    if (node.end_contract_qty > node.quantity) error.push(node);
+                } else {
+                    if (node.end_contract_qty > node.deal_qty) error.push(node);
+                }
             }
         }
         return error;
@@ -181,4 +189,13 @@ const ledgerCheck2 = function (setting) {
         setting.checkList.hide();
     }
     return progressData;
+};
+const getCheckType = function (option) {
+    const result = {};
+    for (const o in option) {
+        if (option[o].enable) {
+            result[o] = ledgerCheckType[o];
+        }
+    }
+    return result;
 };

+ 35 - 25
app/public/js/revise.js

@@ -28,6 +28,25 @@ function transExpr(expr) {
     return $.trim(expr).replace('\t', '').replace('=', '').replace('%', '/100');
 }
 const copyBlockTag = 'zh.calc.copyBlock';
+const checkOption = {
+    sibling: { enable: 1 },
+    empty_code: { enable: 1 },
+    calc: {
+        enable: 1,
+        fields: ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'],
+    },
+    zero: { enable: 1 },
+    tp: {
+        enable: 1,
+        fields: [
+            {qty: 'sgfh_qty', tp: 'sgfh_tp'},
+            {qty: 'sjcl_qty', tp: 'sjcl_tp'},
+            {qty: 'qtcl_qty', tp: 'qtcl_tp'},
+            {qty: 'quantity', tp: 'total_price'},
+            {qty: 'deal_qty', tp: 'deal_tp'},
+        ],
+    },
+};
 
 $(document).ready(() => {
     let stdXmj, stdGcl, searchLedger;
@@ -65,7 +84,7 @@ $(document).ready(() => {
         selector: '#check-list',
         relaSpread: billsSpread,
         storeKey: 'revise-check-' + window.location.pathname.split('/')[2] + '-' + window.location.pathname.split('/')[4],
-        checkType: ledgerCheckType,
+        checkType: getCheckType(checkOption),
         afterLocated:  function () {
             posSpreadObj.loadCurPosData();
         },
@@ -2559,30 +2578,21 @@ $(document).ready(() => {
         errorList: errorList,
     });
 
-    LedgerChecker({
-        ledgerTree: billsTree,
-        ledgerPos: pos,
-        checkList: checkList,
-        decimal: decimal,
-        checkOption: {
-            sibling: { enable: 1 },
-            empty_code: { enable: 1 },
-            calc: {
-                enable: 1,
-                fields: ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'],
-            },
-            zero: { enable: 1 },
-            tp: {
-                enable: 1,
-                fields: [
-                    {qty: 'sgfh_qty', tp: 'sgfh_tp'},
-                    {qty: 'sjcl_qty', tp: 'sjcl_tp'},
-                    {qty: 'qtcl_qty', tp: 'qtcl_tp'},
-                    {qty: 'quantity', tp: 'total_price'},
-                    {qty: 'deal_qty', tp: 'deal_tp'},
-                ],
-            },
-        }
+    $('#ledger-check2').click(() => {
+        const result = ledgerCheck2({
+            ledgerTree: billsTree,
+            ledgerPos: pos,
+            checkList: checkList,
+            decimal: decimal,
+            checkOption: checkOption,
+        });
+        check2Viewing({
+            extra: ZhCalc.div(billsTree.datas.length + pos.datas.length, 10000, 0),
+            randomWait: true,
+            prefix: 'check2-',
+            checks: result,
+            checkList: checkList,
+        })
     });
 
     $('[name=revise-start]').submit(function (e) {

+ 26 - 24
app/public/js/stage.js

@@ -166,8 +166,31 @@ function getDaglText(data) {
     return def ? def.name : '';
 }
 
+
 $(document).ready(() => {
     let detail, searchLedger, checkedChanges;
+    const checkOption = {
+        sibling: { enable: 0 },
+        empty_code: { enable: 0 },
+        calc: {
+            enable: 1,
+            fields: ['contract_qty', 'qc_qty'],
+        },
+        zero: { enable: 0 },
+        tp: {
+            enable: 1,
+            fields: [
+                {qty: 'contract_qty', tp: 'contract_tp'},
+                {qty: 'qc_qty', tp: 'qc_tp'},
+            ],
+            filter: function (node) {
+                return node.is_tp;
+            }
+        },
+        over: {
+            enable: 1, isTz: checkTzMeasureType(),
+        }
+    };
     // 界面布局
     autoFlashHeight();
     // 初始化 台账树结构 数据结构
@@ -204,7 +227,7 @@ $(document).ready(() => {
             if (node.end_contract_qty) {
                 node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
             } else {
-                node.end_correct_tp = node.end_gather;
+                node.end_correct_tp = node.end_gather_tp;
             }
         }
         node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
@@ -677,7 +700,7 @@ $(document).ready(() => {
         selector: '#check-list',
         relaSpread: slSpread,
         storeKey: 'stage-check-' + window.location.pathname.split('/')[2] + '-' + window.location.pathname.split('/')[4],
-        checkType: ledgerCheckType,
+        checkType: getCheckType(checkOption),
         afterLocated:  function () {
             stagePosSpreadObj.loadCurPosData();
         },
@@ -3716,28 +3739,7 @@ $(document).ready(() => {
         ledgerPos: stagePos,
         checkList: checkList,
         decimal: tenderInfo.decimal,
-        checkOption: {
-            sibling: { enable: 0 },
-            empty_code: { enable: 0 },
-            calc: {
-                enable: 1,
-                fields: ['contract_qty', 'qc_qty'],
-            },
-            zero: { enable: 0 },
-            tp: {
-                enable: 1,
-                fields: [
-                    {qty: 'contract_qty', tp: 'contract_tp'},
-                    {qty: 'qc_qty', tp: 'qc_tp'},
-                ],
-                filter: function (node) {
-                    return node.is_tp;
-                }
-            },
-            over: {
-                enable: 1, isTz: checkTzMeasureType(),
-            }
-        }
+        checkOption: checkOption,
     };
     if (!checkTzMeasureType()) {
         stageCheckerSetting.checkOption.calc.fields.push('sgfh_qty', 'sjcl_qty', 'qtcl_qty', 'quantity');

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

@@ -930,6 +930,7 @@ $(document).ready(() => {
 
     const deadlineObj = {
         initView(pay) {
+            $('#dl-pay-name').html(pay.name);
             // 模式
             $('[name=dl-type][value=' + pay.dl_type +']')[0].checked = true;
             // 计量期数

+ 1 - 1
app/view/revise/info.ejs

@@ -45,7 +45,7 @@
             <% } %>
             <div class="ml-auto">
                 <% if (revise.status !== audit.status.checked) { %>
-                    <a class="btn btn-sm btn-primary mr-1" href="#ledger-check-modal" data-toggle="modal" data-target="#ledger-check-modal">数据检查</a>
+                    <a class="btn btn-sm btn-primary mr-1" id="ledger-check2" href="javascript: void(0);">数据检查</a>
                 <% } %>
                 <% if (revise.status === audit.status.uncheck && revise.uid === ctx.session.sessionUser.accountId) { %>
                 <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm mr-1">上报审批</a>

+ 1 - 1
app/view/revise/info_modal.ejs

@@ -720,7 +720,7 @@
     <% include ../shares/import_excel_modal.ejs %>
     <% include ../shares/delete_hint_modal.ejs %>
     <% include ../shares/check_data_modal.ejs %>
-    <% include ../shares/ledger_check_modal.ejs %>
+    <% include ../shares/check_modal2.ejs %>
     <% if(ctx.session.sessionUser.accountId === revise.uid && (revise.status === auditConst.status.uncheck || revise.status === auditConst.status.checkNo)) { %>
     <script>
         const cur_uid = '<%- ctx.session.sessionUser.accountId %>';

+ 1 - 1
app/view/stage/pay_modal.ejs

@@ -6,7 +6,7 @@
                 <h5 class="modal-title">设置计提期限</h5>
             </div>
             <div class="modal-body">
-                <p>请设置付(扣)款项 <b>本期应付</b> 的计提期限</p>
+                <p>请设置付(扣)款项 <b id="dl-pay-name">本期应付</b> 的计提期限</p>
                 <div class="form-group">
                     <label for="formGroupExampleInput">限制模式为:</label>
                     <div>

+ 1 - 0
config/web.js

@@ -227,6 +227,7 @@ const JsFiles = {
                     '/public/js/zh_calc.js',
                     '/public/js/path_tree.js',
                     '/public/js/std_lib.js',
+                    '/public/js/ledger_check.js',
                     '/public/js/revise.js',
                 ],
                 mergeFile: 'revise',