Browse Source

其他台账。历史记录问题。

MaiXinRong 5 years ago
parent
commit
226418825e
3 changed files with 10 additions and 10 deletions
  1. 2 2
      app/controller/stage_extra_controller.js
  2. 4 4
      app/service/stage_jgcl.js
  3. 4 4
      app/service/stage_other.js

+ 2 - 2
app/controller/stage_extra_controller.js

@@ -49,7 +49,7 @@ module.exports = app => {
          */
         async loadJgcl (ctx) {
             try {
-                const data = await ctx.service.stageJgcl.getStageData(ctx.stage.id);
+                const data = await ctx.service.stageJgcl.getStageData(ctx.stage);
                 const preData = await ctx.service.stageJgcl.getPreStageData(ctx.stage.order);
                 for (const d of data) {
                     const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
@@ -165,7 +165,7 @@ module.exports = app => {
          */
         async loadOther (ctx) {
             try {
-                const data = await ctx.service.stageOther.getStageData(ctx.stage.id);
+                const data = await ctx.service.stageOther.getStageData(ctx.stage);
                 const preData = await ctx.service.stageOther.getPreStageData(ctx.stage.order);
                 for (const d of data) {
                     const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});

+ 4 - 4
app/service/stage_jgcl.js

@@ -22,13 +22,13 @@ module.exports = app => {
             this.tableName = 'stage_jgcl';
         }
 
-        async getStageData(sid) {
-            const data = await this.getAllDataByCondition({where: { sid: sid }});
-            if (this.ctx.stage && this.ctx.stage.readOnly && this.ctx.stage.status !== auditConst.status.checked) {
+        async getStageData(stage) {
+            const data = await this.getAllDataByCondition({where: { sid: stage.id }});
+            if (stage && stage.readOnly && stage.status !== auditConst.status.checked) {
                 for (const d of data) {
                     const his = d.shistory ? JSON.parse(d.shistory) : [];
                     const h = this.ctx.helper._.find(his, {
-                        stimes: this.ctx.stage.curTimes, sorder: this.ctx.stage.curOrder
+                        stimes: stage.curTimes, sorder: stage.curOrder
                     });
                     if (h) {
                         d.arrive_qty = h.arrive_qty ? h.arrive_qty : h.arraive_qty;

+ 4 - 4
app/service/stage_other.js

@@ -22,13 +22,13 @@ module.exports = app => {
             this.tableName = 'stage_other';
         }
 
-        async getStageData(sid) {
-            const data = await this.getAllDataByCondition({where: { sid: sid }});
-            if (this.ctx.stage && this.ctx.stage.readOnly && this.ctx.stage.status !== auditConst.status.checked) {
+        async getStageData(stage) {
+            const data = await this.getAllDataByCondition({where: { sid: stage.id }});
+            if (stage && stage.readOnly && stage.status !== auditConst.status.checked) {
                 for (const d of data) {
                     const his = d.shistory ? JSON.parse(d.shistory) : [];
                     const h = this.ctx.helper._.find(his, {
-                        stimes: this.ctx.stage.curTimes, sorder: this.ctx.stage.curOrder
+                        stimes: stage.curTimes, sorder: stage.curOrder
                     });
                     d.tp = h ? h.tp : null;
                 }