瀏覽代碼

审批时,多人协同,未计量部分,不须再次确认

MaiXinRong 2 年之前
父節點
當前提交
3aa69b69cb
共有 2 個文件被更改,包括 35 次插入2 次删除
  1. 33 2
      app/public/js/stage.js
  2. 2 0
      sql/update.sql

+ 33 - 2
app/public/js/stage.js

@@ -334,6 +334,33 @@ $(document).ready(() => {
         $('#cooperationSelect').html(selectHtml.join(''));
     };
 
+    function checkUsed(tree, pos, node) {
+        if (node.children && node.children.length > 0) {
+            const posterity = tree.getPosterity(node);
+            for (const p of posterity) {
+                if (p.children && p.children.length > 0) continue;
+                if (!checkZero(p.contract_qty) || !checkZero(p.contract_tp) ||
+                    !checkZero(p.qc_qty) || !checkZero(p.qc_tp) || !checkZero(p.qc_minus_qty))
+                    return true;
+                const pPos = pos.getLedgerPos(p.id);
+                if (!pPos || pPos.length === 0) continue;
+                for (const pp of pPos) {
+                    if (!checkZero(pp.contract_qty) || !checkZero(pp.qc_qty) || !checkZero(pp.qc_minus_qty)) return true;
+                }
+            }
+            return false;
+        } else {
+            if (!checkZero(node.contract_qty) || !checkZero(node.contract_tp) ||
+                !checkZero(node.qc_qty) || !checkZero(node.qc_tp) || !checkZero(node.qc_minus_qty))
+                return true;
+            const pPos = pos.getLedgerPos(node.id);
+            if (!pPos || pPos.length === 0) return false;
+            for (const pp of pPos) {
+                if (!checkZero(pp.contract_qty) || !checkZero(pp.qc_qty) || !checkZero(pp.qc_minus_qty)) return true;
+            }
+        }
+    }
+
     const reloadCooperationHtml = function () {
         const html = [];
         const select = $('#cooperationSelect').val();
@@ -350,7 +377,9 @@ $(document).ready(() => {
                 html.push('<td>', p.check ? `已解锁:${p.pwd}` : `<a name="ledger-unlock" lid="${p.ledger_id}" href="javascript: void(0);">解锁</a>`, '</td>');
             }
             html.push('<td>', p.company, '</td>');
-            if (p.check && p.confirm) {
+            if (stage.status === auditConst.status.checking && !checkUsed(stageTree, stagePos, p.node)) {
+                html.push('<td>', '本期未计量', '</td>');
+            } else if (p.check && p.confirm) {
                 html.push('<td>', moment(p.confirm_time).format('YYYY-MM-DD HH:mm') + ' ' + (coopwd ? `<a name="ledger-unconfirm" href="javascript: void(0);" lid="${p.ledger_id}">重新审批</a>` : ''), '</td>');
             } else if (!p.check && p.confirm) {
                 html.push('<td>', moment(p.confirm_time).format('YYYY-MM-DD HH:mm'), '</td>');
@@ -4582,15 +4611,17 @@ $(document).ready(() => {
     });
     $('#audit-check0').submit(function (e) {
         // 再检查多人协同确认情况
-        const list = stageTree.pwd.find(x => {return !x.confirm });
+        const list = stageTree.pwd.find(x => {return !x.confirm && checkUsed(stageTree, stagePos, x.node) });
         if(list) {
             toastr.error('请检查多人协同确认情况再审批通过');
             $('#hide-all').hide();
             return false;
         }
         const checkType = parseInt($('[name=checkType]').val());
+        const noUsed = stageTree.pwd.filter(x => {return !checkUsed(stageTree, stagePos, x.node) });
         const data = {
             opinion: $(`${'#sp-done'}`).find('[name=opinion]').val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '),
+            noUsed: noUsed.map(x => { return x.id; }),
             checkType,
         };
         $('#sp-done').modal('hide');

+ 2 - 0
sql/update.sql

@@ -0,0 +1,2 @@
+ALTER TABLE `zh_stage_audit`
+ADD COLUMN `lock_lid`  text NULL COMMENT '锁定台账id(以,分隔)' AFTER `opinion`;