|
@@ -31,6 +31,7 @@ class loadGclBaseTree {
|
|
|
this.ignoreParent = setting.ignoreParent;
|
|
|
this.ignoreNotFind = setting.ignoreNotFind;
|
|
|
this.loadChange = setting.loadChange;
|
|
|
+ this.useSubUp = setting.useSubUp;
|
|
|
|
|
|
// 缓存
|
|
|
this.keyNodeId = setting.maxId ? setting.maxId + 1 : 1;
|
|
@@ -145,6 +146,7 @@ class loadGclBaseTree {
|
|
|
quantity: 0,
|
|
|
is_leaf: source.is_leaf,
|
|
|
hasPos: false,
|
|
|
+ sub_up: source.unit_price || 0,
|
|
|
};
|
|
|
this.keyNodeId += 1;
|
|
|
parent.children.push(node);
|
|
@@ -186,8 +188,11 @@ class loadGclBaseTree {
|
|
|
|
|
|
if (!node.unit_price) {
|
|
|
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;
|
|
|
+ if (db) {
|
|
|
+ node.unit_price = db.unit_price;
|
|
|
+ } else if (this.useSubUp) {
|
|
|
+ node.unit_price = this.ctx.helper.round(node.sub_up, this.ctx.tender.info.decimal.up);
|
|
|
+ }
|
|
|
}
|
|
|
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);
|
|
@@ -482,9 +487,9 @@ class sumLoad {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async loadGatherGcl(select, maxId, tenders, defaultData) {
|
|
|
+ async loadGatherGcl(select, maxId, tenders, defaultData, subUp) {
|
|
|
this.loadTree = new loadLedgerGclTree(this.ctx, {
|
|
|
- parent: select, maxId, type: 'ledger', defaultData,
|
|
|
+ parent: select, maxId, type: 'ledger', defaultData, subUp,
|
|
|
});
|
|
|
for (const tender of tenders) {
|
|
|
const billsData = await this.ctx.service.ledger.getData(tender.tid);
|