Browse Source

汇总对比相关

MaiXinRong 3 months atrás
parent
commit
30e0bb7821
1 changed files with 17 additions and 5 deletions
  1. 17 5
      app/controller/spss_controller.js

+ 17 - 5
app/controller/spss_controller.js

@@ -639,9 +639,13 @@ module.exports = app => {
             if (!stage) return [];
 
             const data = await this.ctx.service.stageSafeProd.getStageData(stage);
+            const preData = await this.ctx.service.stageSafeProd.getEndStageData(stage.tid, stage.order);
             for (const d of data) {
-                d.pre_qty = this.ctx.helper.add(d.qty, d.pre_qty);
-                d.pre_tp = this.ctx.helper.add(d.tp, d.pre_tp);
+                const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
+                if (pd) {
+                    d.pre_qty = pd.qty;
+                    d.pre_tp = pd.tp;
+                }
                 d.end_qty = d.pre_qty;
                 d.end_tp = d.pre_tp;
                 d.qty = 0;
@@ -679,9 +683,13 @@ module.exports = app => {
             if (!stage) return [];
 
             const data = await this.ctx.service.stageTempLand.getStageData(stage);
+            const preData = await this.ctx.service.stageTempLand.getEndStageData(stage.tid, stage.order);
             for (const d of data) {
-                d.pre_qty = this.ctx.helper.add(d.qty, d.pre_qty);
-                d.pre_tp = this.ctx.helper.add(d.tp, d.pre_tp);
+                const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
+                if (pd) {
+                    d.pre_qty = pd.qty;
+                    d.pre_tp = pd.tp;
+                }
                 d.end_qty = d.pre_qty;
                 d.end_tp = d.pre_tp;
                 d.qty = 0;
@@ -717,8 +725,12 @@ module.exports = app => {
             if (!stage) return [];
 
             const data = await this.ctx.service.stageOther.getStageData(stage);
+            const preData = await this.ctx.service.stageOther.getEndStageData(stage.tid, stage.order);
             for (const d of data) {
-                d.pre_tp = this.ctx.helper.add(d.pre_tp, d.tp);
+                const pd = this.ctx.helper._.find(preData, {uuid: d.uuid});
+                if (pd) {
+                    d.pre_tp = pd.tp;
+                }
                 d.end_tp = d.pre_tp;
                 d.tp = 0;
             }