Browse Source

计量台账,导入(其他标段)工程量清单计量数据,导入不计价、正负变更相关

MaiXinRong 2 years ago
parent
commit
edd80da5e4
1 changed files with 27 additions and 4 deletions
  1. 27 4
      app/lib/sum_load.js

+ 27 - 4
app/lib/sum_load.js

@@ -344,6 +344,11 @@ class gatherStageGclTree extends loadGclBaseTree {
                 org_contract_tp: d.contract_tp || 0,
                 org_contract_tp: d.contract_tp || 0,
                 org_qc_qty: d.qc_qty || 0,
                 org_qc_qty: d.qc_qty || 0,
                 org_qc_tp: d.qc_tp || 0,
                 org_qc_tp: d.qc_tp || 0,
+                org_qc_minus_qty: d.qc_minus_qty || 0,
+                org_positive_qc_qty: d.positive_qc_qty || 0,
+                org_positive_qc_tp: d.positive_qc_tp || 0,
+                org_negative_qc_qty: d.negative_qc_qty || 0,
+                org_negative_qc_tp: d.negative_qc_tp || 0,
                 org_order: d.order,
                 org_order: d.order,
                 contract_qty: 0,
                 contract_qty: 0,
                 contract_tp: 0,
                 contract_tp: 0,
@@ -380,6 +385,11 @@ class gatherStageGclTree extends loadGclBaseTree {
 
 
             node.qc_qty = this.ctx.helper.add(node.qc_qty, source.qc_qty);
             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_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);
         this._gatherChange(node, source);
         return node;
         return node;
@@ -390,17 +400,27 @@ class gatherStageGclTree extends loadGclBaseTree {
             if (!this.cover && !bn.is_import && !bn.contract_qty && !bn.qc_qty && !bn.contract_tp) continue;
             if (!this.cover && !bn.is_import && !bn.contract_qty && !bn.qc_qty && !bn.contract_tp) continue;
 
 
             if (!bn.is_import && bn.org_qc_qty !== 0 && bn.qc_qty !== 0) {
             if (!bn.is_import && bn.org_qc_qty !== 0 && bn.qc_qty !== 0) {
-                result.errors.push({ b_code: bn.b_code, name: bn.name, unit: bn.unit, qc_qty: bn.qc_qty, ledger_id: bn.ledger_id, type: 'qc-conflict'});
+                result.errors.push({ b_code: bn.b_code, name: bn.name, unit: bn.unit, qc_qty: bn.qc_qty, qc_minus_qty: bn.qc_minus_qty, ledger_id: bn.ledger_id, type: 'qc-conflict'});
                 continue;
                 continue;
             }
             }
-            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) {
+            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 };
                 let data = { lid: bn.id, contract_qty: bn.contract_qty, contract_tp: bn.contract_tp };
                 if (!bn.is_import && bn.org_qc_qty) {
                 if (!bn.is_import && bn.org_qc_qty) {
                     data.qc_qty = bn.org_qc_qty;
                     data.qc_qty = bn.org_qc_qty;
                     data.qc_tp = bn.org_qc_tp;
                     data.qc_tp = bn.org_qc_tp;
+                    data.qc_minus_qty = bn.org_qc_minus_qty;
+                    data.positive_qc_qty = bn.positive_qc_qty;
+                    data.positive_qc_tp = bn.positive_qc_tp;
+                    data.negative_qc_qty = bn.negative_qc_qty;
+                    data.negative_qc_tp = bn.negative_qc_tp;
                 } else {
                 } else {
                     data.qc_qty = bn.qc_qty;
                     data.qc_qty = bn.qc_qty;
                     data.qc_tp = bn.qc_tp;
                     data.qc_tp = bn.qc_tp;
+                    data.qc_minus_qty = bn.qc_minus_qty;
+                    data.positive_qc_qty = bn.positive_qc_qty;
+                    data.positive_qc_tp = bn.positive_qc_tp;
+                    data.negative_qc_qty = bn.negative_qc_qty;
+                    data.negative_qc_tp = bn.negative_qc_tp;
                 }
                 }
                 result.update.push(data);
                 result.update.push(data);
             }
             }
@@ -413,7 +433,7 @@ class gatherStageGclTree extends loadGclBaseTree {
             }
             }
         }
         }
         for (const i of this.items) {
         for (const i of this.items) {
-            result.errors.push({ b_code: i.b_code, name: i.name, unit: i.unit, qty: i.contract_qty, qc_qty: i.qc_qty, type: 'miss' });
+            result.errors.push({ b_code: i.b_code, name: i.name, unit: i.unit, qty: i.contract_qty, qc_qty: i.qc_qty, qc_minus_qty: i.qc_minus_qty, type: 'miss' });
         }
         }
         return result;
         return result;
     }
     }
@@ -502,6 +522,9 @@ class sumLoad {
             b.contract_qty = csb.contract_qty;
             b.contract_qty = csb.contract_qty;
             b.contract_tp = csb.contract_tp;
             b.contract_tp = csb.contract_tp;
             b.qc_qty = csb.qc_qty;
             b.qc_qty = csb.qc_qty;
+            b.qc_minus_qty = csb.qc_minus_qty;
+            b.positive_qc_qty = csb.positive_qc_qty;
+            b.negative_qc_qty = csb.negative_qc_qty;
         }
         }
         for (const csc of curStageChange) {
         for (const csc of curStageChange) {
             if (!csc.qty) continue;
             if (!csc.qty) continue;
@@ -530,7 +553,7 @@ class sumLoad {
         this.ctx.helper.assignRelaData(posterity, [
         this.ctx.helper.assignRelaData(posterity, [
             { data: extraData, fields: ['is_import'], prefix: '', relaId: 'id' },
             { data: extraData, fields: ['is_import'], prefix: '', relaId: 'id' },
             { data: importLid, fields: ['is_import'], prefix: '', relaId: 'lid' },
             { data: importLid, fields: ['is_import'], prefix: '', relaId: 'lid' },
-            { data: stageBills, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'], prefix: '', relaId: 'lid' },
+            { data: stageBills, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'positive_qc_qty', 'positive_qc_tp', 'negative_qc_qty', 'negative_qc_tp'], prefix: '', relaId: 'lid' },
         ]);
         ]);
         const pos = await this.ctx.service.pos.getAllDataByCondition({ where: { tid: this.ctx.tender.id } });
         const pos = await this.ctx.service.pos.getAllDataByCondition({ where: { tid: this.ctx.tender.id } });
         this.loadTree.loadBase(posterity, pos);
         this.loadTree.loadBase(posterity, pos);