Bladeren bron

按比例计量计算问题

MaiXinRong 4 jaren geleden
bovenliggende
commit
0cf0e07de2
1 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 6 1
      app/service/stage_pos.js

+ 6 - 1
app/service/stage_pos.js

@@ -437,9 +437,14 @@ module.exports = app => {
 
                 const posStage = await this.getLastestStageData2(b.tender_id, this.ctx.stage.id, {lid: b.id});
                 let contract_qty = 0;
+                const newPosRange = data.filter(x => {return x.lid = b.id});
+                for (const nps of newPosRange) {
+                    contract_qty = this.ctx.helper.add(contract_qty, nps.contract_qty);
+                }
                 for (const ps of posStage) {
                     const nps = this._.find(datas, {pid: ps.pid});
-                    contract_qty = this.ctx.helper.add(contract_qty, nps ? nps.contract_qty : ps.contract_qty);
+                    if (nps) continue;
+                    contract_qty = this.ctx.helper.add(contract_qty, ps.contract_qty);
                 }
                 if (stageBills && stageBills.times === this.ctx.stage.curTimes && stageBills.order === this.ctx.stage.curOrder) {
                     if (contract_qty === stageBills.contract_qty) continue;