|
@@ -358,7 +358,12 @@ module.exports = app => {
|
|
|
const l = this.ctx.helper._.find(billsData, {id: d.id});
|
|
|
this.ctx.helper._.assignIn(l, d);
|
|
|
}
|
|
|
- const pos = new Ledger.pos({ id: 'id', ledgerId: 'lid' });
|
|
|
+ const pos = new Ledger.pos({
|
|
|
+ id: 'id', ledgerId: 'lid',
|
|
|
+ calc: function (node) {
|
|
|
+ node.gather_qty = helper.add(node.contract_qty, node.qc_qty);
|
|
|
+ },
|
|
|
+ });
|
|
|
const posData = await this.ctx.service.pos.getAllDataByCondition({ where: { tid: tender.id} });
|
|
|
let billsIndexData = {};
|
|
|
for (const bd of billsData) {
|
|
@@ -390,6 +395,7 @@ module.exports = app => {
|
|
|
billsTree.loadDatas(billsData);
|
|
|
billsTree.calculateAll();
|
|
|
pos.loadDatas(posData);
|
|
|
+ pos.calculateAll();
|
|
|
this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
|
|
|
gatherUtils.gatherZone(tender, gatherNode, sourceNode, completeData.prefix, helper);
|
|
|
}, function (gatherNode, sourceNode) {
|
|
@@ -441,7 +447,16 @@ module.exports = app => {
|
|
|
const l = this.ctx.helper._.find(billsData, {id: d.id});
|
|
|
this.ctx.helper._.assignIn(l, d);
|
|
|
}
|
|
|
- const pos = new Ledger.pos({ id: 'id', ledgerId: 'lid' });
|
|
|
+ const pos = new Ledger.pos({
|
|
|
+ id: 'id', ledgerId: 'lid',
|
|
|
+ calc: function (node) {
|
|
|
+ node.pre_gather_qty = helper.add(node.pre_contract_qty, node.pre_qc_qty);
|
|
|
+ node.gather_qty = helper.add(node.contract_qty, node.qc_qty);
|
|
|
+ node.end_contract_qty = helper.add(node.pre_contract_qty, node.contract_qty);
|
|
|
+ node.end_qc_qty = helper.add(node.pre_qc_qty, node.qc_qty);
|
|
|
+ node.end_gather_qty = helper.add(node.pre_gather_qty, node.gather_qty);
|
|
|
+ },
|
|
|
+ });
|
|
|
const posData = await this.ctx.service.pos.getAllDataByCondition({ where: { tid: tender.id } });
|
|
|
if (stage) {
|
|
|
await this.ctx.service.stage.doCheckStage(stage);
|
|
@@ -468,6 +483,7 @@ module.exports = app => {
|
|
|
billsTree.loadDatas(billsData);
|
|
|
billsTree.calculateAll();
|
|
|
pos.loadDatas(posData);
|
|
|
+ pos.calculateAll();
|
|
|
|
|
|
this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
|
|
|
gatherUtils.gatherStage(tender, gatherNode, sourceNode, completeData.prefix, helper);
|