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