| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- 'use strict';
- /**
- * 要求必须有ctx.subProject
- * 如果不是子项目内部使用,需要先载入ctx.subProject再使用
- *
- * @author Mai
- * @date
- * @version
- */
- class reportMemorySpss {
- constructor(ctx) {
- this.ctx = ctx;
- }
- async _loadTypeData(type) {
- if (!this[type]) this[type] = await this.ctx.service.spssStash.getLatestSpssStash(this.ctx.subProject.id, type);
- }
- async getTypeTender(type) {
- await this._loadTypeData(type);
- return this[type] ? this[type].spss_select : [];
- }
- async getTyperBills(type) {
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.bills : [];
- }
- getBillsPosData(bills) {
- const pos = [];
- for (const b of bills) {
- if (!b.pos || b.pos.length === 0) continue;
- b.pos.forEach(x => { x.lid === b.ledger_id; });
- pos.push(...b.pos);
- }
- return pos;
- }
- async getTypePos(type) {
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this.getBillsPosData(this[type].spss_result.bills) : [];
- }
- async getGatherStageInfoTender() {
- return await this.getTypeTender('gather_stage_info');
- }
- async getGatherStageInfo() {
- await this._loadTypeData('gather_stage_info');
- return this.gather_stage_info.spss_result || [];
- }
- async getGatherLedgerTender() {
- return await this.getTypeTender('gather_ledger');
- }
- async getGatherLedgerBills() {
- return await this.getTyperBills('gather_ledger');
- }
- async getGatherLedgerPos() {
- return await this.getTypePos('gather_ledger');
- }
- async getGatherStageTender() {
- return await this.getTypeTender('gather_stage');
- }
- async getGatherStageBills() {
- return await this.getTyperBills('gather_stage');
- }
- async getGatherStagePos() {
- return await this.getTypePos('gather_stage');
- }
- async getGatherStageExtraTender() {
- return await this.getTypeTender('gather_stage_extra');
- }
- async getGatherStageJgcl() {
- const type = 'gather_stage_extra';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.jgcl : [];
- }
- async getGatherStageYjcl() {
- const type = 'gather_stage_extra';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.yjcl : [];
- }
- async getGatherStageBonus() {
- const type = 'gather_stage_extra';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.bonus : [];
- }
- async getGatherStageOther() {
- const type = 'gather_stage_extra';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.other : [];
- }
- async getGatherStageSafeProd() {
- const type = 'gather_stage_extra';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.safeProd : [];
- }
- async getGatherStageTempLand() {
- const type = 'gather_stage_extra';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.tempLand : [];
- }
- async getGatherStagePayTender() {
- return await this.getTypeTender('gather_stage_pay');
- }
- async getGatherStagePay() {
- const type = 'gather_stage_pay';
- await this._loadTypeData(type);
- return this[type] && this[type].spss_result ? this[type].spss_result.pays : [];
- }
- async getCompareLedgerTender() {
- return await this.getTypeTender('compare_ledger');
- }
- async getCompareLedgerBills() {
- return await this.getTyperBills('compare_ledger');
- }
- async getCompareLedgerPos() {
- return await this.getTypePos('compare_ledger');
- }
- async getCompareStageTender() {
- return await this.getTypeTender('compare_stage');
- }
- async getCompareStageBills() {
- return await this.getTyperBills('compare_stage');
- }
- async getCompareStagePos() {
- return await this.getTypePos('compare_stage');
- }
- }
- module.exports = reportMemorySpss;
|