|
@@ -100,7 +100,7 @@ class loadGclBaseTree {
|
|
|
node.quantity = this.ctx.helper.round(node.quantity, p.value);
|
|
|
|
|
|
if (!node.unit_price) {
|
|
|
- const db = dealBills.find(x => { return x.b_code === node.b_code && x.name === node.name && x.unit === node.unit });
|
|
|
+ const db = dealBills.find(x => { return x.code === node.b_code && x.name === node.name && x.unit === node.unit });
|
|
|
if (!db) return;
|
|
|
node.unit_price = db.unit_price;
|
|
|
}
|
|
@@ -133,10 +133,10 @@ class loadLedgerGclTree extends loadGclBaseTree {
|
|
|
create.push({
|
|
|
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,
|
|
|
+ b_code: i.b_code, name: i.name, unit: i.unit, unit_price: i.unit_price || 0,
|
|
|
sgfh_qty: i.sgfh_qty, sjcl_qty: i.sjcl_qty, qtcl_qty: i.qtcl_qty, quantity: i.quantity,
|
|
|
- sgfh_tp: i.sgfh_tp, sjcl_tp: i.sjcl_tp, qtcl_tp: i.qtcl_tp, total_price: i.total_price,
|
|
|
- })
|
|
|
+ sgfh_tp: i.sgfh_tp || 0, sjcl_tp: i.sjcl_tp || 0, qtcl_tp: i.qtcl_tp || 0, total_price: i.total_price || 0,
|
|
|
+ });
|
|
|
}
|
|
|
return {update, create};
|
|
|
}
|
|
@@ -210,7 +210,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
|
result.update.push({
|
|
|
id: bn.id, ledger_id: bn.ledger_id,
|
|
|
sgfh_qty: bn.sgfh_qty, sjcl_qty: bn.sjcl_qty, qtcl_qty: bn.qtcl_qty, quantity: bn.quantity,
|
|
|
- sgfh_tp: bn.sgfh_tp, sjcl_tp: bn.sjcl_tp, qtcl_tp: bn.qtcl_tp, total_price: bn.total_price,
|
|
|
+ sgfh_tp: bn.sgfh_tp || 0, sjcl_tp: bn.sjcl_tp || 0, qtcl_tp: bn.qtcl_tp || 0, total_price: bn.total_price || 0,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -219,9 +219,9 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
|
result.create.push({
|
|
|
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,
|
|
|
+ b_code: i.b_code, name: i.name, unit: i.unit, unit_price: i.unit_price || 0,
|
|
|
sgfh_qty: i.sgfh_qty, sjcl_qty: i.sjcl_qty, qtcl_qty: i.qtcl_qty, quantity: i.quantity,
|
|
|
- sgfh_tp: i.sgfh_tp, sjcl_tp: i.sjcl_tp, qtcl_tp: i.qtcl_tp, total_price: i.total_price,
|
|
|
+ sgfh_tp: i.sgfh_tp || 0, sjcl_tp: i.sjcl_tp || 0, qtcl_tp: i.qtcl_tp || 0, total_price: i.total_price || 0,
|
|
|
})
|
|
|
}
|
|
|
return result;
|
|
@@ -359,7 +359,7 @@ class sumLoad {
|
|
|
this.recusiveLoadGatherGcl(top, null);
|
|
|
}
|
|
|
}
|
|
|
- const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ tid: this.ctx.tender.id });
|
|
|
+ const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ where: { tender_id: this.ctx.tender.id } });
|
|
|
this.loadTree.calculateAll(dealBills);
|
|
|
return this.loadTree;
|
|
|
}
|
|
@@ -389,7 +389,7 @@ class sumLoad {
|
|
|
this.recusiveLoadGatherGcl(top, null);
|
|
|
}
|
|
|
}
|
|
|
- const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ tid: this.ctx.tender.id });
|
|
|
+ const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ where: { tender_id: this.ctx.tender.id } });
|
|
|
this.loadTree.calculateAll(dealBills);
|
|
|
return this.loadTree;
|
|
|
}
|