MaiXinRong 1 rok temu
rodzic
commit
b711115657

+ 7 - 3
app/controller/stage_controller.js

@@ -224,7 +224,7 @@ module.exports = app => {
             this.ledgerExtraColumn = ['is_tp'];
             this.ledgerExtraColumn = ['is_tp'];
             if (this.ctx.session.sessionProject.gxby) this.ledgerExtraColumn.push('gxby_status', 'gxby_url', 'gxby_limit');
             if (this.ctx.session.sessionProject.gxby) this.ledgerExtraColumn.push('gxby_status', 'gxby_url', 'gxby_limit');
             if (this.ctx.session.sessionProject.dagl) this.ledgerExtraColumn.push('dagl_status', 'dagl_url', 'dagl_limit');
             if (this.ctx.session.sessionProject.dagl) this.ledgerExtraColumn.push('dagl_status', 'dagl_url', 'dagl_limit');
-            this.memoColumn = ['id', 'memo'];
+            this.ledgerMemoColumn = ['memo'];
 
 
 
 
             this.posColumn = ['id', 'tid', 'lid', 'name', 'position', 'porder', 'quantity', 'add_stage_order', 'drawing_code'];
             this.posColumn = ['id', 'tid', 'lid', 'name', 'position', 'porder', 'quantity', 'add_stage_order', 'drawing_code'];
@@ -233,14 +233,16 @@ module.exports = app => {
             this.posExtraColumn = [];
             this.posExtraColumn = [];
             if (this.ctx.session.sessionProject.gxby) this.posExtraColumn.push('gxby_status', 'gxby_url', 'gxby_limit');
             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 (this.ctx.session.sessionProject.dagl) this.posExtraColumn.push('dagl_status', 'dagl_url', 'dagl_limit');
+            this.posMemoColumn = [];
 
 
             if (!sjsRela) return;
             if (!sjsRela) return;
             if (sjsRela) {
             if (sjsRela) {
                 for (const field of sjsRela.ledgerCol) {
                 for (const field of sjsRela.ledgerCol) {
                     if (field.show) {
                     if (field.show) {
-                        this.memoColumn.push(field.field);
+                        this.ledgerMemoColumn.push(field.field);
                         this.ledgerColumn.push(field.field);
                         this.ledgerColumn.push(field.field);
                         this.posColumn.push(field.field);
                         this.posColumn.push(field.field);
+                        this.posMemoColumn.push(field.field);
                     }
                     }
                 }
                 }
             }
             }
@@ -250,7 +252,7 @@ module.exports = app => {
             const ledgerData = ctx.stage.ledgerHis
             const ledgerData = ctx.stage.ledgerHis
                 ? await ctx.helper.loadLedgerDataFromOss(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 } });
                 : await ctx.service.ledger.getAllDataByCondition({ columns: this.ledgerColumn, where: { tender_id: ctx.tender.id } });
-            const memoData = ctx.stage.ledgerHis ? await ctx.service.ledger.getAllDataByCondition({ columns: this.memoColumn, where: { tender_id: ctx.tender.id } }) : [];
+            const memoData = ctx.stage.ledgerHis ? await ctx.service.ledger.getMemoData(ctx.tender.id, this.ledgerMemoColumn) : [];
             const dgnData = await ctx.service.stageBillsDgn.getDgnData(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 extraData = await ctx.service.ledgerExtra.getData(ctx.tender.id, this.ledgerExtraColumn);
             const pcData = await ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: ctx.stage.id } });
             const pcData = await ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: ctx.stage.id } });
@@ -284,6 +286,7 @@ module.exports = app => {
             const posData = ctx.stage.ledgerHis
             const posData = ctx.stage.ledgerHis
                 ? await ctx.helper.loadLedgerDataFromOss(ctx.stage.ledgerHis.pos_file)
                 ? await ctx.helper.loadLedgerDataFromOss(ctx.stage.ledgerHis.pos_file)
                 : await ctx.service.pos.getAllDataByCondition({ columns: this.posColumn, where: { tid: ctx.tender.id } });
                 : await ctx.service.pos.getAllDataByCondition({ columns: this.posColumn, where: { tid: ctx.tender.id } });
+            const memoData = ctx.stage.ledgerHis ? await ctx.service.pos.getMemoData(ctx.tender.id, this.posMemoColumn) : [];
             const extraData = await ctx.service.posExtra.getData(ctx.tender.id, this.posExtraColumn);
             const extraData = await ctx.service.posExtra.getData(ctx.tender.id, this.posExtraColumn);
             // 根据当前人,或指定对象查询数据
             // 根据当前人,或指定对象查询数据
             if (ctx.stage.readOnly) {
             if (ctx.stage.readOnly) {
@@ -300,6 +303,7 @@ module.exports = app => {
             // 查询截止上期数据
             // 查询截止上期数据
             const preStageData = ctx.stage.order > 1 ? await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage.order - 1) : [];
             const preStageData = ctx.stage.order > 1 ? await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage.order - 1) : [];
             this.ctx.helper.assignRelaData(posData, [
             this.ctx.helper.assignRelaData(posData, [
+                { data: memoData, fields: this.posMemoColumn, prefix: '', relaId: 'id'},
                 { data: extraData, fields: this.posExtraColumn, prefix: '', relaId: 'id'},
                 { data: extraData, fields: this.posExtraColumn, prefix: '', relaId: 'id'},
                 { data: curStageData, fields: ['contract_qty', 'contract_expr', 'qc_qty', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'pid' },
                 { data: curStageData, fields: ['contract_qty', 'contract_expr', 'qc_qty', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'pid' },
                 { data: preStageData, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty'], prefix: 'pre_', relaId: 'pid' },
                 { data: preStageData, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty'], prefix: 'pre_', relaId: 'pid' },

+ 9 - 0
app/service/ledger.js

@@ -726,6 +726,15 @@ module.exports = app => {
                 throw (err.stack ? '导入工程量数据出错': err);
                 throw (err.stack ? '导入工程量数据出错': err);
             }
             }
         }
         }
+
+        async getMemoData(tid, columns) {
+            if (!columns || columns.length === 0) return [];
+
+            return await this.db.select(this.departTableName(tid), {
+                where: { tender_id: tid },
+                columns: ['id', ...columns],
+            });
+        }
     }
     }
 
 
     return Ledger;
     return Ledger;

+ 9 - 0
app/service/pos.js

@@ -501,6 +501,15 @@ module.exports = app => {
         async deletePosData(transaction, tid, lid) {
         async deletePosData(transaction, tid, lid) {
             await transaction.delete(this.tableName, {tid: tid, lid: lid});
             await transaction.delete(this.tableName, {tid: tid, lid: lid});
         }
         }
+
+        async getMemoData(tid, columns) {
+            if (!columns || columns.length === 0) return [];
+
+            return await this.db.select(this.departTableName(tid), {
+                where: { tid },
+                columns: ['id', ...columns],
+            });
+        }
     }
     }
 
 
     return Pos;
     return Pos;