소스 검색

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

Tony Kang 10 달 전
부모
커밋
109052c80e

+ 8 - 0
app/const/profile.js

@@ -50,6 +50,14 @@ const cert = {
     certQual: cert_qual,
     postCertConst: post_cert_const,
     eduJsonConst: edu_json,
+    getCertName: function(iType, iCert) {
+        const cType = cert_type.find(x => { return x.value === iType; });
+        if (!cType) return ['', ''];
+        const source = this[cType.source];
+        if (!source) return [cType.name, ''];
+        const cCert = source.find(x => { return x.value === iCert; });
+        return [cType.name, cCert ? cCert.name : ''];
+    }
 };
 
 module.exports = {

+ 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']);

+ 4 - 3
app/public/js/shares/batch_import.js

@@ -128,8 +128,8 @@ const BatchImportStageGcl = function (setting) {
                 $('#bi-download-error').hide();
             }
         },
-        importStageGcl: async function (node, cover, ignore) {
-            const updateData = { lid: node.lid, type: 'stage', cover, ignore, tenders: [] };
+        importStageGcl: async function (node, cover, ignore, loadChange) {
+            const updateData = { lid: node.lid, type: 'stage', cover, ignore, loadChange, tenders: [] };
             for (const tender of node.children) {
                 updateData.tenders.push({ tid: tender.tid, name: tender.name, stageCount: tender.stageCount, stage: tender.stage });
             }
@@ -153,6 +153,7 @@ const BatchImportStageGcl = function (setting) {
             this.beforeBatchImport();
             const cover = $('#bi-cover')[0].checked;
             const ignore = $('#bi-ignore')[0].checked;
+            const change = $('#bi-change')[0].checked;
             for (const node of this.batchTree.children) {
                 if (!node.selected) continue;
 
@@ -163,7 +164,7 @@ const BatchImportStageGcl = function (setting) {
                     try {
                         node.status = '开始导入';
                         SpreadJsObj.reLoadRowData(biObj.sheet, row);
-                        await biObj.importStageGcl(node, cover, ignore);
+                        await biObj.importStageGcl(node, cover, ignore, change);
                         node.status = '导入完成';
                     } catch(err) {
                         console.log(err);

+ 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 => {

+ 1 - 1
app/public/js/shenpi.js

@@ -1328,7 +1328,7 @@ $(document).ready(function () {
         }
         console.log(prop);
         postData('/tender/' + cur_tenderid + '/shenpi/audit/save', prop, function (data) {
-            const flow = findSplc(code);
+            // const flow = findSplc(code);
             const index = flow.groupList.findIndex(x => { return x.id === group.id; });
             flow.groupList.splice(index, 1);
             flow.auditGroupList = flow.groupList.length > 0 ? flow.groupList[0].auditGroupList : [];

+ 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 '您导入的数据存在大量数据错误,请您仔细检查';
 

+ 2 - 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` +
@@ -121,6 +121,7 @@ module.exports = app => {
                 for (const prop in eduInfo) {
                    x['edu_info_' + prop] = eduInfo[prop];
                 }
+                [x.ac_type_str, x.ac_name_str] = profileConst.cert.getCertName(x.type, x.ac_name);
             });
             return result;
         }

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

@@ -19,6 +19,10 @@
                                 <input class="form-check-input" type="checkbox" id="bi-ignore">
                                 <label class="form-check-label" for="bi-ignore">以本标段清单为准</label>
                             </div>
+                            <div class="form-check form-check-inline">
+                                <input class="form-check-input" type="checkbox" id="bi-change">
+                                <label class="form-check-label" for="bi-change">含变更</label>
+                            </div>
                         </div>
                         <div class="ml-auto">
                             <button class="btn btn-sm btn-primary" id="bi-start">导入</button>

+ 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">

+ 0 - 1
app/view/tender/shenpi.ejs

@@ -235,7 +235,6 @@
 </div>
 <script>
     const sp_lc = JSON.parse(unescape('<%- escape(JSON.stringify(shenpi.sp_lc)) %>'));
-    console.log(sp_lc);
     const sp_type = JSON.parse('<%- JSON.stringify(shenpi.sp_type) %>');
     const sp_status = JSON.parse('<%- JSON.stringify(shenpi.sp_status) %>');
     const sp_status_list = JSON.parse('<%- JSON.stringify(shenpi.sp_status_list) %>');