|
@@ -441,20 +441,21 @@ class StageIm {
|
|
|
}
|
|
|
|
|
|
_addBwBillsGclBills(im, bills) {
|
|
|
+ const helper = this.ctx.helper;
|
|
|
if (!im.gclBills) im.gclBills = [];
|
|
|
let gcl = im.gclBills.find(function (x) {
|
|
|
return (!bills.b_code || bills.b_code === x.b_code) &&
|
|
|
(!bills.name || bills.name === x.name) &&
|
|
|
(!bills.unit || bills.unit === x.unit) &&
|
|
|
- checkZero(this.ctx.helper.sub(bills.unit_price, x.unit_price));
|
|
|
+ helper.checkZero(helper.sub(bills.unit_price, x.unit_price));
|
|
|
});
|
|
|
if (!gcl) {
|
|
|
gcl = {b_code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.unit_price};
|
|
|
im.gclBills.push(gcl);
|
|
|
}
|
|
|
- gcl.contract_jl = this.ctx.helper.add(gcl.contract_jl, bills.contract_jl);
|
|
|
- gcl.qc_jl = this.ctx.helper.add(gcl.qc_jl, bills.qc_jl);
|
|
|
- gcl.jl = this.ctx.helper.add(gcl.jl, bills.jl);
|
|
|
+ gcl.contract_jl = helper.add(gcl.contract_jl, bills.contract_jl);
|
|
|
+ gcl.qc_jl = helper.add(gcl.qc_jl, bills.qc_jl);
|
|
|
+ gcl.jl = helper.add(gcl.jl, bills.jl);
|
|
|
}
|
|
|
_calculateBwBillsIm(im) {
|
|
|
const tp_decimal = this.ctx.tender.info.decimal.tp;
|
|
@@ -501,9 +502,9 @@ class StageIm {
|
|
|
_generateBwBillsImData (node) {
|
|
|
if (!node.gather_tp && !node.contract_tp && !node.qc_tp) return;
|
|
|
|
|
|
- const nodeIndex = gsTree.getNodeIndex(node);
|
|
|
+ const nodeIndex = this.billsTree.getNodeSerialNo(node);
|
|
|
const peg = this._getPegNode(node);
|
|
|
- const nodeImData = [], posterity = gsTree.getPosterity(node);
|
|
|
+ const nodeImData = [], posterity = this.billsTree.getPosterity(node);
|
|
|
const bw = this._getBwBillsBw(node);
|
|
|
const imDefault = this._getBwBillsIm(node, peg, nodeIndex, bw);
|
|
|
for (const p of posterity) {
|
|
@@ -523,7 +524,7 @@ class StageIm {
|
|
|
jl: pp.gather_qty, contract_jl: pp.contract_qty, qc_jl: pp.qc_qty
|
|
|
});
|
|
|
|
|
|
- for (const c of changes) {
|
|
|
+ for (const c of this.changes) {
|
|
|
if (c.lid === p.id && c.pid == pp.id && c.qty && c.qty !== 0) {
|
|
|
im.changes.push(c);
|
|
|
}
|
|
@@ -533,7 +534,7 @@ class StageIm {
|
|
|
if (pp.position && im.position instanceof Array) im.position.push(pp.position);
|
|
|
}
|
|
|
} else {
|
|
|
- for (const c of changes) {
|
|
|
+ for (const c of this.changes) {
|
|
|
if (c.lid === p.id && c.pid == -1 && c.qty && c.qty !== 0) {
|
|
|
imDefault.changes.push(c);
|
|
|
}
|
|
@@ -550,13 +551,13 @@ class StageIm {
|
|
|
}
|
|
|
if (imDefault.contract_jl || imDefault.qc_jl) {
|
|
|
imDefault.jl = this.ctx.helper.add(imDefault.contract_jl, imDefault.qc_jl);
|
|
|
- ImData.push(imDefault);
|
|
|
+ this.ImData.push(imDefault);
|
|
|
}
|
|
|
for (const im of nodeImData) {
|
|
|
this._calculateBwBillsIm(im);
|
|
|
im.drawing_code = this.ctx.helper._.uniq(im.drawing_code).join(mergeChar);
|
|
|
im.position = this.ctx.helper._.uniq(im.position).join(mergeChar);
|
|
|
- ImData.push(im);
|
|
|
+ this.ImData.push(im);
|
|
|
}
|
|
|
}
|
|
|
|