|
@@ -94,6 +94,7 @@ class loadGclBaseTree {
|
|
|
}
|
|
|
} else {
|
|
|
const p = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
|
|
|
+ node.deal_qty = this.ctx.helper.round(node.deal_qty, p.value);
|
|
|
node.sgfh_qty = this.ctx.helper.round(node.sgfh_qty, p.value);
|
|
|
node.sjcl_qty = this.ctx.helper.round(node.sjcl_qty, p.value);
|
|
|
node.qtcl_qty = this.ctx.helper.round(node.qtcl_qty, p.value);
|
|
@@ -104,6 +105,7 @@ class loadGclBaseTree {
|
|
|
if (!db) return;
|
|
|
node.unit_price = db.unit_price;
|
|
|
}
|
|
|
+ node.deal_tp = this.ctx.helper.mul(node.deal_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
|
|
|
node.sgfh_tp = this.ctx.helper.mul(node.sgfh_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
|
|
|
node.sjcl_tp = this.ctx.helper.mul(node.sjcl_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
|
|
|
node.qtcl_tp = this.ctx.helper.mul(node.qtcl_qty, node.unit_price, this.ctx.tender.info.decimal.tp);
|
|
@@ -118,6 +120,7 @@ class loadGclBaseTree {
|
|
|
class loadLedgerGclTree extends loadGclBaseTree {
|
|
|
gather(source, parent) {
|
|
|
const node = this.addNode(source, parent);
|
|
|
+ node.deal_qty = this.ctx.helper.add(node.deal_qty, source.deal_qty);
|
|
|
node.sgfh_qty = this.ctx.helper.add(node.sgfh_qty, source.sgfh_qty);
|
|
|
node.qtcl_qty = this.ctx.helper.add(node.qtcl_qty, source.qtcl_qty);
|
|
|
node.sjcl_qty = this.ctx.helper.add(node.sjcl_qty, source.sjcl_qty);
|
|
@@ -134,6 +137,7 @@ class loadLedgerGclTree extends loadGclBaseTree {
|
|
|
id: i.id, tender_id: i.tender_id, ledger_id: i.ledger_id, ledger_pid: i.ledger_pid,
|
|
|
level: i.level, order: i.order, full_path: i.full_path, is_leaf: !i.children || i.children.length === 0,
|
|
|
b_code: i.b_code, name: i.name, unit: i.unit, unit_price: i.unit_price || 0,
|
|
|
+ deal_qty: i.deal_qty, deal_tp: i.deal_tp || 0,
|
|
|
sgfh_qty: i.sgfh_qty, sjcl_qty: i.sjcl_qty, qtcl_qty: i.qtcl_qty, quantity: i.quantity,
|
|
|
sgfh_tp: i.sgfh_tp || 0, sjcl_tp: i.sjcl_tp || 0, qtcl_tp: i.qtcl_tp || 0, total_price: i.total_price || 0,
|
|
|
});
|
|
@@ -168,6 +172,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
|
name: d.name,
|
|
|
unit: d.unit,
|
|
|
unit_price: d.unit_price,
|
|
|
+ org_deal_qty: d.deal_qty || 0,
|
|
|
org_sgfh_qty: d.sgfh_qty || 0,
|
|
|
org_sjcl_qty: d.sjcl_qty || 0,
|
|
|
org_qtcl_qty: d.qtcl_qty || 0,
|
|
@@ -186,6 +191,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
|
}
|
|
|
gather(source, parent) {
|
|
|
const node = this.addNode(source, parent);
|
|
|
+ node.deal_qty = this.ctx.helper.add(node.deal_qty, source.deal_qty);
|
|
|
node.sgfh_qty = this.ctx.helper.add(node.sgfh_qty, source.sgfh_qty);
|
|
|
node.qtcl_qty = this.ctx.helper.add(node.qtcl_qty, source.qtcl_qty);
|
|
|
node.sjcl_qty = this.ctx.helper.add(node.sjcl_qty, source.sjcl_qty);
|
|
@@ -200,15 +206,16 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
|
for (const bn of this.baseNodes) {
|
|
|
if (bn.children && bn.children.length > 0) continue;
|
|
|
|
|
|
- if (bn.sjcl_qty < bn.org_sjcl_qty || bn.qtcl_qty < bn.org_qtcl_qty || bn.sgfh_qty < bn.org_sgfh_qty) {
|
|
|
+ if (bn.deal_qty < bn.org_deal_qty || bn.sjcl_qty < bn.org_sjcl_qty || bn.qtcl_qty < bn.org_qtcl_qty || bn.sgfh_qty < bn.org_sgfh_qty) {
|
|
|
result.errors.push({
|
|
|
ledger_id: bn.ledger_id,
|
|
|
b_code: bn.b_code, name: bn.name, unit: bn.unit,
|
|
|
- sgfh_qty: bn.sgfh_qty, sjcl_qty: bn.sjcl_qty, qtcl_qty: bn.qtcl_qty, qty: bn.quantity, type: 'less',
|
|
|
+ deal_qty: i.deal_qty, sgfh_qty: bn.sgfh_qty, sjcl_qty: bn.sjcl_qty, qtcl_qty: bn.qtcl_qty, qty: bn.quantity, type: 'less',
|
|
|
});
|
|
|
} else if (bn.sjcl_qty !== bn.org_sjcl_qty || bn.qtcl_qty !== bn.org_qtcl_qty || bn.sgfh_qty !== bn.org_sgfh_qty) {
|
|
|
result.update.push({
|
|
|
id: bn.id, ledger_id: bn.ledger_id, unit_price: bn.unit_price || 0,
|
|
|
+ deal_qty: i.deal_qty, deal_tp: i.deal_tp || 0,
|
|
|
sgfh_qty: bn.sgfh_qty, sjcl_qty: bn.sjcl_qty, qtcl_qty: bn.qtcl_qty, quantity: bn.quantity,
|
|
|
sgfh_tp: bn.sgfh_tp || 0, sjcl_tp: bn.sjcl_tp || 0, qtcl_tp: bn.qtcl_tp || 0, total_price: bn.total_price || 0,
|
|
|
})
|
|
@@ -220,6 +227,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
|
id: i.id, tender_id: i.tender_id, ledger_id: i.ledger_id, ledger_pid: i.ledger_pid,
|
|
|
level: i.level, order: i.order, full_path: i.full_path, is_leaf: !i.children || i.children.length === 0,
|
|
|
b_code: i.b_code, name: i.name, unit: i.unit, unit_price: i.unit_price || 0,
|
|
|
+ deal_qty: i.deal_qty, deal_tp: i.deal_tp || 0,
|
|
|
sgfh_qty: i.sgfh_qty, sjcl_qty: i.sjcl_qty, qtcl_qty: i.qtcl_qty, quantity: i.quantity,
|
|
|
sgfh_tp: i.sgfh_tp || 0, sjcl_tp: i.sjcl_tp || 0, qtcl_tp: i.qtcl_tp || 0, total_price: i.total_price || 0,
|
|
|
})
|