|
@@ -40,7 +40,7 @@ class loadGclBaseTree {
|
|
for (const child of parent.children) {
|
|
for (const child of parent.children) {
|
|
const checkLeaf = (child.is_leaf && node.is_leaf) || (!child.is_leaf && !node.is_leaf);
|
|
const checkLeaf = (child.is_leaf && node.is_leaf) || (!child.is_leaf && !node.is_leaf);
|
|
if (child.b_code === node.b_code && child.name === node.name && child.unit === node.unit
|
|
if (child.b_code === node.b_code && child.name === node.name && child.unit === node.unit
|
|
- && checkLeaf && (!check || check(child, node))) {
|
|
|
|
|
|
+ && checkLeaf && !child.hasPos && (!check || check(child, node))) {
|
|
return child;
|
|
return child;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -75,6 +75,7 @@ class loadGclBaseTree {
|
|
sjcl_qyt: 0,
|
|
sjcl_qyt: 0,
|
|
quantity: 0,
|
|
quantity: 0,
|
|
is_leaf: source.is_leaf,
|
|
is_leaf: source.is_leaf,
|
|
|
|
+ hasPos: false,
|
|
};
|
|
};
|
|
this.keyNodeId += 1;
|
|
this.keyNodeId += 1;
|
|
parent.children.push(node);
|
|
parent.children.push(node);
|
|
@@ -146,7 +147,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
this.baseNodes = [];
|
|
this.baseNodes = [];
|
|
this.errors = [];
|
|
this.errors = [];
|
|
}
|
|
}
|
|
- loadBase(datas) {
|
|
|
|
|
|
+ loadBase(datas, pos) {
|
|
datas.sort((x, y) => { return x.level === y.level ? x.order - y.order : x.level - y.level; });
|
|
datas.sort((x, y) => { return x.level === y.level ? x.order - y.order : x.level - y.level; });
|
|
const Index = {};
|
|
const Index = {};
|
|
for (const d of datas) {
|
|
for (const d of datas) {
|
|
@@ -154,6 +155,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
if (!parent) continue;
|
|
if (!parent) continue;
|
|
|
|
|
|
if (!parent.children) parent.children = [];
|
|
if (!parent.children) parent.children = [];
|
|
|
|
+ const relaPos = pos.filter(x => {return x.lid === d.id});
|
|
const baseNode = {
|
|
const baseNode = {
|
|
id: d.id,
|
|
id: d.id,
|
|
ledger_id: d.ledger_id,
|
|
ledger_id: d.ledger_id,
|
|
@@ -174,6 +176,7 @@ class updateReviseGclTree extends loadGclBaseTree {
|
|
sjcl_qty: 0,
|
|
sjcl_qty: 0,
|
|
qtcl_qty: 0,
|
|
qtcl_qty: 0,
|
|
quantity: 0,
|
|
quantity: 0,
|
|
|
|
+ hasPos: relaPos.length > 0,
|
|
};
|
|
};
|
|
parent.children.push(baseNode);
|
|
parent.children.push(baseNode);
|
|
Index[baseNode.ledger_id] = baseNode;
|
|
Index[baseNode.ledger_id] = baseNode;
|
|
@@ -226,7 +229,7 @@ class gatherStageGclTree extends loadGclBaseTree {
|
|
super(ctx, setting);
|
|
super(ctx, setting);
|
|
this.baseNodes = [];
|
|
this.baseNodes = [];
|
|
}
|
|
}
|
|
- loadBase(datas) {
|
|
|
|
|
|
+ loadBase(datas, pos) {
|
|
datas.sort((x, y) => { return x.level === y.level ? x.order - y.order : x.level - y.level; });
|
|
datas.sort((x, y) => { return x.level === y.level ? x.order - y.order : x.level - y.level; });
|
|
const Index = {};
|
|
const Index = {};
|
|
for (const d of datas) {
|
|
for (const d of datas) {
|
|
@@ -234,6 +237,7 @@ class gatherStageGclTree extends loadGclBaseTree {
|
|
if (!parent) continue;
|
|
if (!parent) continue;
|
|
|
|
|
|
if (!parent.children) parent.children = [];
|
|
if (!parent.children) parent.children = [];
|
|
|
|
+ const relaPos = pos.filter(x => {return x.lid === d.id});
|
|
const baseNode = {
|
|
const baseNode = {
|
|
id: d.id,
|
|
id: d.id,
|
|
ledger_id: d.ledger_id,
|
|
ledger_id: d.ledger_id,
|
|
@@ -251,6 +255,7 @@ class gatherStageGclTree extends loadGclBaseTree {
|
|
contract_qty: 0,
|
|
contract_qty: 0,
|
|
contract_tp: 0,
|
|
contract_tp: 0,
|
|
is_tp: d.is_tp,
|
|
is_tp: d.is_tp,
|
|
|
|
+ hasPos: relaPos.length > 0,
|
|
};
|
|
};
|
|
parent.children.push(baseNode);
|
|
parent.children.push(baseNode);
|
|
Index[baseNode.ledger_id] = baseNode;
|
|
Index[baseNode.ledger_id] = baseNode;
|
|
@@ -274,7 +279,7 @@ class gatherStageGclTree extends loadGclBaseTree {
|
|
gather(source, parent) {
|
|
gather(source, parent) {
|
|
parent = parent ? parent : this.parent;
|
|
parent = parent ? parent : this.parent;
|
|
const node = this.addNode(source, parent, function (node, source) {
|
|
const node = this.addNode(source, parent, function (node, source) {
|
|
- return (source.is_tp && node.is_tp) || (!source.is_tp && !node.is_tp);
|
|
|
|
|
|
+ return (source.is_tp && node.is_tp) || (!source.is_tp && !node.is_tp);
|
|
});
|
|
});
|
|
if (node.is_tp) {
|
|
if (node.is_tp) {
|
|
node.contract_tp = this.ctx.helper.add(node.contract_tp, source.contract_tp);
|
|
node.contract_tp = this.ctx.helper.add(node.contract_tp, source.contract_tp);
|
|
@@ -360,7 +365,8 @@ class sumLoad {
|
|
parent: select, maxId, type: 'ledger', defaultData,
|
|
parent: select, maxId, type: 'ledger', defaultData,
|
|
});
|
|
});
|
|
const posterity = await this.ctx.service.reviseBills.getPosterityByParentId(this.ctx.tender.id, select.ledger_id);
|
|
const posterity = await this.ctx.service.reviseBills.getPosterityByParentId(this.ctx.tender.id, select.ledger_id);
|
|
- this.loadTree.loadBase(posterity);
|
|
|
|
|
|
+ const pos = await this.ctx.service.revisePos.getData(this.ctx.tender.id);
|
|
|
|
+ this.loadTree.loadBase(posterity, pos);
|
|
|
|
|
|
for (const tender of tenders) {
|
|
for (const tender of tenders) {
|
|
const billsData = await this.ctx.service.ledger.getData(tender.tid);
|
|
const billsData = await this.ctx.service.ledger.getData(tender.tid);
|
|
@@ -415,7 +421,8 @@ class sumLoad {
|
|
parent: select, maxId, type: 'ledger', defaultData,
|
|
parent: select, maxId, type: 'ledger', defaultData,
|
|
});
|
|
});
|
|
const posterity = await this.ctx.service.ledger.getPosterityByParentId(this.ctx.tender.id, select.ledger_id);
|
|
const posterity = await this.ctx.service.ledger.getPosterityByParentId(this.ctx.tender.id, select.ledger_id);
|
|
- this.loadTree.loadBase(posterity);
|
|
|
|
|
|
+ const pos = await this.ctx.service.revisePos.getData(this.ctx.tender.id);
|
|
|
|
+ this.loadTree.loadBase(posterity, pos);
|
|
|
|
|
|
for (const tender of tenders) {
|
|
for (const tender of tenders) {
|
|
if (!tender.stage) continue;
|
|
if (!tender.stage) continue;
|