浏览代码

报表,中间计量数据问题

MaiXinRong 5 年之前
父节点
当前提交
8cccb6ffe3
共有 2 个文件被更改,包括 30 次插入48 次删除
  1. 30 31
      app/lib/stage_im.js
  2. 0 17
      app/service/report_memory.js

+ 30 - 31
app/lib/stage_im.js

@@ -332,11 +332,10 @@ class StageIm {
             if (p.children && p.children.length > 0) {
                 this._recursiveGenerateTzGclBills(p, im);
             } else {
-                if ((!p.b_code || p.b_code === '') || (p.children && p.children.length > 0)) {
-                    continue;
-                }
-                if (!this.ctx.helper.checkZero(p.contract_qty) || !this.ctx.helper.checkZero(p.contract_tp) ||
-                    !this.ctx.helper.checkZero(p.qc_qty) || !this.ctx.helper.checkZero(p.qc_tp)) {
+                if ((!p.b_code || p.b_code === '') || (p.children && p.children.length > 0)) continue;
+
+                if (this.ctx.helper.checkZero(p.contract_qty) && this.ctx.helper.checkZero(p.contract_tp) &&
+                    this.ctx.helper.checkZero(p.qc_qty) && this.ctx.helper.checkZero(p.qc_tp)) {
                     continue;
                 }
                 let b = this._.find(im.gclBills, { bid: p.id });
@@ -419,7 +418,7 @@ class StageIm {
         if (node.children && node.children.length > 0) {
             const posterity = this.billsTree.getPosterity(node);
             for (const p of posterity) {
-                if (!p.children || p.children.length === 0) continue;
+                if (p.children && p.children.length > 0) continue;
                 if (!helper.checkZero(p.contract_qty) || !helper.checkZero(p.contract_tp) ||
                     !helper.checkZero(p.qc_qty) || !helper.checkZero(p.qc_tp))
                     return true;
@@ -447,32 +446,32 @@ class StageIm {
      * @param {Object} node - 生成中间计量表的节点
      */
     _generateTzImData(node) {
-        if (this._checkUsed(node)) {
-            const nodeIndex = this.billsTree.getNodeSerialNo(node);
-            const peg = this._getPegNode(node);
-            const im = {
-                id: this.ImData.length + 1,
-                lid: node.id, pid: '', code: node.code,
-                jl: node.gather_tp, contract_jl: node.contract_tp, qc_jl: node.qc_tp,
-                pre_jl: node.pre_gather_tp, pre_contract_jl: node.pre_contract_tp, pre_qc_jl: node.pre_qc_tp,
-                end_jl: node.end_gather_tp, end_contract_jl: node.end_contract_tp, end_qc_jl: node.end_qc_tp,
-                peg: peg ? this._getPegStr(peg.name) : '', drawing_code: this._getDrawingCode(node),
-                position: '',
-                lIndex: nodeIndex,
-            };
-            if (this.ctx.stage.im_gather && node.check) {
-                im.bw = this._getZlGatherBw(node, peg);
-                im.xm = '';
-            } else {
-                im.bw = this._getZlNormalBw(node, peg);
-                im.xm = node.name;
-            }
-            this._checkCustomDetail(im);
-            im.check = this.ctx.stage.im_gather && node.check;
-            this._generateTzGclBillsData(node, im);
-            this.ImData.push(im);
-            this._generateTzChangeData(node, im);
+        if (!this._checkUsed(node)) return;
+
+        const nodeIndex = this.billsTree.getNodeSerialNo(node);
+        const peg = this._getPegNode(node);
+        const im = {
+            id: this.ImData.length + 1,
+            lid: node.id, pid: '', code: node.code,
+            jl: node.gather_tp, contract_jl: node.contract_tp, qc_jl: node.qc_tp,
+            pre_jl: node.pre_gather_tp, pre_contract_jl: node.pre_contract_tp, pre_qc_jl: node.pre_qc_tp,
+            end_jl: node.end_gather_tp, end_contract_jl: node.end_contract_tp, end_qc_jl: node.end_qc_tp,
+            peg: peg ? this._getPegStr(peg.name) : '', drawing_code: this._getDrawingCode(node),
+            position: '',
+            lIndex: nodeIndex,
+        };
+        if (this.ctx.stage.im_gather && node.check) {
+            im.bw = this._getZlGatherBw(node, peg);
+            im.xm = '';
+        } else {
+            im.bw = this._getZlNormalBw(node, peg);
+            im.xm = node.name;
         }
+        this._checkCustomDetail(im);
+        im.check = this.ctx.stage.im_gather && node.check;
+        this._generateTzGclBillsData(node, im);
+        this.ImData.push(im);
+        this._generateTzChangeData(node, im);
     }
 
     _addBwBillsGclBills(im, bills, pos) {

+ 0 - 17
app/service/report_memory.js

@@ -766,23 +766,6 @@ module.exports = app => {
 
             await this._generateChange(tid);
             return this.changeData.bills;
-            // const data = await this.ctx.service.changeAuditList.getChangeAuditBills(tid);
-            // for (const d of data) {
-            //     //const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, d.unit);
-            //     d.o_qty = d.oamount;
-            //     d.o_tp = this.ctx.helper.mul(d.o_qty, d.unit_price, decimal.tp);
-            //     d.c_qty = d.camount;
-            //     d.c_tp = this.ctx.helper.mul(d.c_qty, d.unit_price, decimal.tp);
-            //     d.s_qty = d.samount ? parseFloat(d.samount) : 0;
-            //     d.s_tp = this.ctx.helper.mul(d.s_qty, d.unit_price, decimal.tp);
-            //
-            //     const auditAmount = d.audit_amount.split(',');
-            //     for (const [i, aa] of auditAmount.entries()) {
-            //         d['amount_' + (i + 1)] = aa ? parseFloat(aa) : 0;
-            //         d['tp_' + (i + 1)] = this.ctx.helper.mul(d['amount_' + i], d.unit_price, decimal.tp);
-            //     }
-            // }
-            //return data;
         }
 
         async getStageJgcl(tid, sid, fields) {