|
@@ -435,6 +435,32 @@ class StageIm {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ _addBwBillsGclBills(im, bills) {
|
|
|
|
+ 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));
|
|
|
|
+ });
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ _calculateBwBillsIm(im) {
|
|
|
|
+ const tp_decimal = this.ctx.tender.info.decimal.tp;
|
|
|
|
+ im.contract_jl = 0;
|
|
|
|
+ im.qc_jl = 0;
|
|
|
|
+ for (const b of im.gclBills) {
|
|
|
|
+ im.contract_jl = this.ctx.helper.add(im.contract_jl, this.ctx.helper.mul(b.contract_jl, b.unit_price, tp_decimal));
|
|
|
|
+ im.qc_jl = this.ctx.helper.add(im.qc_jl, this.ctx.helper.mul(b.qc_jl, b.unit_price, tp_decimal));
|
|
|
|
+ }
|
|
|
|
+ im.jl = this.ctx.helper.add(im.contract_jl, im.qc_jl);
|
|
|
|
+ }
|
|
_getBwBillsIm(node, peg, index, bw) {
|
|
_getBwBillsIm(node, peg, index, bw) {
|
|
const im = {
|
|
const im = {
|
|
lid: node.id, pid: '', code: node.code, name: node.name, pos_name: '',
|
|
lid: node.id, pid: '', code: node.code, name: node.name, pos_name: '',
|
|
@@ -470,7 +496,6 @@ class StageIm {
|
|
_generateBwBillsImData (node) {
|
|
_generateBwBillsImData (node) {
|
|
if (!node.gather_tp && !node.contract_tp && !node.qc_tp) return;
|
|
if (!node.gather_tp && !node.contract_tp && !node.qc_tp) return;
|
|
|
|
|
|
- const tp_decimal = this.ctx.tender.info.decimal.tp;
|
|
|
|
const nodeIndex = gsTree.getNodeIndex(node);
|
|
const nodeIndex = gsTree.getNodeIndex(node);
|
|
const peg = this._getPegNode(node);
|
|
const peg = this._getPegNode(node);
|
|
const nodeImData = [], posterity = gsTree.getPosterity(node);
|
|
const nodeImData = [], posterity = gsTree.getPosterity(node);
|
|
@@ -488,23 +513,19 @@ class StageIm {
|
|
|
|
|
|
const im = this._getBwBillsPosIm(nodeImData, node, peg, nodeIndex, bw, pp.name);
|
|
const im = this._getBwBillsPosIm(nodeImData, node, peg, nodeIndex, bw, pp.name);
|
|
|
|
|
|
|
|
+ this._addBwBillsGclBills(im, {
|
|
|
|
+ b_code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price,
|
|
|
|
+ jl: pp.gather_qty, contract_jl: pp.contract_qty, qc_jl: pp.qc_qty
|
|
|
|
+ });
|
|
|
|
+
|
|
for (const c of changes) {
|
|
for (const c of changes) {
|
|
if (c.lid === p.id && c.pid == pp.id && c.qty && c.qty !== 0) {
|
|
if (c.lid === p.id && c.pid == pp.id && c.qty && c.qty !== 0) {
|
|
im.changes.push(c);
|
|
im.changes.push(c);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- im.jl = ZhCalc.add(im.jl, ZhCalc.mul(pp.gather_qty, p.unit_price, tp_decimal));
|
|
|
|
- im.contract_jl = ZhCalc.add(im.contract_jl, ZhCalc.mul(pp.contract_qty, p.unit_price, tp_decimal));
|
|
|
|
- im.qc_jl = ZhCalc.add(im.qc_jl, ZhCalc.mul(pp.qc_qty, p.unit_price, tp_decimal));
|
|
|
|
if (pp.drawing_code) im.drawing_code.push(pp.drawing_code);
|
|
if (pp.drawing_code) im.drawing_code.push(pp.drawing_code);
|
|
if (pp.position) im.position.push(pp.position);
|
|
if (pp.position) im.position.push(pp.position);
|
|
-
|
|
|
|
- im.gclBills.push({
|
|
|
|
- bid: p.id,
|
|
|
|
- b_code: p.b_code, name: p.name, unit: p.unit,
|
|
|
|
- jl: pp.gather_qty, contract_jl: pp.contract_qty, qc_jl: pp.qc_qty
|
|
|
|
- });
|
|
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
for (const c of changes) {
|
|
for (const c of changes) {
|
|
@@ -513,21 +534,23 @@ class StageIm {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- imDefault.jl = ZhCalc.add(imDefault.jl, p.gather_qty);
|
|
|
|
- imDefault.contract_jl = ZhCalc.add(imDefault.contract_jl, p.contract_qty);
|
|
|
|
- imDefault.qc_jl = ZhCalc.add(imDefault.qc_jl, p.qc_qty);
|
|
|
|
|
|
+ imDefault.contract_jl = this.ctx.helper.add(imDefault.contract_jl, p.contract_qty);
|
|
|
|
+ imDefault.qc_jl = this.ctx.helper.add(imDefault.qc_jl, p.qc_qty);
|
|
|
|
|
|
- imDefault.gclBills.push({
|
|
|
|
- bid: p.id,
|
|
|
|
- b_code: p.b_code, name: p.name, unit: p.unit,
|
|
|
|
- jl: p.gather_tp, contract_jl: p.contract_tp, qc_jl: p.qc_tp
|
|
|
|
|
|
+ this._addBwBillsGclBills(imDefault, {
|
|
|
|
+ b_code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price,
|
|
|
|
+ jl: p.gather_qty ? p.gather_qty : p.gather_tp,
|
|
|
|
+ contract_jl: p.contract_qty ? p.contract_qty : p.contract_tp,
|
|
|
|
+ qc_jl: p.qc_qty ? p.qc_qty : p.tp,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (imDefault.jl) {
|
|
|
|
|
|
+ if (imDefault.contract_jl || imDefault.qc_jl) {
|
|
|
|
+ imDefault.jl = this.ctx.helper.add(imDefault.contract_jl, imDefault.qc_jl);
|
|
ImData.push(imDefault);
|
|
ImData.push(imDefault);
|
|
}
|
|
}
|
|
for (const im of nodeImData) {
|
|
for (const im of nodeImData) {
|
|
|
|
+ this._calculateBwBillsIm(im);
|
|
im.drawing_code = im.drawing_code.join(mergeChar);
|
|
im.drawing_code = im.drawing_code.join(mergeChar);
|
|
im.position = im.position.join(mergeChar);
|
|
im.position = im.position.join(mergeChar);
|
|
ImData.push(im);
|
|
ImData.push(im);
|