浏览代码

导入其他标段数据计量数据,不导入变更

MaiXinRong 9 月之前
父节点
当前提交
77134e6f3f

+ 1 - 1
app/controller/tender_controller.js

@@ -1455,7 +1455,7 @@ module.exports = app => {
                         ctx.body = {err: 0, msg: '', data: reviseData};
                         break;
                     case 'stage':
-                        const stageData = await this.ctx.service.stageBills.sumLoad(data.lid, data.tenders, data.cover, data.ignore);
+                        const stageData = await this.ctx.service.stageBills.sumLoad(data.lid, data.tenders, data.cover, data.ignore, data.change);
                         stageData.import_change = { target: { import_lid: data.lid } };
                         stageData.import_change.data = await this.ctx.service.stageImportChange.getLeafXmjStageImportData(ctx.stage, data.lid);
                         await ctx.service.stage.updateCheckCalcFlag(ctx.stage, true);

+ 19 - 16
app/lib/sum_load.js

@@ -30,6 +30,7 @@ class loadGclBaseTree {
 
         this.ignoreParent = setting.ignoreParent;
         this.ignoreNotFind = setting.ignoreNotFind;
+        this.loadChange = setting.loadChange;
 
         // 缓存
         this.keyNodeId = setting.maxId ? setting.maxId + 1 : 1;
@@ -387,15 +388,17 @@ class gatherStageGclTree extends loadGclBaseTree {
             node.contract_qty = this.ctx.helper.add(node.contract_qty, source.contract_qty);
             node.contract_tp = this.ctx.helper.mul(node.unit_price, node.contract_qty, this.ctx.tender.info.decimal.tp);
 
-            node.qc_qty = this.ctx.helper.add(node.qc_qty, source.qc_qty);
-            node.qc_tp = this.ctx.helper.mul(node.unit_price, node.qc_qty, this.ctx.tender.info.decimal.tp);
-            node.qc_minus_qty = this.ctx.helper.add(node.qc_minus_qty, source.qc_minus_qty);
-            node.positive_qc_qty = this.ctx.helper.add(node.positive_qc_qty, source.positive_qc_qty);
-            node.positive_qc_tp = this.ctx.helper.mul(node.unit_price, node.positive_qc_qty, this.ctx.tender.info.decimal.tp);
-            node.negative_qc_qty = this.ctx.helper.add(node.negative_qc_qty, source.negative_qc_qty);
-            node.negative_qc_tp = this.ctx.helper.mul(node.unit_price, node.negative_qc_qty, this.ctx.tender.info.decimal.tp);
+            if (this.loadChange) {
+                node.qc_qty = this.ctx.helper.add(node.qc_qty, source.qc_qty);
+                node.qc_tp = this.ctx.helper.mul(node.unit_price, node.qc_qty, this.ctx.tender.info.decimal.tp);
+                node.qc_minus_qty = this.ctx.helper.add(node.qc_minus_qty, source.qc_minus_qty);
+                node.positive_qc_qty = this.ctx.helper.add(node.positive_qc_qty, source.positive_qc_qty);
+                node.positive_qc_tp = this.ctx.helper.mul(node.unit_price, node.positive_qc_qty, this.ctx.tender.info.decimal.tp);
+                node.negative_qc_qty = this.ctx.helper.add(node.negative_qc_qty, source.negative_qc_qty);
+                node.negative_qc_tp = this.ctx.helper.mul(node.unit_price, node.negative_qc_qty, this.ctx.tender.info.decimal.tp);
+            }
         }
-        this._gatherChange(node, source);
+        if (this.loadChange) this._gatherChange(node, source);
         return node;
     }
     getUpdateData() {
@@ -409,14 +412,14 @@ class gatherStageGclTree extends loadGclBaseTree {
             }
             if (bn.is_import || this.cover || bn.contract_qty !== bn.org_contract_qty || bn.contract_tp !== bn.org_contract_tp || bn.qc_qty !== bn.org_qc_qty || bn.qc_minus_qty !== bn.org_qc_minus_qty) {
                 let data = { lid: bn.id, contract_qty: bn.contract_qty, contract_tp: bn.contract_tp };
-                if (!bn.is_import && bn.org_qc_qty) {
+                if (!this.loadChange || (!bn.is_import && bn.org_qc_qty)) {
                     data.qc_qty = bn.org_qc_qty;
                     data.qc_tp = bn.org_qc_tp;
                     data.qc_minus_qty = bn.org_qc_minus_qty || 0;
-                    data.positive_qc_qty = bn.positive_qc_qty || 0;
-                    data.positive_qc_tp = bn.positive_qc_tp || 0;
-                    data.negative_qc_qty = bn.negative_qc_qty || 0;
-                    data.negative_qc_tp = bn.negative_qc_tp || 0;
+                    data.positive_qc_qty = bn.org_positive_qc_qty || 0;
+                    data.positive_qc_tp = bn.org_positive_qc_tp || 0;
+                    data.negative_qc_qty = bn.org_negative_qc_qty || 0;
+                    data.negative_qc_tp = bn.org_negative_qc_tp || 0;
                 } else {
                     data.qc_qty = bn.qc_qty;
                     data.qc_tp = bn.qc_tp;
@@ -428,7 +431,7 @@ class gatherStageGclTree extends loadGclBaseTree {
                 }
                 result.update.push(data);
             }
-            if (bn.change_detail && bn.change_detail.length > 0) {
+            if (this.loadChange && bn.change_detail && bn.change_detail.length > 0) {
                 for (const cd of bn.change_detail) {
                     result.qc_detail.push({
                         lid: bn.id, rela_tid: cd.tid, rela_sid: cd.sid, rela_lid: cd.lid, rela_cid: cd.cid, rela_cbid: cd.cbid, rela_qty: cd.qty, rela_minus: cd.minus, rela_no_value: cd.no_value, unit_price: bn.unit_price,
@@ -549,10 +552,10 @@ class sumLoad {
         }
     }
 
-    async stageGatherGcl(select, maxId, tenders, defaultData, cover, ignore) {
+    async stageGatherGcl(select, maxId, tenders, defaultData, cover, ignore, loadChange) {
         const ignoreParent = this.ctx.tender.info.fun_rela.sum_load.ignoreParent;
         this.loadTree = new gatherStageGclTree(this.ctx, {
-            parent: select, maxId, type: 'ledger', defaultData, ignoreParent, cover, ignoreNotFind: ignore,
+            parent: select, maxId, type: 'ledger', defaultData, ignoreParent, cover, ignoreNotFind: ignore, loadChange,
         });
         const posterity = await this.ctx.service.ledger.getPosterityByParentId(this.ctx.tender.id, select.ledger_id);
         const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);

+ 1 - 0
app/public/js/shares/tender_select.js

@@ -184,6 +184,7 @@ const TenderSelect = function (setting) {
                 if (tsObj.setting.type === 'stage') {
                     updateData.cover = $('#ts-cover')[0].checked;
                     updateData.ignore = $('#ts-ignore')[0].checked;
+                    updateData.change = $('#ts-change')[0].checked;
                 }
                 if (updateData.tenders.length > 0) {
                     postData(window.location.pathname + '/sumLoad', updateData, result => {

+ 2 - 2
app/service/stage_bills.js

@@ -527,13 +527,13 @@ module.exports = app => {
             return { contract_tp, qc_tp };
         }
 
-        async sumLoad(lid, tenders, cover, ignore) {
+        async sumLoad(lid, tenders, cover, ignore, loadChange) {
             const conn = await this.db.beginTransaction();
             try {
                 const maxId = await this.ctx.service.ledger._getMaxLid(this.ctx.tender.id);
                 const select = await this.ctx.service.ledger.getCompleteDataById(lid);
                 const sumLoad = new SumLoad(this.ctx);
-                const loadTree = await sumLoad.stageGatherGcl(select, maxId, tenders, null, cover, ignore);
+                const loadTree = await sumLoad.stageGatherGcl(select, maxId, tenders, null, cover, ignore, loadChange);
                 const result = loadTree.getUpdateData();
                 // if (result.errors.length > 100) throw '您导入的数据存在大量数据错误,请您仔细检查';
 

+ 1 - 1
app/service/tender_cert.js

@@ -108,7 +108,7 @@ module.exports = app => {
         }
 
         async getAllCert(tenderId) {
-            const sql = 'SELECT tc.uid, tc.cert_id, tc.department, tc.job_time, tc.remark,' +
+            const sql = 'SELECT tc.id, tc.uid, tc.uid, tc.cert_id, tc.department, tc.job_time, tc.remark,' +
                 '    ac.type, ac.name as ac_name, ac.code, ac.reg_unit, ac.job_title, ac.file_name, ac.file_path, ac.edu_json,' +
                 '    pa.account, pa.name, pa.role, pa.company' +
                 `  FROM ${this.tableName} tc LEFT JOIN ${this.ctx.service.accountCert.tableName} ac ON tc.cert_id = ac.id` +

+ 4 - 0
app/view/shares/tender_select_modal.ejs

@@ -27,6 +27,10 @@
                                 <input class="form-check-input" type="checkbox" id="ts-ignore">
                                 <label class="form-check-label" for="ts-ignore">以本标段清单为准</label>
                             </div>
+                            <div class="form-check form-check-inline">
+                                <input class="form-check-input" type="checkbox" id="ts-change">
+                                <label class="form-check-label" for="ts-change">含变更</label>
+                            </div>
                         </div>
                     </div>
                     <div id="tender-select-hint">