Browse Source

关联标段,计量单元数据问题

MaiXinRong 3 năm trước cách đây
mục cha
commit
df6f7acc9b
2 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 3 1
      app/lib/stage_im.js
  2. 5 3
      app/service/stage_rela.js

+ 3 - 1
app/lib/stage_im.js

@@ -1010,10 +1010,12 @@ class StageIm {
         }
     }
 
-    buildRelaStageIm(stage, billsTree, pos) {
+    buildRelaStageIm(stage, billsTree, pos, details, changes) {
         this.billsTree = billsTree;
         this.pos = pos;
         this.stage = stage;
+        this.details = details;
+        this.changes = changes;
 
         const self = this;
         // 初始化

+ 5 - 3
app/service/stage_rela.js

@@ -74,10 +74,12 @@ class srCache {
 
     async _loadPosData() {
         const pos = await this.ctx.service.pos.getPosData({tid: this.stage.tid});
-        const curPosData = await this.ctx.service.stagePos.getLastestStageData(this.stage.tid, this.stage.id);
+        console.log(this.stage);
+        const curPosData = await this.ctx.service.stagePos.getLastestStageData2(this.stage.tid, this.stage.id);
         const preStagePos = this.preRelaStage
             ? this.ctx.service.stageRelaPosFinal.getAllDataByCondition({ where: { sid: this.preRelaStage.sid, rela_tid: this.preRelaStage.rela_tid } })
             : [];
+        console.log(curPosData);
         this.ctx.helper.assignRelaData(pos, [
             { data: curPosData, fields: ['contract_qty', 'qc_qty', 'postil', 'pid'], prefix: '', relaId: 'pid' },
             { data: preStagePos, fields: ['contract_qty', 'qc_qty', 'postil', 'pid'], prefix: 'pre_', relaId: 'pid' },
@@ -184,11 +186,11 @@ class srCache {
     }
 
     async _getCacheStageIm() {
+        this.stageIm = [];
+        this.stageImBills = [];
         const stageIm = new StageIm(this.ctx);
         this.details = await this.ctx.service.stageDetail.getLastestStageData(this.stage.tid, this.stage.id);
         stageIm.buildRelaStageIm(this.stage, this.billsTree, this.pos, this.details, this.changes);
-        this.stageIm = [];
-        this.stageImBills = [];
         for (const i of stageIm.ImData) {
             this.stageIm.push({
                 tid: this.ctx.tender.id, sid: this.ctx.stage.id, sorder: this.ctx.stage.order,