Browse Source

附加数据读取相关

MaiXinRong 2 years ago
parent
commit
bc53a7ad58
3 changed files with 6 additions and 4 deletions
  1. 4 2
      app/controller/stage_controller.js
  2. 1 1
      app/service/ledger_extra.js
  3. 1 1
      app/service/pos_extra.js

+ 4 - 2
app/controller/stage_controller.js

@@ -242,6 +242,7 @@ module.exports = app => {
             if (this.ctx.session.sessionProject.gxby) this.posExtraColumn.push('gxby_status', 'gxby_url', 'gxby_limit');
             if (this.ctx.session.sessionProject.dagl) this.posExtraColumn.push('dagl_status', 'dagl_url', 'dagl_limit');
 
+            if (!sjsRela) return;
             for (const field of sjsRela.ledgerCol) {
                 if (field.show) {
                     this.ledgerColumn.push(field.field);
@@ -252,9 +253,8 @@ module.exports = app => {
 
         async _getStageLedgerData(ctx) {
             const ledgerData = ctx.stage.ledgerHis
-                ? await ctx.service.ledger.loadDataFromOss(ctx.tender.id, ctx.stage.ledgerHis.bills_file)
+                ? await ctx.helper.loadLedgerDataFromOss(ctx.stage.ledgerHis.bills_file)
                 : await ctx.service.ledger.getAllDataByCondition({ columns: this.ledgerColumn, where: { tender_id: ctx.tender.id } });
-            // const ledgerData = await ctx.service.ledger.getAllDataByCondition({ columns: ledgerColumn, where: { tender_id: ctx.tender.id } });
             const dgnData = await ctx.service.stageBillsDgn.getDgnData(ctx.tender.id);
             const extraData = await ctx.service.ledgerExtra.getData(ctx.tender.id, this.ledgerExtraColumn);
             const importData = await ctx.service.stageImportChange.getImportLid(ctx.stage.id);
@@ -398,6 +398,7 @@ module.exports = app => {
 
         async check(ctx) {
             try {
+                this._getLedgerColumn();
                 const ledgerData = await this._getStageLedgerData(ctx);
                 const posData = await this._getStagePosData(ctx);
 
@@ -1414,6 +1415,7 @@ module.exports = app => {
 
         async loadBwtz(ctx) {
             try {
+                this._getLedgerColumn();
                 const data = ctx.request.body.data ? JSON.parse(ctx.request.body.data) : {};
                 const ledgerData = await this._getStageLedgerData(ctx);
                 const posData = await this._getStagePosData(ctx);

+ 1 - 1
app/service/ledger_extra.js

@@ -24,7 +24,7 @@ module.exports = app => {
         }
 
         async getData(tid, columns) {
-            if (columns.length === 0) return [];
+            if (!columns || columns.length === 0) return [];
 
             return await this.getAllDataByCondition({
                 where: { tid },

+ 1 - 1
app/service/pos_extra.js

@@ -24,7 +24,7 @@ module.exports = app => {
         }
 
         async getData(tid, columns) {
-            if (columns.length === 0) return [];
+            if (!columns || columns.length === 0) return [];
 
             return await this.getAllDataByCondition({
                 where: { tid },