|
@@ -90,6 +90,16 @@ const gatherUtils = {
|
|
|
gatherNode['s_' + "gather_qty"] = helper.add(gatherNode['s_' + "gather_qty"], sourceNode.gather_qty);
|
|
|
gatherNode['s_' + "gather_tp"] = helper.add(gatherNode['s_' + "gather_tp"], sourceNode.gather_tp);
|
|
|
},
|
|
|
+ gatherLedger: function (tender, gatherNode, sourceNode, prefix, helper) {
|
|
|
+ gatherNode[prefix + 'id'] = tender.id;
|
|
|
+ gatherNode[prefix + 'name'] = tender.name;
|
|
|
+
|
|
|
+ gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
|
|
|
+ gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
|
|
|
+
|
|
|
+ gatherNode['s_' + "qty"] = helper.add(gatherNode['s_' + "qty"], sourceNode.quantity);
|
|
|
+ gatherNode['s_' + "tp"] = helper.add(gatherNode['s_' + "tp"], sourceNode.total_price);
|
|
|
+ },
|
|
|
gatherSpecial: function (gatherNode, sourceNode, prefix, helper) {
|
|
|
gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
|
|
|
gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
|
|
@@ -298,6 +308,27 @@ module.exports = app => {
|
|
|
await this._gatherStageData(index, tender, stages[0], hasPre);
|
|
|
}
|
|
|
|
|
|
+ async _gatherLegerData(sTender, index) {
|
|
|
+ const helper = this.ctx.helper;
|
|
|
+ const billsTree = new Ledger.billsTree(this.ctx, {
|
|
|
+ id: 'ledger_id',
|
|
|
+ pid: 'ledger_pid',
|
|
|
+ order: 'order',
|
|
|
+ level: 'level',
|
|
|
+ rootId: -1,
|
|
|
+ keys: ['id', 'tender_id', 'ledger_id'],
|
|
|
+ stageId: 'id',
|
|
|
+ calcFields: ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp', 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp'],
|
|
|
+ });
|
|
|
+ const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
|
|
|
+ const billsData = await this.ctx.service.ledger.getData(tender.id);
|
|
|
+ billsTree.loadDatas(billsData);
|
|
|
+ billsTree.calculateAll();
|
|
|
+ this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
|
|
|
+ gatherUtils.gatherLedger(tender, gatherNode, sourceNode, 't_' + index + '_', helper);
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
async _gatherSpecialData(sTender, sKey) {
|
|
|
const helper = this.ctx.helper;
|
|
|
const billsTree = new Ledger.billsTree(this.ctx, {
|
|
@@ -341,6 +372,9 @@ module.exports = app => {
|
|
|
case 'checked-final':
|
|
|
await this._gatherCheckedFinalData(tender, commonIndex, gsSetting.hasPre);
|
|
|
break;
|
|
|
+ case 'ledger':
|
|
|
+ await this._gatherLegerData(tender, commonIndex);
|
|
|
+ break;
|
|
|
}
|
|
|
commonIndex++;
|
|
|
} else {
|