Browse Source

报表,获取导入变更令明细

MaiXinRong 2 năm trước cách đây
mục cha
commit
78c1bb12f0
2 tập tin đã thay đổi với 15 bổ sung0 xóa
  1. 4 0
      app/service/report.js
  2. 11 0
      app/service/stage_import_change.js

+ 4 - 0
app/service/report.js

@@ -302,6 +302,10 @@ module.exports = app => {
                             runnableRst.push(service.stageChangeFinal.getFinalData(params.tender_id));
                             runnableKey.push(filter);
                             break;
+                        case 'mem_stage_import_change':
+                            runnableRst.push(service.stageImportChange.getFinalData(params.tender_id));
+                            runnableKey.push(filter);
+                            break;
                         case 'mem_ledger_tag':
                             runnableRst.push(service.ledgerTag.getDatas(params.tender_id));
                             runnableKey.push(filter);

+ 11 - 0
app/service/stage_import_change.js

@@ -222,6 +222,17 @@ module.exports = app => {
             result.great = helper.sum(helper._.map(bqData.filter(x => {return x.quality === changeConst.quality.great.value; }), 'tp'));
             return result;
         }
+
+        async getFinalData(tid) {
+            const sql = 'SELECT scf.*, ' +
+                '    oc.p_code As c_code, oc.new_code As c_new_code, oc.quality, ocb.code as b_code, ocb.name, ocb.unit' +
+                '  FROM ' + this.tableName + ' scf ' +
+                '  LEFT JOIN ' + this.ctx.service.stage.tableName + ' s ON scf.sid = s.id' +
+                '  LEFT JOIN ' + this.ctx.service.change.tableName + ' oc ON scf.rela_cid = oc.cid ' +
+                '  LEFT JOIN ' + this.ctx.service.changeAuditList.tableName + ' ocb ON scf.rela_cbid = ocb.id ' +
+                '  WHERE scf.tid = ?';
+            return await this.db.query(sql, [tid]);
+        }
     }
 
     return StageImportChange;