Sfoglia il codice sorgente

删除计量单元,清单不计价变更计算问题

MaiXinRong 2 anni fa
parent
commit
cdcda8756e
2 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 2 1
      app/service/stage_bills.js
  2. 1 1
      app/service/stage_pos.js

+ 2 - 1
app/service/stage_bills.js

@@ -196,7 +196,7 @@ module.exports = app => {
                 d.qc_qty = this.round(insertData.qc_qty, precision.value);
                 d.qc_tp = this.ctx.helper.mul(d.qc_qty, ledgerData.unit_price, info.decimal.tp);
             }
-            if (insertData.qc_minus_qty !== undefined) d.qc_minus_qty = this.round(insertData.qc_minus_qty, precision.value);
+            d.qc_minus_qty = insertData.qc_minus_qty ? this.round(insertData.qc_minus_qty, precision.value) : 0;
             if (insertData.postil) {
                 d.postil = insertData.postil;
             }
@@ -276,6 +276,7 @@ module.exports = app => {
             }
             const posGather = await this.ctx.service.stagePos.getPosGather(tid, sid, lid, transaction);
             if (!posGather) { return; }
+            posGather.qc_minus_qty = posGather.qc_minus_qty || 0;
 
             const precision = this.ctx.helper.findPrecision(info.precision, ledgerBills.unit);
             // 计算

+ 1 - 1
app/service/stage_pos.js

@@ -554,7 +554,7 @@ module.exports = app => {
                 orgPos = orgPos[0];
             }
             if (orgPos && orgPos.times === this.ctx.stage.curTimes && orgPos.order === this.ctx.stage.curOrder) {
-                await transaction.update(this.tableName, noValue ? {id: orgPos.id, qc_minus_qty: qty} : {id: orgPos.id, qc_qty: qty});
+                await transaction.update(this.tableName, noValue ? { id: orgPos.id, qc_minus_qty: qty || 0 } : {id: orgPos.id, qc_qty: qty});
             } else {
                 await transaction.insert(this.tableName, {
                     tid: this.ctx.tender.id,